Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prying speed & log #29210

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Content.Shared/Prying/Components/PryingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
15 changes: 7 additions & 8 deletions Content.Shared/Prying/Systems/PryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -46,7 +46,7 @@ private void OnDoorAltVerb(EntityUid uid, DoorComponent component, GetVerbsEvent
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()
Expand Down Expand Up @@ -74,7 +74,7 @@ public bool TryPry(EntityUid target, EntityUid user, out DoAfterId? id, EntityUi
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;
Expand Down Expand Up @@ -138,9 +138,10 @@ private bool StartPry(EntityUid target, EntityUid user, EntityUid? tool, float t
{
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)}");
}
Expand All @@ -163,7 +164,7 @@ private void OnDoAfter(EntityUid uid, DoorComponent door, DoorPryDoAfterEvent ar
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;
}

Expand All @@ -178,6 +179,4 @@ private void OnDoAfter(EntityUid uid, DoorComponent door, DoorPryDoAfterEvent ar
}

[Serializable, NetSerializable]
public sealed partial class DoorPryDoAfterEvent : SimpleDoAfterEvent
{
}
public sealed partial class DoorPryDoAfterEvent : SimpleDoAfterEvent;
10 changes: 0 additions & 10 deletions Content.Shared/Tools/Components/ToolForcePoweredComponent.cs

This file was deleted.

11 changes: 2 additions & 9 deletions Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,9 @@ public virtual void SetMultipleTool(EntityUid uid,
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)
Expand Down
6 changes: 4 additions & 2 deletions Content.Shared/Tools/Systems/SharedToolSystem.Tile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ private void OnToolTileComplete(Entity<ToolTileCompatibleComponent> ent, ref Til
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;
}

Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/Entities/Debugging/spanisharmyknife.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
Slash: 10
- type: ToolTileCompatible
- type: Tool
qualities:
- Prying
- type: Prying
- type: MultipleTool
statusShowBehavior: true
Expand Down
13 changes: 3 additions & 10 deletions Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 3 additions & 8 deletions Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions Resources/Prototypes/Entities/Objects/Tools/cowtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
slots:
- Belt
- type: ToolTileCompatible
delay: 0.5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if it's too fast. Let me know if the value needs to be changed or should I keep it default.

- 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:
Expand Down Expand Up @@ -66,9 +66,7 @@
right:
- state: syn_inhand-right
size: Normal
- type: Tool
qualities:
- Prying
- type: Prying
speedModifier: 3.0
- type: MultipleTool
entries:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@
- type: Item
size: Normal
sprite: Objects/Weapons/Melee/armblade.rsi
- type: Tool
qualities:
- Prying
- type: Prying
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@
- type: Item
size: Ginormous
- type: DisarmMalus
- type: Tool
qualities:
- Prying
- type: Prying

- type: entity
Expand Down
Loading