]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix prying speed & log (#29210)
authorMilenVolf <63782763+MilenVolf@users.noreply.github.com>
Thu, 20 Jun 2024 14:19:22 +0000 (17:19 +0300)
committerGitHub <noreply@github.com>
Thu, 20 Jun 2024 14:19:22 +0000 (00:19 +1000)
* cleanup prototypes with `PryingComponent` & fix jaws of life prying speed

* Minor cleanup for tools and prying systems

Remove some obsolete methods.

* Fix doafter continues when not held & log

* Modifiy delays for floor prying

* Fix test fail

12 files changed:
Content.Shared/Prying/Components/PryingComponent.cs
Content.Shared/Prying/Systems/PryingSystem.cs
Content.Shared/Tools/Components/ToolForcePoweredComponent.cs [deleted file]
Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs
Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs
Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
Resources/Prototypes/Entities/Objects/Tools/cowtools.yml
Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
Resources/Prototypes/Entities/Objects/Weapons/Melee/armblade.yml
Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml

index 7a7f304d8f83406ec677a3b896204358b02dcc62..6651e2b5744d39ccaf64f6e26430c027485ba42f 100644 (file)
@@ -9,32 +9,32 @@ public sealed partial class PryingComponent : Component
     /// <summary>
     /// Whether the entity can pry open powered doors
     /// </summary>
-    [DataField("pryPowered")]
-    public bool PryPowered = false;
+    [DataField]
+    public bool PryPowered;
 
     /// <summary>
     /// Whether the tool can bypass certain restrictions when prying.
     /// For example door bolts.
     /// </summary>
-    [DataField("force")]
-    public bool Force = false;
+    [DataField]
+    public bool Force;
     /// <summary>
     /// Modifier on the prying time.
     /// Lower values result in more time.
     /// </summary>
-    [DataField("speedModifier")]
+    [DataField]
     public float SpeedModifier = 1.0f;
 
     /// <summary>
     /// What sound to play when prying is finished.
     /// </summary>
-    [DataField("useSound")]
+    [DataField]
     public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
 
     /// <summary>
     /// Whether the entity can currently pry things.
     /// </summary>
-    [DataField("enabled")]
+    [DataField]
     public bool Enabled = true;
 }
 
index 372c89c9ae090e6e0b24bd5ca5caf18fcd260e84..52459c4f744caded2e4dd58efd2ce42dfdc104c3 100644 (file)
@@ -21,7 +21,7 @@ public sealed class PryingSystem : EntitySystem
     [Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
     [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
     [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
-    [Dependency] private readonly SharedPopupSystem Popup = default!;
+    [Dependency] private readonly SharedPopupSystem _popup = default!;
 
     public override void Initialize()
     {
@@ -46,7 +46,7 @@ public sealed class PryingSystem : EntitySystem
         if (!args.CanInteract || !args.CanAccess)
             return;
 
-        if (!TryComp<PryingComponent>(args.User, out var tool))
+        if (!TryComp<PryingComponent>(args.User, out _))
             return;
 
         args.Verbs.Add(new AlternativeVerb()
@@ -74,7 +74,7 @@ public sealed class PryingSystem : EntitySystem
         if (!CanPry(target, user, out var message, comp))
         {
             if (!string.IsNullOrWhiteSpace(message))
-                Popup.PopupClient(Loc.GetString(message), target, user);
+                _popup.PopupClient(Loc.GetString(message), target, user);
             // If we have reached this point we want the event that caused this
             // to be marked as handled.
             return true;
@@ -138,9 +138,10 @@ public sealed class PryingSystem : EntitySystem
         {
             BreakOnDamage = true,
             BreakOnMove = true,
+            NeedHand = tool != user,
         };
 
-        if (tool != null)
+        if (tool != user && tool != null)
         {
             _adminLog.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(user)} is using {ToPrettyString(tool.Value)} to pry {ToPrettyString(target)}");
         }
@@ -163,7 +164,7 @@ public sealed class PryingSystem : EntitySystem
         if (!CanPry(uid, args.User, out var message, comp))
         {
             if (!string.IsNullOrWhiteSpace(message))
-                Popup.PopupClient(Loc.GetString(message), uid, args.User);
+                _popup.PopupClient(Loc.GetString(message), uid, args.User);
             return;
         }
 
@@ -178,6 +179,4 @@ public sealed class PryingSystem : EntitySystem
 }
 
 [Serializable, NetSerializable]
-public sealed partial class DoorPryDoAfterEvent : SimpleDoAfterEvent
-{
-}
+public sealed partial class DoorPryDoAfterEvent : SimpleDoAfterEvent;
diff --git a/Content.Shared/Tools/Components/ToolForcePoweredComponent.cs b/Content.Shared/Tools/Components/ToolForcePoweredComponent.cs
deleted file mode 100644 (file)
index d38034c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Content.Shared.Tools.Components
-{
-    /// <summary>
-    /// Tag component to let a tool ignore restrictions on whether devices are powered
-    /// or not to work.
-    /// </summary>
-    [RegisterComponent]
-    public sealed partial class ToolForcePoweredComponent : Component
-    {}
-}
index d69f01d762f62cb345759a079452bef950a15f0f..595ef8a9252c64e1029886635ca0fb8406a6cd30 100644 (file)
@@ -70,16 +70,9 @@ public abstract partial class SharedToolSystem
         tool.Qualities = current.Behavior;
 
         // TODO: Replace this with a better solution later
-        if (TryComp<PryingComponent>(uid, out var pcomp))
+        if (TryComp<PryingComponent>(uid, out var pryComp))
         {
-            if (current.Behavior.Contains("Prying"))
-            {
-                pcomp.Enabled = true;
-            }
-            else
-            {
-                pcomp.Enabled = false;
-            }
+            pryComp.Enabled = current.Behavior.Contains("Prying");
         }
 
         if (playSound && current.ChangeSound != null)
index f392b31740696d56f8527ef52fc6fe5fbb58629d..6fa4fac4b3a4d2e4fb811fb68703217bf3dbef47 100644 (file)
@@ -53,8 +53,10 @@ public abstract partial class SharedToolSystem
         if (!TryDeconstructWithToolQualities(tileRef, tool.Qualities))
             return;
 
-        AdminLogger.Add(LogType.LatticeCut, LogImpact.Medium,
-                $"{ToPrettyString(args.User):player} used {ToPrettyString(ent)} to edit the tile at {coords}");
+        AdminLogger.Add(
+            LogType.LatticeCut,
+            LogImpact.Medium,
+            $"{ToPrettyString(args.User):player} used {ToPrettyString(ent)} to edit the tile at {coords}");
         args.Handled = true;
     }
 
index b7fb1188ccd6d8f681438596f761645b48c9a8d1..023ba8c08a811c8c6a5b158450c64a9e6d925770 100644 (file)
@@ -22,8 +22,6 @@
         Slash: 10
   - type: ToolTileCompatible
   - type: Tool
-    qualities:
-      - Prying
   - type: Prying
   - type: MultipleTool
     statusShowBehavior: true
index 93d24be5af8f5f072adada714a2b93b43137c59c..fc9e5151e91beae0c5ccebdc909b03f1d1cfd07d 100644 (file)
     tags:
     - DoorBumpOpener
     - FootstepSound
-  - type: Tool # Open door from xeno.yml.
+  - type: Prying # Open door from xeno.yml.
+    pryPowered: true
+    force: true
     speedModifier: 1.5
-    qualities:
-      - Prying
-    useSound:
-      path: /Audio/Items/crowbar.ogg
-  - type: Prying
-    pryPowered: !type:Bool
-        true
-    force: !type:Bool
-      true
     useSound:
       path: /Audio/Items/crowbar.ogg
   - type: PassiveDamage # Slight passive regen. Assuming one damage type, comes out to about 4 damage a minute from base.yml.
index 8c262d23da65cdd562f40dc5e4316cc059ef562a..9fb0be02aec9a5ba289b77a2450861a5bef3b98b 100644 (file)
         true
       NavSmash: !type:Bool
         true
-  - type: Tool
-    speedModifier: 1.5
-    qualities:
-      - Prying
   - type: Prying
-    pryPowered: !type:Bool
-        true
-    force: !type:Bool
-      true
+    pryPowered: true
+    force: true
+    speedModifier: 1.5
     useSound:
       path: /Audio/Items/crowbar.ogg
   - type: Reactive
index c9b37b8b1aed704dabe4c176cdb10fa0d2bc110e..2d584bd233c9e821b67fb41beca9a76217ba31c9 100644 (file)
   - type: Tool
     qualities:
     - Prying
-    useSound:
-      path: /Audio/Items/crowbar.ogg
-    speedModifier: 0.05
   - type: ToolTileCompatible
+    delay: 10
   - type: Prying
+    speedModifier: 0.05
 
 - type: entity
   name: mooltitool
index c80e53870e583dbf9084dcb48f7d46d4bd495f29..bd4c7aa7b5dad9de2891ffd938d2d3ceec41458c 100644 (file)
     slots:
       - Belt
   - type: ToolTileCompatible
+    delay: 0.5
   - type: Tool
     qualities:
       - Prying
-    speedModifier: 1.5
     useSound: /Audio/Items/jaws_pry.ogg
   - type: Prying
+    speedModifier: 1.5
     pryPowered: true
     useSound: /Audio/Items/jaws_pry.ogg
-  - type: ToolForcePowered
   - type: MultipleTool
     statusShowBehavior: true
     entries:
@@ -66,9 +66,7 @@
       right:
       - state: syn_inhand-right
     size: Normal
-  - type: Tool
-    qualities:
-      - Prying
+  - type: Prying
     speedModifier: 3.0
   - type: MultipleTool
     entries:
index 9e1134195d58206269f51ec1f27b277e6c1b07b3..49b22c000d595a7b363df0b9bd7f372e88d91933 100644 (file)
@@ -18,7 +18,4 @@
   - type: Item
     size: Normal
     sprite: Objects/Weapons/Melee/armblade.rsi
-  - type: Tool
-    qualities:
-      - Prying
   - type: Prying
index ccf45bf59aa92cdbd52b0d7bcf11e39ab67731fd..4eec90584c812d5f0719ae03c4fc0a444ac14cee 100644 (file)
@@ -62,9 +62,6 @@
   - type: Item
     size: Ginormous
   - type: DisarmMalus
-  - type: Tool
-    qualities:
-      - Prying
   - type: Prying
 
 - type: entity