mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
Updated sphere sizing wrappers, added new mode
This commit is contained in:
35
cl_radar.lua
35
cl_radar.lua
@@ -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
|
end
|
||||||
|
|
||||||
function RADAR:InsertDynamicRadiusData( key, radius, actualSize )
|
function RADAR:SetDynamicRadiusKey( key, t )
|
||||||
if ( self.vars.sphereSizes[key] == nil ) then
|
self.vars.sphereSizes[key] = t
|
||||||
self.vars.sphereSizes[key] = {}
|
end
|
||||||
|
|
||||||
self.vars.sphereSizes[key].radius = radius
|
function RADAR:InsertDynamicRadiusData( key, radius, actualSize )
|
||||||
self.vars.sphereSizes[key].actualSize = actualSize
|
if ( self:GetDynamicDataValue( key ) == nil ) then
|
||||||
|
local tbl = {}
|
||||||
|
|
||||||
|
tbl.radius = radius
|
||||||
|
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()
|
||||||
@@ -551,4 +554,4 @@ Citizen.CreateThread( function()
|
|||||||
|
|
||||||
Citizen.Wait( 0 )
|
Citizen.Wait( 0 )
|
||||||
end
|
end
|
||||||
end)
|
end )
|
||||||
Reference in New Issue
Block a user