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

Commit fb74b48

Browse files
committed
Merge branch 'pre5-patch'
2 parents e1e4d69 + 1ebd735 commit fb74b48

File tree

130 files changed

+4872
-3319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4872
-3319
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Mods/
5959
Userdata/
6060

6161
allegro.log
62-
AbortScreen.bmp
62+
AbortScreen.*
6363
AbortLog.txt
6464
MemCleanupInfo.txt
6565
LogPublish.txt

Data/Base.rte/AI/CrabBehaviors.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ function CrabBehaviors.ShootArea(AI, Owner, Abort)
609609

610610
-- check if we can fire at the AimPoint
611611
local Trace = SceneMan:ShortestDistance(Owner.EyePos, AimPoint, false);
612-
local rayLenght = SceneMan:CastObstacleRay(Owner.EyePos, Trace, Vector(), Vector(), rte.NoMOID, Owner.IgnoresWhichTeam, rte.grassID, 11);
613-
if Trace.Magnitude * 0.67 < rayLenght then
612+
local rayLength = SceneMan:CastObstacleRay(Owner.EyePos, Trace, Vector(), Vector(), rte.NoMOID, Owner.IgnoresWhichTeam, rte.grassID, 11);
613+
if Trace:MagnitudeIsLessThan(rayLength * 1.5) then
614614
break; -- the AimPoint is close enough to the target, start shooting
615615
end
616616

Data/Base.rte/AI/HumanBehaviors.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,10 @@ end
235235

236236
function HumanBehaviors.GetGrenadeAngle(AimPoint, TargetVel, StartPos, muzVel)
237237
local Dist = SceneMan:ShortestDistance(StartPos, AimPoint, false);
238-
local range = Dist.Magnitude;
239238

240239
-- compensate for gravity if the point we are trying to hit is more than 2m away
241-
if range > 40 then
242-
local timeToTarget = range / muzVel;
240+
if Dist:MagnitudeIsGreaterThan(40) then
241+
local timeToTarget = Dist.Magnitude / muzVel;
243242

244243
-- lead the target if target speed and projectile TTT is above the threshold
245244
if (timeToTarget * TargetVel.Magnitude) > 0.5 then
@@ -1452,8 +1451,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
14521451
local RandomWpt = WptList[test];
14531452
if RandomWpt then
14541453
Dist = SceneMan:ShortestDistance(Owner.Pos, RandomWpt.Pos, false);
1455-
local mag = Dist.Magnitude;
1456-
if mag < 50 and mag < SceneMan:ShortestDistance(Owner.Pos, Waypoint.Pos, false).Magnitude/3 then
1454+
if Dist:MagnitudeIsLessThan(50) and Dist:MagnitudeIsLessThan(SceneMan:ShortestDistance(Owner.Pos, Waypoint.Pos, false).Magnitude * 0.33) then
14571455
-- this waypoint is closer, check LOS
14581456
if -1 == SceneMan:CastObstacleRay(Owner.Pos, Dist, Vector(), Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 4) then
14591457
Waypoint = RandomWpt; -- go here instead
@@ -2993,8 +2991,8 @@ function HumanBehaviors.ShootArea(AI, Owner, Abort)
29932991

29942992
-- check if we can fire at the AimPoint
29952993
local Trace = SceneMan:ShortestDistance(Owner.EyePos, AimPoint, false);
2996-
local rayLenght = SceneMan:CastObstacleRay(Owner.EyePos, Trace, Vector(), Vector(), rte.NoMOID, Owner.IgnoresWhichTeam, rte.grassID, 11);
2997-
if Trace.Magnitude * 0.67 < rayLenght then
2994+
local rayLength = SceneMan:CastObstacleRay(Owner.EyePos, Trace, Vector(), Vector(), rte.NoMOID, Owner.IgnoresWhichTeam, rte.grassID, 11);
2995+
if Trace:MagnitudeIsLessThan(rayLength * 1.5) then
29982996
break; -- the AimPoint is close enough to the target, start shooting
29992997
end
30002998

