mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
Passenger control for antenna toggle
This commit is contained in:
34
cl_radar.lua
34
cl_radar.lua
@@ -1579,24 +1579,26 @@ end )
|
|||||||
|
|
||||||
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote
|
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote
|
||||||
RegisterNUICallback( "toggleAntenna", function( data, cb )
|
RegisterNUICallback( "toggleAntenna", function( data, cb )
|
||||||
-- Only run the codw if the radar has power and is not powering up
|
if ( PLY:CanControlRadar() ) then
|
||||||
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
|
-- Only run the codw if the radar has power and is not powering up
|
||||||
-- As the xmit/hold buttons are used to change settings in the menu, we check for that
|
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
|
||||||
if ( RADAR:IsMenuOpen() ) then
|
-- As the xmit/hold buttons are used to change settings in the menu, we check for that
|
||||||
-- Change the menu option based on which button is pressed
|
if ( RADAR:IsMenuOpen() ) then
|
||||||
RADAR:ChangeMenuOption( data.value )
|
-- Change the menu option based on which button is pressed
|
||||||
|
RADAR:ChangeMenuOption( data.value )
|
||||||
|
|
||||||
-- Play a beep noise
|
-- Play a beep noise
|
||||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||||
else
|
else
|
||||||
-- Toggle the transmit state for the designated antenna, pass along a callback which contains data from this NUI callback
|
-- Toggle the transmit state for the designated antenna, pass along a callback which contains data from this NUI callback
|
||||||
RADAR:ToggleAntenna( data.value, function()
|
RADAR:ToggleAntenna( data.value, function()
|
||||||
-- Update the interface with the new antenna transmit state
|
-- Update the interface with the new antenna transmit state
|
||||||
SendNUIMessage( { _type = "antennaXmit", ant = data.value, on = RADAR:IsAntennaTransmitting( data.value ) } )
|
SendNUIMessage( { _type = "antennaXmit", ant = data.value, on = RADAR:IsAntennaTransmitting( data.value ) } )
|
||||||
|
|
||||||
-- Play some audio specific to the transmit state
|
-- Play some audio specific to the transmit state
|
||||||
SendNUIMessage( { _type = "audio", name = RADAR:IsAntennaTransmitting( data.value ) and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } )
|
SendNUIMessage( { _type = "audio", name = RADAR:IsAntennaTransmitting( data.value ) and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||||
end )
|
end )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user