forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserSync.lua
More file actions
61 lines (48 loc) · 1.67 KB
/
Copy pathUserSync.lua
File metadata and controls
61 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# The global sync table is copied from the sim layer every time the main and sim threads are
# synchronized on the sim beat (which is like a tick but happens even when the game is paused)
Sync = {}
# The PreviousSync table holds just what you'd expect it to, the sync table from the previous
# beat.
PreviousSync = {}
# Unit specific data that's been sync'd. Data changes are accumulated by merging
# the Sync.UnitData table into this table each sync (if there's new data)
UnitData = {}
# Here's an opportunity for user side script to examine the Sync table for the new tick
function OnSync()
if Sync.RequestingExit then
#LOG("Got it")
ExitGame()
end
#Play Sounds
for k, v in Sync.Sounds do
PlaySound(Sound{ Bank=v.Bank, Cue=v.Cue })
end
if Sync.ToggleGamePanels then
ConExecute('UI_ToggleGamePanels')
end
if Sync.ToggleLifeBarsOff then
ConExecute('UI_RenderUnitBars false')
end
if Sync.ToggleLifeBarsOn then
ConExecute('UI_RenderUnitBars true')
end
if not table.empty(Sync.AIChat) then
for k, v in Sync.AIChat do
import('/lua/AIChatSorian.lua').AIChat(v.group, v.text, v.sender)
end
end
if Sync.UserConRequests then
for num, execRequest in Sync.UserConRequests do
ConExecute(execRequest)
end
end
if not table.empty(Sync.UnitData) then
UnitData = table.merged(UnitData,Sync.UnitData)
end
for id,v in Sync.ReleaseIds do
UnitData[id] = nil
end
if Sync.NukeLaunchData then
import('/modules/nukelaunchping.lua').DoNukePing(Sync.NukeLaunchData)
end
end