Data/Base.rte/AI/NativeDropShipAI.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ function NativeDropShipAI:Update(Owner)
165165
self.Waypoint.Y = -500; -- Go to orbit
166166
end
167167
else
168-
local dist = SceneMan:ShortestDistance(Owner.Pos, self.Waypoint, false).Magnitude;
169-
if dist < Owner.Radius and math.abs(change) < 3 and math.abs(Owner.Vel.X) < 4 then -- If we passed the hover check, check if we can start unloading
168+
local dist = SceneMan:ShortestDistance(Owner.Pos, self.Waypoint, false);
169+
if dist:MagnitudeIsLessThan(Owner.Radius) and math.abs(change) < 3 and math.abs(Owner.Vel.X) < 4 then -- If we passed the hover check, check if we can start unloading
170170
local WptL = SceneMan:MovePointToGround(Owner.Pos+Vector(-Owner.Radius, -Owner.Radius), self.hoverAlt, 12);
171171
local WptC = SceneMan:MovePointToGround(Owner.Pos+Vector(0, -Owner.Radius), self.hoverAlt, 12);
172172
local WptR = SceneMan:MovePointToGround(Owner.Pos+Vector(Owner.Radius, -Owner.Radius), self.hoverAlt, 12);
173173
self.Waypoint = Vector(Owner.Pos.X, math.min(WptL.Y, WptC.Y, WptR.Y));
174174

175-
dist = SceneMan:ShortestDistance(Owner.Pos, self.Waypoint, false).Magnitude;
176-
if dist < Owner.Diameter then
175+
dist = SceneMan:ShortestDistance(Owner.Pos, self.Waypoint, false);
176+
if dist:MagnitudeIsLessThan(Owner.Diameter) then
177177
-- We are close enough to our waypoint
178178
if Owner.AIMode == Actor.AIMODE_STAY then
179179
self.DeliveryState = ACraft.STANDBY;

Data/Base.rte/AI/RocketAI.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ function UpdateAI(self)
140140
self.LZpos = SceneMan:MovePointToGround(self.Pos, self.groundDist, 6);
141141
end
142142

143-
if self.AIMode ~= Actor.AIMODE_STAY then
144-
local dist = SceneMan:ShortestDistance(self.Pos, self.LZpos, false).Magnitude;
145-
if dist < 25 then -- If we passed the check, start unloading
146-
self.DeliveryState = ACraft.UNLOAD;
147-
end
143+
if self.AIMode ~= Actor.AIMODE_STAY and SceneMan:ShortestDistance(self.Pos, self.LZpos, false):MagnitudeIsLessThan(25) then
144+
self.DeliveryState = ACraft.UNLOAD;
148145
end
149146
end
150147
elseif self.DeliveryState == ACraft.UNLOAD then

