mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
feat: add ability to backup local radar data
Add RADAR:BackupData(), this is only used when the local player becomes the front seat passenger in another vehicle.
This commit is contained in:
18
cl_radar.lua
18
cl_radar.lua
@@ -347,6 +347,24 @@ function RADAR:SetBackupAntennaData( ant, data )
|
||||
self.backupData.antennas[ant] = data
|
||||
end
|
||||
|
||||
-- Used when the player becomes a passenger in another vehicle. The local data is backed up to make way for the data
|
||||
-- provided by the driver. When the player becomes the driver again, the local data is restored.
|
||||
function RADAR:BackupData()
|
||||
local data = self:GetRadarDataForSync()
|
||||
|
||||
-- Backup operator menu data
|
||||
if ( self:GetBackupOMData() == nil ) then
|
||||
self:SetBackupOMData( data.om )
|
||||
end
|
||||
|
||||
-- Backup front and rear antenna data
|
||||
for _, ant in UTIL:Values( { "front", "rear" } ) do
|
||||
if ( self:GetBackupAntennaData( ant ) == nil ) then
|
||||
self:SetBackupAntennaData( ant, data[ant] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Radar essentials functions
|
||||
|
||||
Reference in New Issue
Block a user