Additional fix for locking speeds, more comments

This commit is contained in:
Dan
2019-12-10 21:21:39 +00:00
parent 7558675210
commit 1a2cd814e8

View File

@@ -834,7 +834,7 @@ end
-- necessary information from the antenna, and then lock it into the display
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
if ( self:IsPowerOn() and self:GetDisplayState() and not self:GetDisplayHidden() and self:IsAntennaTransmitting( ant ) ) then
-- Check if the antenna already has a speed locked, if it does then reset the lock, otherwise we lock
-- a speed
if ( self:IsAntennaSpeedLocked( ant ) ) then
@@ -1012,30 +1012,45 @@ function RADAR:GetVehSpeedFormatted( speed )
-- Get the speed unit from the settings
local unit = self:GetSettingValue( "speedType" )
--
-- Return the coverted speed rounded to a whole number
return UTIL:Round( speed * self.speedConversions[unit], 0 )
end
-- Gathers all of the vehicles in the local area of the player
function RADAR:GetAllVehicles()
-- Create a temporary table
local t = {}
-- Iterate through vehicles
for v in UTIL:EnumerateVehicles() do
-- Insert the vehicle id into the temporary table
table.insert( t, v )
end
-- Return the table
return t
end
-- Used to check if an antennas mode fits with a ray type from the ray trace system
function RADAR:CheckVehicleDataFitsMode( ant, rt )
-- Get the current mode value for the given antenna
local mode = self:GetAntennaMode( ant )
-- Check that the given ray type matches up with the antenna's current mode
if ( ( mode == 3 ) or ( mode == 1 and rt == "same" ) or ( mode == 2 and rt == "opp" ) ) then return true end
-- Otherwise, return false as a last resort
return false
end
-- This function is used to filter through the captured vehicles and work out what vehicles should be used for display
-- on the radar interface
function RADAR:GetVehiclesForAntenna()
-- Create the vehs table to store the split up captured vehicle data
local vehs = { ["front"] = {}, ["rear"] = {} }
-- Create the results table to store the vehicle results, the first index is for the 'strongest' vehicle and the
-- second index is for the 'fastest' vehicle
local results = { ["front"] = { nil, nil }, ["rear"] = { nil, nil } }
-- Loop through and split up the vehicles based on front and rear, this is simply because the actual system