feat: add function to restore backed up data

This commit is contained in:
Dan
2021-03-11 16:20:02 +00:00
parent 20a369a170
commit c5bf28ca33

View File

@@ -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