Skip to content

Commit 60ffc07

Browse files
committed
Activities now avoid dropping ships on the player in singleplayer.
Six activities had a block of code using nonexistant variables to check if there was only 1 player, and if so, make the AI's deployment unable to pick a spot directly above the player's head. I changed it to instead use existing variables, so the code should now function properly.
1 parent 549d566 commit 60ffc07

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

Data/Base.rte/Activities/Harvester.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,11 @@ function Harvester:UpdateActivity()
294294

295295
if ship then
296296
-- Set the spawn point of the ship from orbit
297-
if self.playertally == 1 then
298-
for i = 1, #self.playerlist do
299-
if self.playerlist[i] == true then
297+
if self.HumanCount == 1 then
298+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
299+
if self:PlayerActive(player) and self:PlayerHuman(player) then
300300
local sceneChunk = SceneMan.SceneWidth / 3;
301-
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
301+
local checkPos = self:GetPlayerBrain(player).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
302302
if checkPos > SceneMan.SceneWidth then
303303
checkPos = checkPos - SceneMan.SceneWidth;
304304
elseif checkPos < 0 then

Data/Base.rte/Activities/KeepieUppie.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ function KeepieUppie:UpdateActivity()
226226
end
227227

228228
-- Set the spawn point of the ship from orbit
229-
if self.playertally == 1 then
230-
for i = 1, #self.playerlist do
231-
if self.playerlist[i] == true then
229+
if self.HumanCount == 1 then
230+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
231+
if self:PlayerActive(player) and self:PlayerHuman(player) then
232232
local sceneChunk = SceneMan.SceneWidth / 3;
233-
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
233+
local checkPos = self:GetPlayerBrain(player).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
234234
if checkPos > SceneMan.SceneWidth then
235235
checkPos = checkPos - SceneMan.SceneWidth;
236236
elseif checkPos < 0 then

Data/Base.rte/Activities/Massacre.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ function Massacre:UpdateActivity()
297297

298298
if ship then
299299
-- Set the spawn point of the ship from orbit
300-
if self.playertally == 1 then
301-
for i = 1, #self.playerlist do
302-
if self.playerlist[i] == true then
300+
if self.HumanCount == 1 then
301+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
302+
if self:PlayerActive(player) and self:PlayerHuman(player) then
303303
local sceneChunk = SceneMan.SceneWidth / 3;
304304
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
305305
if checkPos > SceneMan.SceneWidth then

Data/Base.rte/Activities/OneManArmy.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ function OneManArmy:UpdateActivity()
378378

379379
if ship then
380380
--Set the spawn point of the ship from orbit
381-
if self.playertally == 1 then
382-
for i = 1, #self.playerlist do
383-
if self.playerlist[i] == true then
381+
if self.HumanCount == 1 then
382+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
383+
if self:PlayerActive(player) and self:PlayerHuman(player) then
384384
local sceneChunk = SceneMan.SceneWidth * 0.3;
385385
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth * 0.5) + ((sceneChunk * 0.5) - (math.random() * sceneChunk));
386386
if checkPos > SceneMan.SceneWidth then

Data/Base.rte/Activities/OneManArmyDiggers.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ function OneManArmy:UpdateActivity()
321321

322322
if ship then
323323
-- Set the spawn point of the ship from orbit
324-
if self.playertally == 1 then
325-
for i = 1, #self.playerlist do
326-
if self.playerlist[i] == true then
324+
if self.HumanCount == 1 then
325+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
326+
if self:PlayerActive(player) and self:PlayerHuman(player) then
327327
local sceneChunk = SceneMan.SceneWidth / 3;
328328
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
329329
if checkPos > SceneMan.SceneWidth then

Data/Base.rte/Activities/Survival.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ function Survival:UpdateActivity()
275275

276276
if ship then
277277
-- Set the spawn point of the ship from orbit
278-
if self.playertally == 1 then
279-
for i = 1, #self.playerlist do
280-
if self.playerlist[i] == true then
278+
if self.HumanCount == 1 then
279+
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
280+
if self:PlayerActive(player) and self:PlayerHuman(player) then
281281
local sceneChunk = SceneMan.SceneWidth / 3;
282282
local checkPos = self:GetPlayerBrain(i - 1).Pos.X + (SceneMan.SceneWidth/2) + ( (sceneChunk/2) - (math.random()*sceneChunk) );
283283
if checkPos > SceneMan.SceneWidth then

0 commit comments

Comments
 (0)