Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 10e5092

Browse files
committed
More bunker breach fixes for loadout junk
1 parent 57b6ecf commit 10e5092

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ function BunkerBreach:SetupDefenderBrains()
7979
if SceneMan.Scene:HasArea("Brain") then
8080
for actor in MovableMan.AddedActors do
8181
if actor:IsInGroup("Brains") then
82-
print(actor)
8382
actor.ToDelete = true;
8483
end
8584
end
@@ -142,41 +141,52 @@ function BunkerBreach:SetupDefenderActors()
142141
local techID = PresetMan:GetModuleID(self:GetTeamTech(self.defenderTeam));
143142
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);
144143

144+
local loadoutNames = {"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"};
145+
145146
local hasSpawnAreas = false;
146-
for _, loadoutName in pairs({"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"}) do
147+
for _, loadoutName in pairs(loadoutNames) do
147148
if SceneMan.Scene:HasArea(loadoutName .. " Defenders") then
148149
hasSpawnAreas = true;
149-
local defenderArea = SceneMan.Scene:GetOptionalArea(loadoutName .. " Defenders");
150-
if defenderArea ~= nil then
151-
for defenderBox in defenderArea.Boxes do
152-
local guard;
153-
if loadoutName == "Mecha" or loadoutName == "Turret" then
154-
guard = crabToHumanSpawnRatio > 0 and self:CreateCrab(techID, loadoutName == "Turret") or self:CreateInfantry(techID, "Heavy");
155-
else
156-
guard = self:CreateInfantry(techID, loadoutName);
157-
end
158-
if guard then
159-
guard.Pos = defenderBox.Center;
160-
guard.Team = self.defenderTeam;
161-
guard.AIMode = Actor.AIMODE_SENTRY;
162-
if loadoutName == "Engineer" then
163-
guard.AIMode = Actor.AIMODE_GOLDDIG;
164-
end
165-
MovableMan:AddActor(guard);
166-
end
167-
end
168-
end
169150
end
170151
end
152+
171153
for actor in MovableMan.AddedActors do
172-
if actor.Team ~= self.defenderTeam and not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems - Automovers") then
154+
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems - Automovers") then
173155
if hasSpawnAreas then
174156
actor.ToDelete = true;
175-
else
157+
elseif actor.Team ~= self.defenderTeam then
176158
MovableMan:ChangeActorTeam(actor, self.defenderTeam);
177159
end
178160
end
179161
end
162+
163+
if hasSpawnAreas then
164+
for _, loadoutName in pairs({"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"}) do
165+
if SceneMan.Scene:HasArea(loadoutName .. " Defenders") then
166+
hasSpawnAreas = true;
167+
local defenderArea = SceneMan.Scene:GetOptionalArea(loadoutName .. " Defenders");
168+
if defenderArea ~= nil then
169+
for defenderBox in defenderArea.Boxes do
170+
local guard;
171+
if loadoutName == "Mecha" or loadoutName == "Turret" then
172+
guard = crabToHumanSpawnRatio > 0 and self:CreateCrab(techID, loadoutName == "Turret") or self:CreateInfantry(techID, "Heavy");
173+
else
174+
guard = self:CreateInfantry(techID, loadoutName);
175+
end
176+
if guard then
177+
guard.Pos = defenderBox.Center;
178+
guard.Team = self.defenderTeam;
179+
guard.AIMode = Actor.AIMODE_SENTRY;
180+
if loadoutName == "Engineer" then
181+
guard.AIMode = Actor.AIMODE_GOLDDIG;
182+
end
183+
MovableMan:AddActor(guard);
184+
end
185+
end
186+
end
187+
end
188+
end
189+
end
180190
end
181191

182192
function BunkerBreach:SetupFogOfWar()

0 commit comments

Comments
 (0)