mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16: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];
|
let obj = elements.antennas[ant][cat][item];
|
||||||
|
|
||||||
if ( state ) {
|
if ( state ) {
|
||||||
cat == "dirs" ? obj.addClass( "active_arrow" ) : obj.addClass( "active" );
|
obj.addClass( cat == "dirs" ? "active_arrow" : "active" );
|
||||||
} else {
|
} 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 )
|
function updateDisplays( ps, ants )
|
||||||
{
|
{
|
||||||
elements.patrolSpeed.html( ps );
|
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 )
|
function settingUpdate( ants )
|
||||||
{
|
{
|
||||||
for ( let ant in 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 )
|
function displayKeyLock( state )
|
||||||
{
|
{
|
||||||
elements.keyLock.stateLabel.html( state ? "enabled" : "disabled" );
|
elements.keyLock.stateLabel.html( state ? "enabled" : "disabled" );
|
||||||
@@ -387,8 +390,6 @@ function displayKeyLock( state )
|
|||||||
}, 2000 );
|
}, 2000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This function is used to send data back through to the LUA side
|
// This function is used to send data back through to the LUA side
|
||||||
function sendData( name, data ) {
|
function sendData( name, data ) {
|
||||||
$.post( "http://" + resourceName + "/" + name, JSON.stringify( data ), function( datab ) {
|
$.post( "http://" + resourceName + "/" + name, JSON.stringify( data ), function( datab ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user