Zombie virus delayed from 20-30 minutes from rule start. (#16346)
This commit is contained in:
@@ -8,4 +8,28 @@ public sealed class ZombieRuleComponent : Component
|
||||
|
||||
public string PatientZeroPrototypeID = "InitialInfected";
|
||||
public const string ZombifySelfActionPrototype = "TurnUndead";
|
||||
|
||||
/// <summary>
|
||||
/// After this many seconds the players will be forced to turn into zombies (at minimum)
|
||||
/// Defaults to 20 minutes. 20*60 = 1200 seconds.
|
||||
///
|
||||
/// Zombie time for a given player is:
|
||||
/// random MinZombieForceSecs to MaxZombieForceSecs + up to PlayerZombieForceVariation
|
||||
/// </summary>
|
||||
[DataField("minZombieForceSecs"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MinZombieForceSecs = 1200;
|
||||
|
||||
/// <summary>
|
||||
/// After this many seconds the players will be forced to turn into zombies (at maximum)
|
||||
/// Defaults to 30 minutes. 30*60 = 1800 seconds.
|
||||
/// </summary>
|
||||
[DataField("maxZombieForceSecs"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MaxZombieForceSecs = 1800;
|
||||
|
||||
/// <summary>
|
||||
/// How many additional seconds each player will get (at random) to scatter forced zombies over time.
|
||||
/// Defaults to 2 minutes. 2*60 = 120 seconds.
|
||||
/// </summary>
|
||||
[DataField("playerZombieForceVariationSecs"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float PlayerZombieForceVariationSecs = 120;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,10 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
(int) Math.Min(
|
||||
Math.Floor((double) playerList.Count / playersPerInfected), maxInfected));
|
||||
|
||||
// How long the zombies have as a group to decide to begin their attack.
|
||||
// Varies randomly from 20 to 30 minutes. After this the virus begins and they start
|
||||
// taking zombie virus damage.
|
||||
var groupTimelimit = _random.NextFloat(component.MinZombieForceSecs, component.MaxZombieForceSecs);
|
||||
for (var i = 0; i < numInfected; i++)
|
||||
{
|
||||
IPlayerSession zombie;
|
||||
@@ -283,9 +287,13 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
mind.AddRole(new TraitorRole(mind, _prototypeManager.Index<AntagPrototype>(component.PatientZeroPrototypeID)));
|
||||
|
||||
var inCharacterName = string.Empty;
|
||||
// Create some variation between the times of each zombie, relative to the time of the group as a whole.
|
||||
var personalDelay = _random.NextFloat(0.0f, component.PlayerZombieForceVariationSecs);
|
||||
if (mind.OwnedEntity != null)
|
||||
{
|
||||
EnsureComp<PendingZombieComponent>(mind.OwnedEntity.Value);
|
||||
var pending = EnsureComp<PendingZombieComponent>(mind.OwnedEntity.Value);
|
||||
// Only take damage after this many seconds
|
||||
pending.InfectedSecs = -(int)(groupTimelimit + personalDelay);
|
||||
EnsureComp<ZombifyOnDeathComponent>(mind.OwnedEntity.Value);
|
||||
inCharacterName = MetaData(mind.OwnedEntity.Value).EntityName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user