mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Fixed xmit and mode working when powering up
This commit is contained in:
14
cl_radar.lua
14
cl_radar.lua
@@ -1351,8 +1351,10 @@ end )
|
||||
|
||||
-- Runs when the user presses any of the antenna mode buttons on the remote
|
||||
RegisterNUICallback( "setAntennaMode", function( data )
|
||||
-- Only run the codw if the radar has power and is not powering up
|
||||
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
|
||||
-- As the mode buttons are used to exit the menu, we check for that
|
||||
if ( RADAR:IsPowerOn() and RADAR:IsMenuOpen() ) then
|
||||
if ( RADAR:IsMenuOpen() ) then
|
||||
-- Set the internal menu state to be closed (false)
|
||||
RADAR:SetMenuState( false )
|
||||
|
||||
@@ -1371,12 +1373,15 @@ RegisterNUICallback( "setAntennaMode", function( data )
|
||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||
end )
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote
|
||||
RegisterNUICallback( "toggleAntenna", function( data )
|
||||
-- Only run the codw if the radar has power and is not powering up
|
||||
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
|
||||
-- As the xmit/hold buttons are used to change settings in the menu, we check for that
|
||||
if ( RADAR:IsPowerOn() and RADAR:IsMenuOpen() ) then
|
||||
if ( RADAR:IsMenuOpen() ) then
|
||||
-- Change the menu option based on which button is pressed
|
||||
RADAR:ChangeMenuOption( data.value )
|
||||
|
||||
@@ -1392,12 +1397,13 @@ RegisterNUICallback( "toggleAntenna", function( data )
|
||||
SendNUIMessage( { _type = "audio", name = RADAR:IsAntennaTransmitting( data.value ) and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||
end )
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
-- Runs when the user presses the menu button on the remote control
|
||||
RegisterNUICallback( "menu", function()
|
||||
-- Only run the codw if the radar has power
|
||||
if ( RADAR:IsPowerOn() ) then
|
||||
-- Only run the codw if the radar has power and is not powering up
|
||||
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
|
||||
-- As the menu button is a multipurpose button, we first check to see if the menu is already open
|
||||
if ( RADAR:IsMenuOpen() ) then
|
||||
-- As the menu is already open, we then iterate to the next option in the settings list
|
||||
|
||||
Reference in New Issue
Block a user