mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
feat: power button sync and passenger control
The power state is now synced between the driver and passenger. The passenger can also toggle the radar's power if the config line allows for it.
This commit is contained in:
@@ -1487,8 +1487,12 @@ end )
|
||||
-- Runs when the user presses the power button on the radar ui
|
||||
RegisterNUICallback( "togglePower", function( data, cb )
|
||||
if ( PLY:CanControlRadar() ) then
|
||||
-- Toggle the radar's power
|
||||
RADAR:TogglePower()
|
||||
if ( not RADAR:IsPoweringUp() ) then
|
||||
-- Toggle the radar's power
|
||||
RADAR:TogglePower()
|
||||
|
||||
SYNC:SendPowerState( RADAR:IsPowerOn() )
|
||||
end
|
||||
end
|
||||
|
||||
cb( "ok" )
|
||||
|
||||
Reference in New Issue
Block a user