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>
|
/// <summary>
|
||||||
/// Whether the entity can pry open powered doors
|
/// Whether the entity can pry open powered doors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("pryPowered")]
|
[DataField]
|
||||||
public bool PryPowered = false;
|
public bool PryPowered;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the tool can bypass certain restrictions when prying.
|
/// Whether the tool can bypass certain restrictions when prying.
|
||||||
/// For example door bolts.
|
/// For example door bolts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("force")]
|
[DataField]
|
||||||
public bool Force = false;
|
public bool Force;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifier on the prying time.
|
/// Modifier on the prying time.
|
||||||
/// Lower values result in more time.
|
/// Lower values result in more time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("speedModifier")]
|
[DataField]
|
||||||
public float SpeedModifier = 1.0f;
|
public float SpeedModifier = 1.0f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// What sound to play when prying is finished.
|
/// What sound to play when prying is finished.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("useSound")]
|
[DataField]
|
||||||
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
|
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the entity can currently pry things.
|
/// Whether the entity can currently pry things.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("enabled")]
|
[DataField]
|
||||||
public bool Enabled = true;
|
public bool Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public sealed class PryingSystem : EntitySystem
|
|||||||
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
|
||||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem Popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ public sealed class PryingSystem : EntitySystem
|
|||||||
if (!args.CanInteract || !args.CanAccess)
|
if (!args.CanInteract || !args.CanAccess)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<PryingComponent>(args.User, out var tool))
|
if (!TryComp<PryingComponent>(args.User, out _))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.Verbs.Add(new AlternativeVerb()
|
args.Verbs.Add(new AlternativeVerb()
|
||||||
@@ -74,7 +74,7 @@ public sealed class PryingSystem : EntitySystem
|
|||||||
if (!CanPry(target, user, out var message, comp))
|
if (!CanPry(target, user, out var message, comp))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(message))
|
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
|
// If we have reached this point we want the event that caused this
|
||||||
// to be marked as handled.
|
// to be marked as handled.
|
||||||
return true;
|
return true;
|
||||||
@@ -138,9 +138,10 @@ public sealed class PryingSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
BreakOnDamage = true,
|
BreakOnDamage = true,
|
||||||
BreakOnMove = 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)}");
|
_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 (!CanPry(uid, args.User, out var message, comp))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(message))
|
if (!string.IsNullOrWhiteSpace(message))
|
||||||
Popup.PopupClient(Loc.GetString(message), uid, args.User);
|
_popup.PopupClient(Loc.GetString(message), uid, args.User);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +179,4 @@ public sealed class PryingSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[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;
|
tool.Qualities = current.Behavior;
|
||||||
|
|
||||||
// TODO: Replace this with a better solution later
|
// 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"))
|
pryComp.Enabled = current.Behavior.Contains("Prying");
|
||||||
{
|
|
||||||
pcomp.Enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pcomp.Enabled = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playSound && current.ChangeSound != null)
|
if (playSound && current.ChangeSound != null)
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ public abstract partial class SharedToolSystem
|
|||||||
if (!TryDeconstructWithToolQualities(tileRef, tool.Qualities))
|
if (!TryDeconstructWithToolQualities(tileRef, tool.Qualities))
|
||||||
return;
|
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}");
|
$"{ToPrettyString(args.User):player} used {ToPrettyString(ent)} to edit the tile at {coords}");
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
Slash: 10
|
Slash: 10
|
||||||
- type: ToolTileCompatible
|
- type: ToolTileCompatible
|
||||||
- type: Tool
|
- type: Tool
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
- type: Prying
|
- type: Prying
|
||||||
- type: MultipleTool
|
- type: MultipleTool
|
||||||
statusShowBehavior: true
|
statusShowBehavior: true
|
||||||
|
|||||||
@@ -2265,17 +2265,10 @@
|
|||||||
tags:
|
tags:
|
||||||
- DoorBumpOpener
|
- DoorBumpOpener
|
||||||
- FootstepSound
|
- FootstepSound
|
||||||
- type: Tool # Open door from xeno.yml.
|
- type: Prying # Open door from xeno.yml.
|
||||||
|
pryPowered: true
|
||||||
|
force: true
|
||||||
speedModifier: 1.5
|
speedModifier: 1.5
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
useSound:
|
|
||||||
path: /Audio/Items/crowbar.ogg
|
|
||||||
- type: Prying
|
|
||||||
pryPowered: !type:Bool
|
|
||||||
true
|
|
||||||
force: !type:Bool
|
|
||||||
true
|
|
||||||
useSound:
|
useSound:
|
||||||
path: /Audio/Items/crowbar.ogg
|
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.
|
- 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
|
true
|
||||||
NavSmash: !type:Bool
|
NavSmash: !type:Bool
|
||||||
true
|
true
|
||||||
- type: Tool
|
|
||||||
speedModifier: 1.5
|
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
- type: Prying
|
- type: Prying
|
||||||
pryPowered: !type:Bool
|
pryPowered: true
|
||||||
true
|
force: true
|
||||||
force: !type:Bool
|
speedModifier: 1.5
|
||||||
true
|
|
||||||
useSound:
|
useSound:
|
||||||
path: /Audio/Items/crowbar.ogg
|
path: /Audio/Items/crowbar.ogg
|
||||||
- type: Reactive
|
- type: Reactive
|
||||||
|
|||||||
@@ -91,11 +91,10 @@
|
|||||||
- type: Tool
|
- type: Tool
|
||||||
qualities:
|
qualities:
|
||||||
- Prying
|
- Prying
|
||||||
useSound:
|
|
||||||
path: /Audio/Items/crowbar.ogg
|
|
||||||
speedModifier: 0.05
|
|
||||||
- type: ToolTileCompatible
|
- type: ToolTileCompatible
|
||||||
|
delay: 10
|
||||||
- type: Prying
|
- type: Prying
|
||||||
|
speedModifier: 0.05
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: mooltitool
|
name: mooltitool
|
||||||
|
|||||||
@@ -18,15 +18,15 @@
|
|||||||
slots:
|
slots:
|
||||||
- Belt
|
- Belt
|
||||||
- type: ToolTileCompatible
|
- type: ToolTileCompatible
|
||||||
|
delay: 0.5
|
||||||
- type: Tool
|
- type: Tool
|
||||||
qualities:
|
qualities:
|
||||||
- Prying
|
- Prying
|
||||||
speedModifier: 1.5
|
|
||||||
useSound: /Audio/Items/jaws_pry.ogg
|
useSound: /Audio/Items/jaws_pry.ogg
|
||||||
- type: Prying
|
- type: Prying
|
||||||
|
speedModifier: 1.5
|
||||||
pryPowered: true
|
pryPowered: true
|
||||||
useSound: /Audio/Items/jaws_pry.ogg
|
useSound: /Audio/Items/jaws_pry.ogg
|
||||||
- type: ToolForcePowered
|
|
||||||
- type: MultipleTool
|
- type: MultipleTool
|
||||||
statusShowBehavior: true
|
statusShowBehavior: true
|
||||||
entries:
|
entries:
|
||||||
@@ -66,9 +66,7 @@
|
|||||||
right:
|
right:
|
||||||
- state: syn_inhand-right
|
- state: syn_inhand-right
|
||||||
size: Normal
|
size: Normal
|
||||||
- type: Tool
|
- type: Prying
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
speedModifier: 3.0
|
speedModifier: 3.0
|
||||||
- type: MultipleTool
|
- type: MultipleTool
|
||||||
entries:
|
entries:
|
||||||
|
|||||||
@@ -18,7 +18,4 @@
|
|||||||
- type: Item
|
- type: Item
|
||||||
size: Normal
|
size: Normal
|
||||||
sprite: Objects/Weapons/Melee/armblade.rsi
|
sprite: Objects/Weapons/Melee/armblade.rsi
|
||||||
- type: Tool
|
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
- type: Prying
|
- type: Prying
|
||||||
|
|||||||
@@ -62,9 +62,6 @@
|
|||||||
- type: Item
|
- type: Item
|
||||||
size: Ginormous
|
size: Ginormous
|
||||||
- type: DisarmMalus
|
- type: DisarmMalus
|
||||||
- type: Tool
|
|
||||||
qualities:
|
|
||||||
- Prying
|
|
||||||
- type: Prying
|
- type: Prying
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user