-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathME5_setup_teams.lua
67 lines (61 loc) · 1.84 KB
/
ME5_setup_teams.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
62
63
64
65
66
67
function SetupTeams(sides)
-- HACKish: load the turret .odf here (this is the easiest place to put it where it will
-- be executed in every level
--ReadDataFile("SIDE\\tur.lvl", --disabled for now until we settle on where exactly the .odf will end up
-- "tur_bldg_defensegridturret")
-- list of types
local typeList = {
"LOKI",
"husk",
"soldier",
"assault",
"sniper",
"rocketeer",
"engineer",
"officer",
"special",
"pilot",
"marine",
"adept",
"sentinel",
"vanguard",
"heavy",
"operative",
"commando",
"YMIR",
"hunter",
"shock",
"destroyer",
"juggernaut",
"prime",
"support",
"scion",
"praetorian",
"pilot" }
-- items for each team code
local teamItems = nil
if ScriptCB_IsMissionSetupSaved() then
local missionSetup = ScriptCB_LoadMissionSetup()
teamItems = missionSetup.units
end
-- for each specified side...
for name, side in pairs(sides) do
local team = side.team
-- set team properties
local name = string.lower(name)
SetTeamName(team, name)
SetTeamIcon(team, name .. "_icon", "hud_reinforcement_icon", "flag_icon")
SetUnitCount(team, side.units)
SetReinforcementCount(team, side.reinforcements)
-- add unit classes in type order
for _, type in ipairs(typeList) do
if side[type] and (not teamItems or not teamItems[name] or teamItems[name][type]) then
AddUnitClass(team, side[type][1], side[type][2], side[type][3])
end
end
-- add hero class if available
if side[hero] then
AddHeroClass(side[hero])
end
end
end