@@ -332,25 +332,25 @@ function BunkerBreach:UpdateActivity()
332
332
local dist = Vector ();
333
333
local searchRadius = (SceneMan .SceneWidth + SceneMan .SceneHeight ) * 0.2 ;
334
334
local targetActor = MovableMan :GetClosestEnemyActor (self .CPUTeam , Vector (self .defenderBrain .Pos .X , SceneMan .SceneHeight * 0.5 ), searchRadius , dist );
335
- if targetActor and not SceneMan :IsUnseen (targetActor .Pos .X , targetActor .Pos .Y , self .CPUTeam ) then
336
- self .attackPos = targetActor .Pos ;
337
-
338
- self .CPUSpawnDelay = self .CPUSpawnDelay * 0.5 ;-- * dist.Magnitude/searchRadius;
339
- -- TODO: Fix GetClosestTeamActor and use that instead
340
- local closestGuard = MovableMan :GetClosestEnemyActor (targetActor .Team , targetActor .Pos , searchRadius - dist .Magnitude , Vector ());
341
- if closestGuard and math.random () > dist .Magnitude / searchRadius then
342
- -- Send a nearby alerted guard after the intruder
343
- closestGuard .AIMode = Actor .AIMODE_GOTO ;
344
- closestGuard :SetAIMOWayPoint (targetActor );
345
- self .attackPos = nil ;
346
- -- A guard has been sent, the next unit should spawn faster
347
- self .CPUSpawnDelay = self .CPUSpawnDelay * 0.8 ;
335
+ if targetActor then
336
+ if SceneMan :IsUnseen (targetActor .Pos .X , targetActor .Pos .Y , self .CPUTeam ) then
337
+ self .attackPos = targetActor .Pos ;
348
338
else
349
- self :CreateDrop (self .CPUTeam );
350
- self .CPUSpawnDelay = (40000 - self .difficultyRatio * 20000 + unitRatio * 7500 ) * rte .SpawnIntervalScale ;
351
- if math.random () < 0.5 then
352
- -- Change target for the next attack
339
+ local closestGuard = MovableMan :GetClosestTeamActor (self .CPUTeam , Activity .PLAYER_NONE , targetActor .Pos , searchRadius - dist .Magnitude , Vector (), self .defenderBrain );
340
+ if closestGuard and closestGuard .AIMODE ~= Actor .AIMODE_GOTO then
341
+ -- Send a nearby alerted guard after the intruder
342
+ closestGuard .AIMode = Actor .AIMODE_GOTO ;
343
+ closestGuard :AddAIMOWaypoint (targetActor );
353
344
self .attackPos = nil ;
345
+ -- A guard has been sent, the next unit should spawn faster
346
+ self .CPUSpawnDelay = self .CPUSpawnDelay * 0.8 ;
347
+ else
348
+ self :CreateDrop (self .CPUTeam );
349
+ self .CPUSpawnDelay = (30000 - self .difficultyRatio * 15000 + unitRatio * 5000 ) * rte .SpawnIntervalScale ;
350
+ if math.random () < 0.5 then
351
+ -- Change target for the next attack
352
+ self .attackPos = nil ;
353
+ end
354
354
end
355
355
end
356
356
else
@@ -520,11 +520,12 @@ function BunkerBreach:CreateInfantry(team, loadout)
520
520
if loadout == " Engineer" and self .sendGoldDiggers then
521
521
actor .AIMode = Actor .AIMODE_GOLDDIG ;
522
522
elseif self .attackPos then
523
+ actor .AIMode = Actor .AIMODE_GOTO ;
523
524
actor :AddAISceneWaypoint (self .attackPos );
524
- elseif team == self .attackerTeam then
525
+ elseif team == self .attackerTeam or math.random () < 0.3 then
525
526
actor .AIMode = Actor .AIMODE_BRAINHUNT ;
526
527
else
527
- actor .AIMode = Actor .AIMODE_SENTRY ;
528
+ actor .AIMode = math.random () < 0.3 and Actor . AIMODE_PATROL or Actor .AIMODE_SENTRY ;
528
529
end
529
530
actor .Team = team ;
530
531
return actor ;
0 commit comments