]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix Pacified Damage Dealing Thrown Objects (#31183)
authorCojoke <83733158+Cojoke-dot@users.noreply.github.com>
Mon, 19 Aug 2024 11:56:40 +0000 (06:56 -0500)
committerGitHub <noreply@github.com>
Mon, 19 Aug 2024 11:56:40 +0000 (13:56 +0200)
Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs
Content.Shared/Projectiles/SharedProjectileSystem.cs

index 8a7b3df0b2481af3d261e8f4ee20cbdf9fd84c04..8a35e471b4e8d82b0acdd3e0ca66c152d64590f6 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Server.Administration.Logs;
 using Content.Server.Damage.Components;
 using Content.Server.Weapons.Ranged.Systems;
+using Content.Shared.CombatMode.Pacification;
 using Content.Shared.Camera;
 using Content.Shared.Damage;
 using Content.Shared.Damage.Events;
@@ -9,6 +10,7 @@ using Content.Shared.Database;
 using Content.Shared.Effects;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Throwing;
+using Content.Shared.Wires;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Player;
 
@@ -28,6 +30,7 @@ namespace Content.Server.Damage.Systems
         {
             SubscribeLocalEvent<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit);
             SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine);
+            SubscribeLocalEvent<DamageOtherOnHitComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow);
         }
 
         private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
@@ -58,5 +61,13 @@ namespace Content.Server.Damage.Systems
         {
             _damageExamine.AddDamageExamine(args.Message, component.Damage, Loc.GetString("damage-throw"));
         }
+
+        /// <summary>
+        /// Prevent players with the Pacified status effect from throwing things that deal damage.
+        /// </summary>
+        private void OnAttemptPacifiedThrow(Entity<DamageOtherOnHitComponent> ent, ref AttemptPacifiedThrowEvent args)
+        {
+            args.Cancel("pacified-cannot-throw");
+        }
     }
 }
index 1f6f2b6918faa9bf30b139af93df18ba39158f22..1b7d6d6f99157c6385e487bca2271910a8ba36b8 100644 (file)
@@ -38,7 +38,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
         SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
         SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
         SubscribeLocalEvent<EmbeddableProjectileComponent, RemoveEmbeddedProjectileEvent>(OnEmbedRemove);
-        SubscribeLocalEvent<EmbeddableProjectileComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow);
     }
 
     private void OnEmbedActivate(EntityUid uid, EmbeddableProjectileComponent component, ActivateInWorldEvent args)
@@ -154,14 +153,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
     {
         public override DoAfterEvent Clone() => this;
     }
-
-    /// <summary>
-    /// Prevent players with the Pacified status effect from throwing embeddable projectiles.
-    /// </summary>
-    private void OnAttemptPacifiedThrow(Entity<EmbeddableProjectileComponent> ent, ref AttemptPacifiedThrowEvent args)
-    {
-        args.Cancel("pacified-cannot-throw-embed");
-    }
 }
 
 [Serializable, NetSerializable]