mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Cleaned up JS setLight, organisation
This commit is contained in:
37
nui/radar.js
37
nui/radar.js
@@ -176,9 +176,9 @@ function setLight( ant, cat, item, state )
|
||||
let obj = elements.antennas[ant][cat][item];
|
||||
|
||||
if ( state ) {
|
||||
cat == "dirs" ? obj.addClass( "active_arrow" ) : obj.addClass( "active" );
|
||||
obj.addClass( cat == "dirs" ? "active_arrow" : "active" );
|
||||
} else {
|
||||
cat == "dirs" ? obj.removeClass( "active_arrow" ) : obj.removeClass( "active" );
|
||||
obj.removeClass( cat == "dirs" ? "active_arrow" : "active" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,10 +334,9 @@ function playLockAudio( ant, dir, vol )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Radar updating
|
||||
------------------------------------------------------------------------------------*/
|
||||
function updateDisplays( ps, ants )
|
||||
{
|
||||
elements.patrolSpeed.html( ps );
|
||||
@@ -355,16 +354,6 @@ function updateDisplays( ps, ants )
|
||||
}
|
||||
}
|
||||
|
||||
function menu( optionText, option )
|
||||
{
|
||||
clearEverything();
|
||||
|
||||
elements.antennas.front.targetSpeed.html( optionText[0] );
|
||||
elements.antennas.front.fastSpeed.html( optionText[1] );
|
||||
|
||||
elements.patrolSpeed.html( option );
|
||||
}
|
||||
|
||||
function settingUpdate( ants )
|
||||
{
|
||||
for ( let ant in ants )
|
||||
@@ -376,6 +365,20 @@ function settingUpdate( ants )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Misc
|
||||
------------------------------------------------------------------------------------*/
|
||||
function menu( optionText, option )
|
||||
{
|
||||
clearEverything();
|
||||
|
||||
elements.antennas.front.targetSpeed.html( optionText[0] );
|
||||
elements.antennas.front.fastSpeed.html( optionText[1] );
|
||||
|
||||
elements.patrolSpeed.html( option );
|
||||
}
|
||||
|
||||
function displayKeyLock( state )
|
||||
{
|
||||
elements.keyLock.stateLabel.html( state ? "enabled" : "disabled" );
|
||||
@@ -387,8 +390,6 @@ function displayKeyLock( state )
|
||||
}, 2000 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This function is used to send data back through to the LUA side
|
||||
function sendData( name, data ) {
|
||||
$.post( "http://" + resourceName + "/" + name, JSON.stringify( data ), function( datab ) {
|
||||
|
||||
Reference in New Issue
Block a user