Updated sphere sizing wrappers, added new mode

This commit is contained in:
Dan
2019-11-07 20:16:49 +00:00
parent 4241e12cce
commit 758940dc41

View File

@@ -83,7 +83,8 @@ RADAR.rayTraces = {
RADAR.sorting = { RADAR.sorting = {
[1] = { name = "CLOSEST", func = function( a, b ) return a.dist < b.dist end }, [1] = { name = "CLOSEST", func = function( a, b ) return a.dist < b.dist end },
[2] = { name = "FASTEST", func = function( a, b ) return a.speed > b.speed end }, [2] = { name = "FASTEST", func = function( a, b ) return a.speed > b.speed end },
[3] = { name = "LARGEST", func = function( a, b ) return a.size > b.size end } [3] = { name = "LARGEST", func = function( a, b ) return a.size > b.size end },
[4] = { name = "LARGEST & FASTEST", func = function( a, b ) return a.size > b.size and a.speed > b.speed end }
} }
--[[------------------------------------------------------------------------ --[[------------------------------------------------------------------------
@@ -210,16 +211,26 @@ function RADAR:GetAllVehicles()
return t return t
end end
function RADAR:GetDynamicDataValue( key )
return self.vars.sphereSizes[key]
end
function RADAR:DoesDynamicRadiusDataExist( key ) function RADAR:DoesDynamicRadiusDataExist( key )
return self.vars.sphereSizes[key] ~= nil return self:GetDynamicDataValue( key ) ~= nil
end
function RADAR:SetDynamicRadiusKey( key, t )
self.vars.sphereSizes[key] = t
end end
function RADAR:InsertDynamicRadiusData( key, radius, actualSize ) function RADAR:InsertDynamicRadiusData( key, radius, actualSize )
if ( self.vars.sphereSizes[key] == nil ) then if ( self:GetDynamicDataValue( key ) == nil ) then
self.vars.sphereSizes[key] = {} local tbl = {}
self.vars.sphereSizes[key].radius = radius tbl.radius = radius
self.vars.sphereSizes[key].actualSize = actualSize tbl.actualSize = actualSize
self:SetDynamicRadiusKey( key, tbl )
end end
end end
@@ -417,8 +428,6 @@ function RADAR:Main()
self:ResetRadarStage() self:ResetRadarStage()
self:ResetRayTraceState() self:ResetRayTraceState()
end end
--Wait( 1000 )
end end
end end
@@ -513,12 +522,6 @@ Citizen.CreateThread( function()
end end
end ) end )
-- Citizen.SetTimeout( 3000, function()
-- local vehs = RADAR:GetAllVehicles()
-- RADAR:SetVehiclePool( vehs )
-- end)
-- Main thread -- Main thread
Citizen.CreateThread( function() Citizen.CreateThread( function()
RADAR:CacheNumOfRays() RADAR:CacheNumOfRays()