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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -53,7 +53,9 @@ public abstract partial class SharedToolSystem
|
||||
if (!TryDeconstructWithToolQualities(tileRef, tool.Qualities))
|
||||
return;
|
||||
|
||||
AdminLogger.Add(LogType.LatticeCut, LogImpact.Medium,
|
||||
AdminLogger.Add(
|
||||
LogType.LatticeCut,
|
||||
LogImpact.Medium,
|
||||
$"{ToPrettyString(args.User):player} used {ToPrettyString(ent)} to edit the tile at {coords}");
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
Slash: 10
|
||||
- type: ToolTileCompatible
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Prying
|
||||
- type: Prying
|
||||
- type: MultipleTool
|
||||
statusShowBehavior: true
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -18,7 +18,4 @@
|
||||
- type: Item
|
||||
size: Normal
|
||||
sprite: Objects/Weapons/Melee/armblade.rsi
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Prying
|
||||
- type: Prying
|
||||
|
||||
@@ -62,9 +62,6 @@
|
||||
- type: Item
|
||||
size: Ginormous
|
||||
- type: DisarmMalus
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Prying
|
||||
- type: Prying
|
||||
|
||||
- type: entity
|
||||
|
||||
Reference in New Issue
Block a user