mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
feat: add function to restore backed up data
This commit is contained in:
28
cl_radar.lua
28
cl_radar.lua
@@ -396,6 +396,34 @@ function RADAR:LoadDataFromDriver( data )
|
||||
end )
|
||||
end
|
||||
|
||||
-- Restores the local player's operator menu and antenna data
|
||||
function RADAR:RestoreFromBackup()
|
||||
-- Get the operator menu data
|
||||
local omData = self:GetBackupOMData()
|
||||
|
||||
-- Restore the operator menu data
|
||||
if ( omData ~= nil ) then
|
||||
self:SetOMTableData( omData )
|
||||
|
||||
-- Clear the backup
|
||||
self:SetBackupOMData( nil )
|
||||
end
|
||||
|
||||
-- Iterate through the antennas and restore their backups
|
||||
for _, ant in UTIL:Values( { "front", "rear" } ) do
|
||||
-- Get the antenna backup data
|
||||
local antData = self:GetBackupAntennaData( ant )
|
||||
|
||||
-- Restore the antenna data
|
||||
if ( antData ~= nil ) then
|
||||
self:SetAntennaTableData( ant, data[ant] )
|
||||
|
||||
-- Clear the backup
|
||||
self:SetBackupAntennaData( ant, nil )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Radar essentials functions
|
||||
|
||||
Reference in New Issue
Block a user