mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
All speed zones displayed, 'HLd' shown when in hold
This commit is contained in:
33
cl_radar.lua
33
cl_radar.lua
@@ -665,16 +665,12 @@ end )
|
|||||||
|
|
||||||
RegisterNUICallback( "setAntennaMode", function( data )
|
RegisterNUICallback( "setAntennaMode", function( data )
|
||||||
RADAR:SetAntennaMode( data.value, tonumber( data.mode ) )
|
RADAR:SetAntennaMode( data.value, tonumber( data.mode ) )
|
||||||
|
|
||||||
print( "Set antenna: " .. data.value .. " to mode " .. tostring( data.mode ) )
|
|
||||||
end )
|
end )
|
||||||
|
|
||||||
RegisterNUICallback( "toggleAntenna", function( data )
|
RegisterNUICallback( "toggleAntenna", function( data )
|
||||||
RADAR:ToggleAntenna( data.value )
|
RADAR:ToggleAntenna( data.value )
|
||||||
|
|
||||||
SendNUIMessage( { _type = "antennaXmit", ant = data.value, on = RADAR:IsAntennaTransmitting( data.value ) } )
|
SendNUIMessage( { _type = "antennaXmit", ant = data.value, on = RADAR:IsAntennaTransmitting( data.value ) } )
|
||||||
|
|
||||||
print( "Toggled " .. data.value .. " antenna" )
|
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
|
||||||
@@ -715,15 +711,36 @@ function RADAR:Main()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Work out what has to be sent
|
-- Work out what has to be sent
|
||||||
|
-- need to find a way to automate this in a loop
|
||||||
local av = self:GetActiveVehicles()
|
local av = self:GetActiveVehicles()
|
||||||
local test = { ["front"] = {}, ["rear"] = {} }
|
local test = { ["front"] = {}, ["rear"] = {} }
|
||||||
|
|
||||||
if ( av["front"][1] ~= nil ) then
|
if ( self:IsAntennaTransmitting( "front" ) ) then
|
||||||
test["front"].speed = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["front"][1].speed ) )
|
if ( av["front"][1] ~= nil ) then
|
||||||
|
test["front"].speed = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["front"][1].speed ) )
|
||||||
|
else
|
||||||
|
test["front"].speed = "¦¦¦"
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( av["front"][2] ~= nil ) then
|
||||||
|
test["front"].fast = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["front"][2].speed ) )
|
||||||
|
else
|
||||||
|
test["front"].fast = "¦¦¦"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( av["front"][2] ~= nil ) then
|
if ( self:IsAntennaTransmitting( "rear" ) ) then
|
||||||
test["front"].fast = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["front"][2].speed ) )
|
if ( av["rear"][1] ~= nil ) then
|
||||||
|
test["rear"].speed = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["rear"][1].speed ) )
|
||||||
|
else
|
||||||
|
test["rear"].speed = "¦¦¦"
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( av["rear"][2] ~= nil ) then
|
||||||
|
test["rear"].fast = UTIL:FormatSpeed( self:GetVehSpeedFormatted( av["rear"][2].speed ) )
|
||||||
|
else
|
||||||
|
test["rear"].fast = "¦¦¦"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send the update to the NUI side
|
-- Send the update to the NUI side
|
||||||
|
|||||||
10
nui/radar.js
10
nui/radar.js
@@ -128,6 +128,8 @@ function setAntennaXmit( ant, state )
|
|||||||
if ( !state ) {
|
if ( !state ) {
|
||||||
elements.antennas[ant].targetSpeed.html( "¦¦¦" );
|
elements.antennas[ant].targetSpeed.html( "¦¦¦" );
|
||||||
elements.antennas[ant].fast.speed.html( "HLd" );
|
elements.antennas[ant].fast.speed.html( "HLd" );
|
||||||
|
} else {
|
||||||
|
elements.antennas[ant].fast.speed.html( "¦¦¦" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +144,14 @@ function updateDisplays( ps, ants )
|
|||||||
if ( ants["front"].fast != null ) {
|
if ( ants["front"].fast != null ) {
|
||||||
elements.antennas["front"].fast.speed.html( ants["front"].fast );
|
elements.antennas["front"].fast.speed.html( ants["front"].fast );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ants["rear"].speed != null ) {
|
||||||
|
elements.antennas["rear"].targetSpeed.html( ants["rear"].speed );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ants["rear"].fast != null ) {
|
||||||
|
elements.antennas["rear"].fast.speed.html( ants["rear"].fast );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user