Skip to content

Commit

Permalink
Possible fix for #589 (artillery locking up & can't be used).
Browse files Browse the repository at this point in the history
Made it so that it's impossible for the arty spawner actor to set a nil timer, which would break the timer sequence, meaning the arty strike never ends, the spawner never destroys itself, & the team's arty is jammed for the rest of the map.
  • Loading branch information
handsm committed Feb 18, 2017
1 parent f412367 commit e443229
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions DH_Engine/Classes/DHArtillerySpawner.uc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function PostBeginPlay()
StrikeDelay = float(LI.GetStrikeDelay(OwningTeam)) * (0.85 + (FRand() * 0.3)); // +/- 15% randomisation on delay

// Set timer until arty strike begins
SetTimer(StrikeDelay, false);
SetTimer(FMin(StrikeDelay, 1.0), false); // added a minimum to avoid any possibility of setting a null timer
}
else
{
Expand All @@ -56,6 +56,10 @@ function Destroyed()
{
ROGameReplicationInfo(Level.Game.GameReplicationInfo).ArtyStrikeLocation[OwningTeam] = vect(0.0, 0.0, 0.0);
}
else
{
Log("DHArtillerySpawner ERROR: actor destroyed but no GRI so can't clear the ArtyStrikeLocation to end the strike!");
}

LastSpawnedShell = none;
}
Expand Down Expand Up @@ -127,7 +131,7 @@ function Timer()
// If this salvo still has remaining shells to land, set a new, fairly short timer to spawn the next shell & exit
if (ShellCounter < BatterySize)
{
SetTimer(FRand() * 1.5, false); // randomised 0 to 1.5 seconds between shells
SetTimer(0.05 + (FRand() * 1.45), false); // randomised 0.05 to 1.5 seconds between shells (0.05 minimum to avoid any possibility of setting a null timer)

return;
}
Expand All @@ -142,7 +146,7 @@ function Timer()
if (SalvoCounter < SalvoAmount)
{
ShellCounter = 0; // reset shell counter for next salvo
SetTimer(10.0 + (10.0 * FRand()), false); // randomised 10 to 20 seconds between salvoes
SetTimer(10.0 + (FRand() * 10.0), false); // randomised 10 to 20 seconds between salvoes
}
// Otherwise destroy this actor as the arty strike has finished
else
Expand Down

0 comments on commit e443229

Please sign in to comment.