Fixed ZombieOutbreak adding ramping schedulers

This commit is contained in:
Vanessa 2026-08-14 12:37:00 -05:00
parent cfc6b4abe1
commit 17ae5754fd
3 changed files with 31 additions and 15 deletions

View File

@ -30,10 +30,20 @@ public sealed partial class ZombieRuleComponent : Component
/// <summary>
/// DeltaV - The behavior of the round if all zombies are defeated.
/// </summary>
[DataField]
public RoundEndBehavior ZombieRoundEndBehavior = RoundEndBehavior.BecomeSurvival;
/// <summary>
/// DeltaV - The amount of time before the evac shuttle will arrive if the ZombieRoundEndBehavior is set to ShuttleCall.
/// </summary>
[DataField]
public TimeSpan ZombieShuttleDelay = TimeSpan.FromMinutes(10);
/// <summary>
/// DeltaV - If true, ZombieRuleSystem will do the ZombieRoundEndBehavior if zombies are defeated.
/// This is needed because ZombieOutbreak uses the ZombieRuleComponent but the system won't know if
/// it was roundstart or not.
/// </summary>
[DataField]
public bool IsRoundStartZombies = false;
}

View File

@ -115,29 +115,34 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
/// </summary>
private void CheckRoundEnd(ZombieRuleComponent zombieRuleComponent)
{
// BEGIN DeltaV - Change mode to survival if zombies die
// Zombies have failed to launch and the mode has been switched to survival
if (zombieRuleComponent.ZombieRoundEndBehavior == RoundEndBehavior.Nothing)
return;
// END DeltaV
var healthy = GetHealthyHumans();
if (healthy.Count == 1) // Only one human left. spooky
_popup.PopupEntity(Loc.GetString("zombie-alone"), healthy[0], healthy[0]);
// BEGIN DeltaV - Change mode to survival if zombies die
var anyInitialInfectedAlive = EntityQuery<InitialInfectedComponent, MobStateComponent>(false)
.Any(x => x.Item2.CurrentState != MobState.Dead);
var anyLivingZombies = EntityQuery<ZombieComponent, MobStateComponent>(false)
.Any(x => x.Item2.CurrentState != MobState.Dead);
var anyPendingZombies = EntityQuery<PendingZombieComponent>(false).Any();
// All II turned/dead, all entities that have turned are dead, and there are no more pending zombies
if (!anyInitialInfectedAlive && !anyLivingZombies && !anyPendingZombies)
if (zombieRuleComponent.IsRoundStartZombies)
{
_roundEnd.DoRoundEndBehavior(zombieRuleComponent.ZombieRoundEndBehavior, zombieRuleComponent.ZombieShuttleDelay);
zombieRuleComponent.ZombieRoundEndBehavior = RoundEndBehavior.Nothing; // stop this check in the future
// Zombies have failed to launch and the mode has been switched to survival
if (zombieRuleComponent.ZombieRoundEndBehavior == RoundEndBehavior.Nothing)
return;
// BEGIN DeltaV - Change mode to survival if zombies die
var anyInitialInfectedAlive = EntityQuery<InitialInfectedComponent, MobStateComponent>(false)
.Any(x => x.Item2.CurrentState != MobState.Dead);
var anyLivingZombies = EntityQuery<ZombieComponent, MobStateComponent>(false)
.Any(x => x.Item2.CurrentState != MobState.Dead);
var anyPendingZombies = EntityQuery<PendingZombieComponent>(false).Any();
// All II turned/dead, all entities that have turned are dead, and there are no more pending zombies
if (!anyInitialInfectedAlive && !anyLivingZombies && !anyPendingZombies)
{
_roundEnd.DoRoundEndBehavior(zombieRuleComponent.ZombieRoundEndBehavior, zombieRuleComponent.ZombieShuttleDelay);
zombieRuleComponent.ZombieRoundEndBehavior = RoundEndBehavior.Nothing; // stop this check in the future
}
}
// END DeltaV

View File

@ -441,6 +441,7 @@
min: 600
max: 900
- type: ZombieRule
isRoundStartZombies: true # DeltaV - concert to survival if they all die
- type: DelayedRule # DeltaV: Grace period of 5 minutes before you can turn, to avoid a random passenger ruining your plan
delay: 300
delayedComponents: