From 50146d4b98e6a14eba3a4b2df0a436ed31ae199b Mon Sep 17 00:00:00 2001
From: MilenVolf <63782763+MilenVolf@users.noreply.github.com>
Date: Thu, 20 Jun 2024 17:19:22 +0300
Subject: [PATCH] Fix prying speed & log (#29210)
* 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
---
.../Prying/Components/PryingComponent.cs | 14 +++++++-------
Content.Shared/Prying/Systems/PryingSystem.cs | 15 +++++++--------
.../Tools/Components/ToolForcePoweredComponent.cs | 10 ----------
.../Systems/SharedToolSystem.MultipleTool.cs | 11 ++---------
.../Tools/Systems/SharedToolSystem.Tile.cs | 6 ++++--
.../Entities/Debugging/spanisharmyknife.yml | 2 --
.../Prototypes/Entities/Mobs/NPCs/animals.yml | 13 +++----------
Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml | 11 +++--------
.../Entities/Objects/Tools/cowtools.yml | 5 ++---
.../Entities/Objects/Tools/jaws_of_life.yml | 8 +++-----
.../Entities/Objects/Weapons/Melee/armblade.yml | 3 ---
.../Entities/Objects/Weapons/Melee/mining.yml | 3 ---
12 files changed, 31 insertions(+), 70 deletions(-)
delete mode 100644 Content.Shared/Tools/Components/ToolForcePoweredComponent.cs
diff --git a/Content.Shared/Prying/Components/PryingComponent.cs b/Content.Shared/Prying/Components/PryingComponent.cs
index 7a7f304d8f..6651e2b574 100644
--- a/Content.Shared/Prying/Components/PryingComponent.cs
+++ b/Content.Shared/Prying/Components/PryingComponent.cs
@@ -9,32 +9,32 @@ public sealed partial class PryingComponent : Component
///
/// Whether the entity can pry open powered doors
///
- [DataField("pryPowered")]
- public bool PryPowered = false;
+ [DataField]
+ public bool PryPowered;
///
/// Whether the tool can bypass certain restrictions when prying.
/// For example door bolts.
///
- [DataField("force")]
- public bool Force = false;
+ [DataField]
+ public bool Force;
///
/// Modifier on the prying time.
/// Lower values result in more time.
///
- [DataField("speedModifier")]
+ [DataField]
public float SpeedModifier = 1.0f;
///
/// What sound to play when prying is finished.
///
- [DataField("useSound")]
+ [DataField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
///
/// Whether the entity can currently pry things.
///
- [DataField("enabled")]
+ [DataField]
public bool Enabled = true;
}
diff --git a/Content.Shared/Prying/Systems/PryingSystem.cs b/Content.Shared/Prying/Systems/PryingSystem.cs
index 372c89c9ae..52459c4f74 100644
--- a/Content.Shared/Prying/Systems/PryingSystem.cs
+++ b/Content.Shared/Prying/Systems/PryingSystem.cs
@@ -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(args.User, out var tool))
+ if (!TryComp(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
index d38034c754..0000000000
--- a/Content.Shared/Tools/Components/ToolForcePoweredComponent.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Content.Shared.Tools.Components
-{
- ///
- /// Tag component to let a tool ignore restrictions on whether devices are powered
- /// or not to work.
- ///
- [RegisterComponent]
- public sealed partial class ToolForcePoweredComponent : Component
- {}
-}
diff --git a/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs b/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs
index d69f01d762..595ef8a925 100644
--- a/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs
+++ b/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs
@@ -70,16 +70,9 @@ public abstract partial class SharedToolSystem
tool.Qualities = current.Behavior;
// TODO: Replace this with a better solution later
- if (TryComp(uid, out var pcomp))
+ if (TryComp(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)
diff --git a/Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs b/Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs
index f392b31740..6fa4fac4b3 100644
--- a/Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs
+++ b/Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs
@@ -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;
}
diff --git a/Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml b/Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml
index b7fb1188cc..023ba8c08a 100644
--- a/Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml
+++ b/Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml
@@ -22,8 +22,6 @@
Slash: 10
- type: ToolTileCompatible
- type: Tool
- qualities:
- - Prying
- type: Prying
- type: MultipleTool
statusShowBehavior: true
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
index 93d24be5af..fc9e5151e9 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
@@ -2265,17 +2265,10 @@
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.
diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml b/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
index 8c262d23da..9fb0be02ae 100644
--- a/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
+++ b/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
@@ -21,15 +21,10 @@
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
diff --git a/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml b/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml
index c9b37b8b1a..2d584bd233 100644
--- a/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml
+++ b/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml
@@ -91,11 +91,10 @@
- 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
diff --git a/Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml b/Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
index c80e53870e..bd4c7aa7b5 100644
--- a/Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
+++ b/Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
@@ -18,15 +18,15 @@
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:
diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/armblade.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/armblade.yml
index 9e1134195d..49b22c000d 100644
--- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/armblade.yml
+++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/armblade.yml
@@ -18,7 +18,4 @@
- type: Item
size: Normal
sprite: Objects/Weapons/Melee/armblade.rsi
- - type: Tool
- qualities:
- - Prying
- type: Prying
diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml
index ccf45bf59a..4eec90584c 100644
--- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml
+++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml
@@ -62,9 +62,6 @@
- type: Item
size: Ginormous
- type: DisarmMalus
- - type: Tool
- qualities:
- - Prying
- type: Prying
- type: entity
--
2.51.2