Mining Helmet
⛑️ PG Mining Helmet – v2.0
🔥 Major Overhaul
-
Fully rewritten client, server, and bridge architecture
-
Server-authoritative core – no client-side battery or light control
-
Framework-agnostic design (ESX / QBCore / Standalone via bridge)
🔋 Battery System (Reworked)
-
Item-based battery durability support (ox_inventory compatible)
- Optional database-stored battery mode (config switch)
- Server-side battery drain & validation
- Throttled DB writes to reduce load
- Detailed battery history logging
- Automatic light shutdown on empty battery
💡 Headlamp Improvements
-
Multiple light modes
- Focused beam
- Wide flood beam
- Red light mode
- Per-player mode persistence
- Smooth low-battery flicker effects
- Automatic light validation on equip
🌐 Networked Visibility
-
Other players can now see headlamps
- Distance-based rendering for performance
- Server-synced light states & modes
⚡ Charging System
-
World-based charging stations
- ox_lib progress bar integration
- Server-validated distance & movement checks
- Configurable charge rates & cooldowns
- Anti-spam protection
🧠 Safety & Anti-Abuse
- Light toggle cooldowns (client + server)
- Prevents usage while:
- In vehicles
- Swimming / underwater
- Falling / ragdoll
- Dead
- Auto-disable on invalid states
🎮 Immersion Enhancements
- Helmet equip / toggle sounds
- Optional low-battery spark effects
- Clean ox_lib TextUI
- Displays Light state, Battery %, and Mode
- Improved animations when equipping/removing helmet
💾 Persistence
- Persistent beam settings (KVP)
- Persistent light mode selection
- Optional persistent equipped state
- Safe restore on player reconnect
🔌 API & Developer Features
- New exports for integration with other scripts:
- Get battery %
- Set battery
- Toggle light
- Change light mode
- Centralized event constants via shared bridge
- Improved debug tools & admin commands
🧩 Bridge System (Rewritten)
- Unified client/server/shared bridge
- Clean inventory abstraction (ox_inventory + framework fallback)
- Job restriction ready (miner roles, grades)
- Safe identifier handling
- Consistent notifications across frameworks
⚙️ Configuration Improvements
- Fully reorganized
config.lua
- Clear feature toggles
- Charging stations defined in config
- Light modes fully configurable
- Easy future expansion
🛠️ Performance & Stability
- Optimized spotlight drawing
- Throttled loops & network events
- Reduced database usage
- Safe cleanup on disconnect/resource stop
📦 Compatibility
- FiveM Cerulean
- ESX / QBCore / Standalone
- ox_lib
- ox_inventory (optional)