Prevent non-inital infected from getting the succumb to zombie action (#27820)
* b * Update ZombieRuleSystem.cs * hi
This commit is contained in:
@@ -35,7 +35,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PendingZombieComponent, ZombifySelfActionEvent>(OnZombifySelf);
|
||||
SubscribeLocalEvent<IncurableZombieComponent, ZombifySelfActionEvent>(OnZombifySelf);
|
||||
}
|
||||
|
||||
protected override void AppendRoundEndText(EntityUid uid, ZombieRuleComponent component, GameRuleComponent gameRule,
|
||||
@@ -128,7 +128,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
component.NextRoundEndCheck = _timing.CurTime + component.EndCheckDelay;
|
||||
}
|
||||
|
||||
private void OnZombifySelf(EntityUid uid, PendingZombieComponent component, ZombifySelfActionEvent args)
|
||||
private void OnZombifySelf(EntityUid uid, IncurableZombieComponent component, ZombifySelfActionEvent args)
|
||||
{
|
||||
_zombie.ZombifyEntity(uid);
|
||||
if (component.Action != null)
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
namespace Content.Server.Zombies;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Zombies;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for a zombie that cannot be cured by any methods.
|
||||
/// This is used for a zombie that cannot be cured by any methods. Gives a succumb to zombie infection action.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class IncurableZombieComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public EntProtoId ZombifySelfActionPrototype = "ActionTurnUndead";
|
||||
|
||||
[DataField]
|
||||
public EntityUid? Action;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Zombies;
|
||||
@@ -48,9 +47,6 @@ public sealed partial class PendingZombieComponent : Component
|
||||
[DataField]
|
||||
public TimeSpan MaxInitialInfectedGrace = TimeSpan.FromMinutes(15f);
|
||||
|
||||
[DataField]
|
||||
public EntProtoId ZombifySelfActionPrototype = "ActionTurnUndead";
|
||||
|
||||
/// <summary>
|
||||
/// The chance each second that a warning will be shown.
|
||||
/// </summary>
|
||||
@@ -66,6 +62,4 @@ public sealed partial class PendingZombieComponent : Component
|
||||
"zombie-infection-warning",
|
||||
"zombie-infection-underway"
|
||||
};
|
||||
|
||||
[DataField] public EntityUid? Action;
|
||||
}
|
||||
|
||||
@@ -64,9 +64,16 @@ namespace Content.Server.Zombies
|
||||
|
||||
SubscribeLocalEvent<PendingZombieComponent, MapInitEvent>(OnPendingMapInit);
|
||||
|
||||
SubscribeLocalEvent<IncurableZombieComponent, MapInitEvent>(OnPendingMapInit);
|
||||
|
||||
SubscribeLocalEvent<ZombifyOnDeathComponent, MobStateChangedEvent>(OnDamageChanged);
|
||||
}
|
||||
|
||||
private void OnPendingMapInit(EntityUid uid, IncurableZombieComponent component, MapInitEvent args)
|
||||
{
|
||||
_actions.AddAction(uid, ref component.Action, component.ZombifySelfActionPrototype);
|
||||
}
|
||||
|
||||
private void OnPendingMapInit(EntityUid uid, PendingZombieComponent component, MapInitEvent args)
|
||||
{
|
||||
if (_mobState.IsDead(uid))
|
||||
@@ -77,7 +84,6 @@ namespace Content.Server.Zombies
|
||||
|
||||
component.NextTick = _timing.CurTime + TimeSpan.FromSeconds(1f);
|
||||
component.GracePeriod = _random.Next(component.MinInitialInfectedGrace, component.MaxInitialInfectedGrace);
|
||||
_actions.AddAction(uid, ref component.Action, component.ZombifySelfActionPrototype);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
|
||||
Reference in New Issue
Block a user