mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Fixed speeds being locked when they shouldn't be
This commit is contained in:
@@ -833,6 +833,8 @@ end
|
|||||||
-- When the user presses the speed lock key for either antenna, this function is called to get the
|
-- When the user presses the speed lock key for either antenna, this function is called to get the
|
||||||
-- necessary information from the antenna, and then lock it into the display
|
-- necessary information from the antenna, and then lock it into the display
|
||||||
function RADAR:LockAntennaSpeed( ant )
|
function RADAR:LockAntennaSpeed( ant )
|
||||||
|
-- Only lock a speed if the antenna is on and the UI is displayed
|
||||||
|
if ( self:IsPowerOn() and self:GetDisplayState() and not self:GetDisplayHidden() ) then
|
||||||
-- Check if the antenna already has a speed locked, if it does then reset the lock, otherwise we lock
|
-- Check if the antenna already has a speed locked, if it does then reset the lock, otherwise we lock
|
||||||
-- a speed
|
-- a speed
|
||||||
if ( self:IsAntennaSpeedLocked( ant ) ) then
|
if ( self:IsAntennaSpeedLocked( ant ) ) then
|
||||||
@@ -863,6 +865,7 @@ function RADAR:LockAntennaSpeed( ant )
|
|||||||
-- Send an NUI message to change the lock label, otherwise we'd have to wait until the next main loop
|
-- Send an NUI message to change the lock label, otherwise we'd have to wait until the next main loop
|
||||||
SendNUIMessage( { _type = "antennaLock", ant = ant, state = self:IsAntennaSpeedLocked( ant ) } )
|
SendNUIMessage( { _type = "antennaLock", ant = ant, state = self:IsAntennaSpeedLocked( ant ) } )
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Resets an antenna, used when the system is turned off
|
-- Resets an antenna, used when the system is turned off
|
||||||
function RADAR:ResetAntenna( ant )
|
function RADAR:ResetAntenna( ant )
|
||||||
@@ -1006,7 +1009,10 @@ end
|
|||||||
----------------------------------------------------------------------------------]]--
|
----------------------------------------------------------------------------------]]--
|
||||||
-- Takes a GTA speed and converts it into the type defined by the user in the operator menu
|
-- Takes a GTA speed and converts it into the type defined by the user in the operator menu
|
||||||
function RADAR:GetVehSpeedFormatted( speed )
|
function RADAR:GetVehSpeedFormatted( speed )
|
||||||
|
-- Get the speed unit from the settings
|
||||||
local unit = self:GetSettingValue( "speedType" )
|
local unit = self:GetSettingValue( "speedType" )
|
||||||
|
|
||||||
|
--
|
||||||
return UTIL:Round( speed * self.speedConversions[unit], 0 )
|
return UTIL:Round( speed * self.speedConversions[unit], 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user