Data/Base.rte/Activities.ini

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ AddActivity = GAScripted
4747
Description = Build a bunker and defend it against increasingly longer waves of AI-controlled enemies, with time to repair in between! Adjust the Difficulty to change wave difficulty.
4848
SceneName = Ketanot Hills
4949
ScriptPath = Base.rte/Activities/WaveDefense.lua
50-
TeamOfPlayer1 = 0
51-
TeamOfPlayer2 = 0
52-
TeamOfPlayer3 = 0
53-
TeamOfPlayer4 = 0
54-
CPUTeam = 1
50+
TeamOfPlayer1 = 1
51+
TeamOfPlayer2 = 1
52+
TeamOfPlayer3 = 1
53+
TeamOfPlayer4 = 1
54+
CPUTeam = 0
5555
MinTeamsRequired = 2
5656
DefaultGoldCakeDifficulty = 6000
5757
DefaultGoldEasyDifficulty = 5000
@@ -60,9 +60,11 @@ AddActivity = GAScripted
6060
DefaultGoldNutsDifficulty = 2000
6161
DefaultGoldMaxDifficulty = 1000
6262
LuaClassName = WaveDefense
63+
Team1Name = Attackers
64+
Team2Name = Defenders
6365
DefaultRequireClearPathToOrbit = 1
6466
DeployUnitsSwitchEnabled = 1
65-
DefaultDeployUnits = 0
67+
DefaultDeployUnits = 1
6668
6769
6870
AddActivity = GAScripted
@@ -208,6 +210,7 @@ AddActivity = GAScripted
208210
DeployUnitsSwitchEnabled = 1
209211
ScriptPath = Base.rte/Activities/Test.lua
210212
LuaClassName = Test
213+
DefaultDeployUnits = 0
211214
212215
213216
/*

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ function BunkerBreach:SetupDefenderBrains()
7777

7878
-- Add defender brains, either using the Brain area or picking randomly from those created by deployments.
7979
if SceneMan.Scene:HasArea("Brain") then
80-
for actor in MovableMan.Actors do
81-
if actor.Team == self.defenderTeam and actor:IsInGroup("Brains") then
80+
for actor in MovableMan.AddedActors do
81+
if actor:IsInGroup("Brains") then
8282
actor.ToDelete = true;
8383
end
8484
end
@@ -141,35 +141,52 @@ function BunkerBreach:SetupDefenderActors()
141141
local techID = PresetMan:GetModuleID(self:GetTeamTech(self.defenderTeam));
142142
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);
143143

144-
for _, loadoutName in pairs({"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"}) do
144+
local loadoutNames = {"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"};
145+
146+
local hasSpawnAreas = false;
147+
for _, loadoutName in pairs(loadoutNames) do
145148
if SceneMan.Scene:HasArea(loadoutName .. " Defenders") then
146-
local defenderArea = SceneMan.Scene:GetOptionalArea(loadoutName .. " Defenders");
147-
if defenderArea ~= nil then
148-
for defenderBox in defenderArea.Boxes do
149-
local guard;
150-
if loadoutName == "Mecha" or loadoutName == "Turret" then
151-
guard = crabToHumanSpawnRatio > 0 and self:CreateCrab(techID, loadoutName == "Turret") or self:CreateInfantry(techID, "Heavy");
152-
else
153-
guard = self:CreateInfantry(techID, loadoutName);
154-
end
155-
if guard then
156-
guard.Pos = defenderBox.Center;
157-
guard.Team = self.defenderTeam;
158-
guard.AIMode = Actor.AIMODE_SENTRY;
159-
if loadoutName == "Engineer" then
160-
guard.AIMode = Actor.AIMODE_GOLDDIG;
149+
hasSpawnAreas = true;
150+
end
151+
end
152+
153+
for actor in MovableMan.AddedActors do
154+
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems - Automovers") then
155+
if hasSpawnAreas then
156+
actor.ToDelete = true;
157+
elseif actor.Team ~= self.defenderTeam then
158+
MovableMan:ChangeActorTeam(actor, self.defenderTeam);
159+
end
160+
end
161+
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);
161184
end
162-
MovableMan:AddActor(guard);
163185
end
164186
end
165187
end
166188
end
167189
end
168-
for actor in MovableMan.AddedActors do
169-
if actor.Team ~= self.defenderTeam and not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems - Automovers") then
170-
MovableMan:ChangeActorTeam(actor, self.defenderTeam);
171-
end
172-
end
173190
end
174191

175192
function BunkerBreach:SetupFogOfWar()
@@ -241,12 +258,12 @@ function BunkerBreach:StartActivity(isNewGame)
241258

242259
self:SetupAIVariables();
243260

244-
self:SetupHumanAttackerBrains();
245-
246261
self:SetupDefenderBrains();
247262

248263
self:SetupDefenderActors();
249264

265+
self:SetupHumanAttackerBrains();
266+
250267
self:SetupFogOfWar();
251268
else
252269
self:ResumeLoadedGame();

Data/Base.rte/Activities/SkirmishDefense.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ function SkirmishDefense:StartNewGame(aiTeams)
110110
soleHumanTeam = soleHumanTeam == -1 and team or false;
111111
end
112112
end
113-
-- If there's only one Human team, set all existing doors to that team
113+
-- If there's only one Human team, set all existing doors and actors to that team
114114
if soleHumanTeam ~= false and soleHumanTeam >= 0 then
115115
for actor in MovableMan.AddedActors do
116-
if actor.Team ~= soleHumanTeam and actor.ClassName == "ADoor" then
116+
if actor.Team ~= soleHumanTeam then
117117
MovableMan:ChangeActorTeam(actor, soleHumanTeam);
118118
end
119119
end

Data/Base.rte/Activities/WaveDefense.lua

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ end
2525

2626
function WaveDefense:StartActivity(isNewGame)
2727
-- Get player team
28-
self.playerTeam = Activity.TEAM_1;
28+
self.playerTeam = Activity.TEAM_2;
2929
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
3030
if self:PlayerActive(player) and self:PlayerHuman(player) then
3131
self.playerTeam = self:GetTeamOfPlayer(player);
@@ -94,7 +94,6 @@ end
9494

9595
function WaveDefense:StartNewGame()
9696
self:SetTeamFunds(self:GetStartingGold(), self.playerTeam);
97-
self:CheckBrains();
9897

9998
self.triggerWaveInit = true;
10099
self.wave = 1;
@@ -105,7 +104,17 @@ function WaveDefense:StartNewGame()
105104
if actor.ClassName == "AHuman" or actor.ClassName == "ACrab" then
106105
actor.AIMode = Actor.AIMODE_SENTRY;
107106
end
108-
actor.Team = self.playerTeam;
107+
MovableMan:ChangeActorTeam(actor, self.playerTeam);
108+
end
109+
110+
self:CheckBrains();
111+
112+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
113+
if self:PlayerActive(player) and self:PlayerHuman(player) then
114+
if self:GetPlayerBrain(player) then
115+
self:SwitchToActor(self:GetPlayerBrain(player), player, self:GetTeamOfPlayer(player));
116+
end
117+
end
109118
end
110119
end
111120

@@ -258,6 +267,14 @@ function WaveDefense:UpdateActivity()
258267
end
259268
end
260269

270+
-- Reveal the main bunker area for the defender.
271+
local mainBunkerArea = SceneMan.Scene:GetOptionalArea("Main Bunker");
272+
if mainBunkerArea ~= nil then
273+
for mainBunkerBox in mainBunkerArea.Boxes do
274+
SceneMan:RevealUnseenBox(mainBunkerBox.Corner.X, mainBunkerBox.Corner.Y, mainBunkerBox.Width, mainBunkerBox.Height, self.playerTeam);
275+
end
276+
end
277+
261278
for Act in MovableMan.AddedActors do
262279
if Act.ClassName ~= "ADoor" then
263280
for ang = 0, math.pi*2, 0.15 do

Data/Base.rte/Actors/Brains/Brainbot/Brainbot.ini

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -742,66 +742,7 @@ AddActor = AHuman
742742
FastTravelSpeed = 4.5
743743
PushForce = 6000
744744
ClimbLimbPath = LimbPath
745-
PresetName = Brainbot Climb Path
746-
StartOffset = Vector
747-
X = 0
748-
Y = -14
749-
StartSegCount = 13
750-
AddSegment = Vector
751-
X = 4
752-
Y = 4
753-
AddSegment = Vector
754-
X = 1
755-
Y = 2
756-
AddSegment = Vector
757-
X = 1
758-
Y = 2
759-
AddSegment = Vector
760-
X = 1
761-
Y = 1
762-
AddSegment = Vector
763-
X = 1
764-
Y = 1
765-
AddSegment = Vector
766-
X = 1
767-
Y = 1
768-
AddSegment = Vector
769-
X = 1
770-
Y = 1
771-
AddSegment = Vector
772-
X = 1
773-
Y = 1
774-
AddSegment = Vector
775-
X = 1
776-
Y = 1
777-
AddSegment = Vector
778-
X = 1
779-
Y = 1
780-
AddSegment = Vector
781-
X = 1
782-
Y = 1
783-
AddSegment = Vector
784-
X = 1
785-
Y = 1
786-
AddSegment = Vector
787-
X = 0
788-
Y = 1
789-
AddSegment = Vector
790-
X = 0
791-
Y = 3
792-
AddSegment = Vector
793-
X = -2
794-
Y = 5
795-
AddSegment = Vector
796-
X = -4
797-
Y = 5
798-
AddSegment = Vector
799-
X = -6
800-
Y = 5
801-
SlowTravelSpeed = 1.5
802-
NormalTravelSpeed = 1.5
803-
FastTravelSpeed = 4.5
804-
PushForce = 7000
745+
CopyOf = Human Climb Path
805746
JumpLimbPath = LimbPath
806747
PresetName = Brainbot Jump Path
807748
StartOffset = Vector

0 commit comments

Comments
 (0)