@@ -528,24 +528,23 @@ function DecisionDay:SetupStorageCrateInventories()
528
528
end
529
529
530
530
function DecisionDay :DoInitialHumanSpawns ()
531
- local nextActorPos = Vector (self .initialHumanSpawnArea .FirstBox .Corner .X , self .initialHumanSpawnArea .Center .Y );
531
+ local firstActorPos = Vector (self .initialHumanSpawnArea .FirstBox .Corner .X , self .initialHumanSpawnArea .Center .Y );
532
532
local initialActorFunds = 1300 / self .difficultyRatio ;
533
- local spawnedActorNumber = 0 ;
533
+ local spawnedActors = {} ;
534
534
while initialActorFunds > 0 do
535
- spawnedActorNumber = spawnedActorNumber + 1 ;
536
- local actor = self :SpawnInfantry (self .humanTeam , spawnedActorNumber < 3 and " CQB" or " Heavy" , nextActorPos , Actor .AIMODE_SENTRY , true );
537
- actor .Pos = SceneMan :MovePointToGround (actor .Pos , actor .Radius , 5 );
535
+ local actor = self :SpawnInfantry (self .humanTeam , # spawnedActors < 3 and " CQB" or " Heavy" , firstActorPos , Actor .AIMODE_SENTRY , true );
536
+ spawnedActors [# spawnedActors + 1 ] = actor ;
538
537
actor .PlayerControllable = true ;
539
- if spawnedActorNumber < 3 then
538
+ if # spawnedActors < 3 then
540
539
actor :AddInventoryItem (RandomTDExplosive (" Tools - Breaching" , self .humanTeamTech ));
541
540
elseif math.random () < 0.65 then
542
541
actor :AddInventoryItem (RandomTDExplosive (" Bombs - Grenades" , self .humanTeamTech ));
543
542
end
544
543
initialActorFunds = initialActorFunds - actor :GetTotalValue (self .humanTeamTech , 1 );
545
- nextActorPos = nextActorPos + Vector (30 , 0 );
546
544
end
547
545
for _ , player in pairs (self .humanPlayers ) do
548
546
local brain = PresetMan :GetLoadout (" Infantry Brain" , self .humanTeamTech , false );
547
+ spawnedActors [# spawnedActors + 1 ] = brain ;
549
548
if brain then
550
549
brain :RemoveInventoryItem (" Constructor" );
551
550
else
@@ -554,14 +553,20 @@ function DecisionDay:DoInitialHumanSpawns()
554
553
brain :AddInventoryItem (RandomHDFirearm (" Weapons - Light" , self .humanTeamTech ));
555
554
brain :AddInventoryItem (RandomHDFirearm (" Weapons - Secondary" , self .humanTeamTech ));
556
555
end
557
- brain .Pos = nextActorPos ;
556
+ brain .Pos = firstActorPos ;
558
557
brain .Team = self .humanTeam ;
559
- nextActorPos = nextActorPos + Vector (30 , 0 );
560
558
brain .AIMode = Actor .AIMODE_SENTRY ;
561
559
MovableMan :AddActor (brain );
562
560
self :SetPlayerBrain (brain , player );
563
561
self :SetObservationTarget (brain .Pos , player );
564
562
end
563
+
564
+ local actorXOffset = math.min (30 , 275 / # spawnedActors );
565
+ for index , actor in ipairs (spawnedActors ) do
566
+ actor .Pos .X = actor .Pos .X + (actorXOffset * (index - 1 ));
567
+ actor .Pos .Y = 0 ;
568
+ actor .Pos = SceneMan :MovePointToGround (actor .Pos , actor .Radius , 5 );
569
+ end
565
570
end
566
571
567
572
function DecisionDay :SpawnAreaDefinedAIDefenders ()
0 commit comments