mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
Added sort mode wrappers
This commit is contained in:
15
cl_radar.lua
15
cl_radar.lua
@@ -145,6 +145,14 @@ function RADAR:CacheNumOfRays()
|
|||||||
self.vars.numberOfRays = #self.rayTraces
|
self.vars.numberOfRays = #self.rayTraces
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function RADAR:GetSortModeText()
|
||||||
|
return self.sorting[self.vars.sortMode].name
|
||||||
|
end
|
||||||
|
|
||||||
|
function RADAR:GetSortModeFunc()
|
||||||
|
return self.sorting[self.vars.sortMode].func
|
||||||
|
end
|
||||||
|
|
||||||
function RADAR:ToggleSortMode()
|
function RADAR:ToggleSortMode()
|
||||||
if ( self.vars.sortMode < #self.sorting ) then
|
if ( self.vars.sortMode < #self.sorting ) then
|
||||||
self.vars.sortMode = self.vars.sortMode + 1
|
self.vars.sortMode = self.vars.sortMode + 1
|
||||||
@@ -152,7 +160,7 @@ function RADAR:ToggleSortMode()
|
|||||||
self.vars.sortMode = 1
|
self.vars.sortMode = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
UTIL:Notify( "Radar mode set to " .. self.sorting[self.vars.sortMode].name )
|
UTIL:Notify( "Radar mode set to " .. self:GetSortModeText() )
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[------------------------------------------------------------------------
|
--[[------------------------------------------------------------------------
|
||||||
@@ -394,10 +402,9 @@ function RADAR:Main()
|
|||||||
local caughtVehs = self:GetCapturedVehicles()
|
local caughtVehs = self:GetCapturedVehicles()
|
||||||
|
|
||||||
if ( not UTIL:IsTableEmpty( caughtVehs ) ) then
|
if ( not UTIL:IsTableEmpty( caughtVehs ) ) then
|
||||||
-- table.sort( caughtVehs, RADAR.sorting.fastest )
|
table.sort( caughtVehs, self:GetSortModeFunc() )
|
||||||
table.sort( caughtVehs, self.sorting[self.vars.sortMode].func )
|
|
||||||
|
|
||||||
print( "Printing table for sort mode " .. self.sorting[self.vars.sortMode].name )
|
print( "Printing table for sort mode " .. self:GetSortModeText() )
|
||||||
for k, v in pairs( caughtVehs ) do
|
for k, v in pairs( caughtVehs ) do
|
||||||
print( tostring( k ) .. " - " .. tostring( v.veh ) .. " - " .. tostring( v.relPos ) .. " - " .. tostring( v.dist ) .. " - " .. tostring( v.speed ) .. " - " .. tostring( v.size ) )
|
print( tostring( k ) .. " - " .. tostring( v.veh ) .. " - " .. tostring( v.relPos ) .. " - " .. tostring( v.dist ) .. " - " .. tostring( v.speed ) .. " - " .. tostring( v.size ) )
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user