]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Prevent non-inital infected from getting the succumb to zombie action (#27820)
authorMr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>
Thu, 9 May 2024 21:45:23 +0000 (17:45 -0400)
committerGitHub <noreply@github.com>
Thu, 9 May 2024 21:45:23 +0000 (17:45 -0400)
* b

* Update ZombieRuleSystem.cs

* hi

Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
Content.Server/Zombies/IncurableZombieComponent.cs
Content.Server/Zombies/PendingZombieComponent.cs
Content.Server/Zombies/ZombieSystem.cs

index f22c20840838ba85959f04de76508c58c8f84f1f..97e5fd3fc468ba60891a03ad07f999a13bc00641 100644 (file)
@@ -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)
index 26958656909d06a68338db22c9b9aeb4abe992e1..375b814b51da219136e08aabdb1ca4608b738604 100644 (file)
@@ -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;
 }
index 98eae74f06fb889e1562aadf0be7b9c76a3422de..811d3f96440c24f7612b0113337d73c1f23203a9 100644 (file)
@@ -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;
 }
index 09c8fa26db6aae921c62fb2926771dc01a149a72..552fd2781c0929266b1ce020c701a2b67e82a2da 100644 (file)
@@ -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)