forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simInit.lua
62 lines (49 loc) · 1.86 KB
/
simInit.lua
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
--===================================================================================
-- Do global init and set up common global functions
--===================================================================================
doscript '/lua/SimSync.lua'
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local baseSetupSession = SetupSession
function SetupSession()
ScenarioInfo.TriggerManager = import('/lua/TriggerManager.lua').Manager
TriggerManager = ScenarioInfo.TriggerManager
baseSetupSession()
end
local baseBeginSession = BeginSession
function BeginSession()
ScenarioUtils.CreateProps()
ScenarioUtils.CreateResources()
baseBeginSession()
import('/lua/sim/score.lua').init()
--start watching for victory conditions
ForkThread(import('/lua/victory.lua').CheckVictory, ScenarioInfo)
end
local basePostLoad = OnPostLoad
function OnPostLoad()
basePostLoad()
import('/lua/ScenarioFramework.lua').OnPostLoad()
import('/lua/SimObjectives.lua').OnPostLoad()
import('/lua/sim/SimUIState.lua').OnPostLoad()
import('/lua/SimPing.lua').OnArmyChange()
import('/lua/SimPingGroup.lua').OnPostLoad()
import('/lua/SimDialogue.lua').OnPostLoad()
import('/lua/SimSync.lua').OnPostLoad()
if GetFocusArmy() ~= -1 then
Sync.SetAlliedVictory = ArmyBrains[GetFocusArmy()].RequestingAlliedVictory or false
end
end
local baseOnCreateArmyBrain = OnCreateArmyBrain
function OnCreateArmyBrain(index, brain, name, nickname)
ScenarioUtils.InitializeStartLocation(name)
ScenarioUtils.SetPlans(name)
baseOnCreateArmyBrain(index,brain,name,nickname)
end
for k,file in DiskFindFiles('/lua/AI/PlatoonTemplates', '*.lua') do
import(file)
end
for k,file in DiskFindFiles('/lua/AI/AIBuilders', '*.lua') do
import(file)
end
for k,file in DiskFindFiles('/lua/AI/AIBaseTemplates', '*.lua') do
import(file)
end