-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
desert-shellmap.lua
206 lines (177 loc) · 6.58 KB
/
desert-shellmap.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
--[[
Copyright (c) The OpenRA Developers and Contributors
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version. For more
information, see COPYING.
]]
if DateTime.IsHalloween then
UnitTypes = { "ant", "ant", "ant" }
BeachUnitTypes = { "ant", "ant" }
ProxyType = "powerproxy.parazombies"
ProducedUnitTypes =
{
{ factory = AlliedBarracks1, types = { "e1", "e3" } },
{ factory = AlliedBarracks2, types = { "e1", "e3" } },
{ factory = SovietBarracks1, types = { "ant" } },
{ factory = SovietBarracks2, types = { "ant" } },
{ factory = SovietBarracks3, types = { "ant" } },
{ factory = AlliedWarFactory1, types = { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ factory = SovietWarFactory1, types = { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
}
else
UnitTypes = { "3tnk", "ftrk", "ttnk", "apc" }
BeachUnitTypes = { "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4" }
ProxyType = "powerproxy.paratroopers"
ProducedUnitTypes =
{
{ factory = AlliedBarracks1, types = { "e1", "e3" } },
{ factory = AlliedBarracks2, types = { "e1", "e3" } },
{ factory = SovietBarracks1, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = SovietBarracks2, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = SovietBarracks3, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = AlliedWarFactory1, types = { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ factory = SovietWarFactory1, types = { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
}
end
ShipUnitTypes = { "1tnk", "1tnk", "jeep", "2tnk", "2tnk" }
HelicopterUnitTypes = { "e1", "e1", "e1", "e1", "e3", "e3" };
ParadropWaypoints = { Paradrop1, Paradrop2, Paradrop3, Paradrop4, Paradrop5, Paradrop6, Paradrop7, Paradrop8 }
Mig1Waypoints = { Mig11, Mig12, Mig13, Mig14 }
Mig2Waypoints = { Mig21, Mig22, Mig23, Mig24 }
BindActorTriggers = function(a)
if a.HasProperty("Hunt") then
if a.Owner == Allies then
Trigger.OnIdle(a, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
else
Trigger.OnIdle(a, function(a)
if a.IsInWorld then
a.AttackMove(AlliedTechnologyCenter.Location)
end
end)
end
end
if a.HasProperty("HasPassengers") then
Trigger.OnPassengerExited(a, function(t, p)
BindActorTriggers(p)
end)
Trigger.OnDamaged(a, function()
if a.HasPassengers then
a.Stop()
a.UnloadPassengers()
end
end)
end
end
SendSovietUnits = function(entryCell, unitTypes, interval)
local units = Reinforcements.Reinforce(Soviets, unitTypes, { entryCell }, interval)
Utils.Do(units, function(unit)
BindActorTriggers(unit)
end)
Trigger.OnAllKilled(units, function() SendSovietUnits(entryCell, unitTypes, interval) end)
end
SendMigs = function(waypoints)
local migEntryPath = { waypoints[1].Location, waypoints[2].Location }
local migs = Reinforcements.Reinforce(Soviets, { "mig" }, migEntryPath, 4)
Utils.Do(migs, function(mig)
mig.Move(waypoints[3].Location)
mig.Move(waypoints[4].Location)
mig.Destroy()
end)
Trigger.AfterDelay(DateTime.Seconds(40), function() SendMigs(waypoints) end)
end
ShipAlliedUnits = function()
local units = Reinforcements.ReinforceWithTransport(Allies, "lst",
ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2]
Utils.Do(units, function(unit)
BindActorTriggers(unit)
end)
Trigger.AfterDelay(DateTime.Seconds(60), ShipAlliedUnits)
end
--- @param hpad actor
InsertAlliedChinookReinforcements = function(entry, hpad)
local units = Reinforcements.ReinforceWithTransport(Allies, "tran",
HelicopterUnitTypes, { entry.Location, hpad.Location + CVec.New(1, 2) }, { entry.Location })[2]
Utils.Do(units, function(unit)
BindActorTriggers(unit)
end)
Trigger.AfterDelay(DateTime.Seconds(60), function() InsertAlliedChinookReinforcements(entry, hpad) end)
end
ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints)
local aircraft = PowerProxy.TargetParatroopers(lz.CenterPosition)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
BindActorTriggers(p)
end)
end)
Trigger.AfterDelay(DateTime.Seconds(35), ParadropSovietUnits)
end
ProduceUnits = function(t)
local factory = t.factory
if not factory.IsDead then
local unitType = t.types[Utils.RandomInteger(1, #t.types + 1)]
factory.Wait(Actor.BuildTime(unitType))
factory.Produce(unitType)
factory.CallFunc(function() ProduceUnits(t) end)
end
end
SetupAlliedUnits = function()
Utils.Do(Map.NamedActors, function(a)
if a.Owner == Allies and a.HasProperty("AcceptsCondition") and a.AcceptsCondition("unkillable") then
a.GrantCondition("unkillable")
a.Stance = "Defend"
end
end)
end
SetupFactories = function()
Utils.Do(ProducedUnitTypes, function(production)
Trigger.OnProduction(production.factory, function(_, a) BindActorTriggers(a) end)
end)
end
ChronoshiftAlliedUnits = function()
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
local units = { }
for i = 1, #cells do
local unit = Actor.Create("2tnk", true, { Owner = Allies, Facing = Angle.North })
BindActorTriggers(unit)
units[unit] = cells[i]
end
Chronosphere.Chronoshift(units)
Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits)
end
Ticks = 0
Speed = 5
Tick = function()
Ticks = Ticks + 1
local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed;
Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0)
end
WorldLoaded = function()
Allies = Player.GetPlayer("Allies")
Soviets = Player.GetPlayer("Soviets")
ViewportOrigin = Camera.Position
SetupAlliedUnits()
SetupFactories()
ShipAlliedUnits()
InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1)
InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2)
PowerProxy = Actor.Create(ProxyType, false, { Owner = Soviets })
ParadropSovietUnits()
Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits)
Utils.Do(ProducedUnitTypes, ProduceUnits)
Trigger.AfterDelay(DateTime.Seconds(30), function() SendMigs(Mig1Waypoints) end)
Trigger.AfterDelay(DateTime.Seconds(30), function() SendMigs(Mig2Waypoints) end)
SendSovietUnits(Entry1.Location, UnitTypes, 50)
SendSovietUnits(Entry2.Location, UnitTypes, 50)
SendSovietUnits(Entry3.Location, UnitTypes, 50)
SendSovietUnits(Entry4.Location, UnitTypes, 50)
SendSovietUnits(Entry5.Location, UnitTypes, 50)
SendSovietUnits(Entry6.Location, UnitTypes, 50)
SendSovietUnits(Entry7.Location, BeachUnitTypes, 15)
end