mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
Additional fix for locking speeds, more comments
This commit is contained in:
19
cl_radar.lua
19
cl_radar.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user