Skip to content

Commit

Permalink
tweak: neglecting time when using scrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Sep 3, 2024
1 parent 8068dda commit 6babeb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions Content.Shared/Prying/Components/PryingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public record struct GetPryTimeModifierEvent
public readonly EntityUid User;
public float PryTimeModifier = 1.0f;
public float BaseTime = 5.0f;
public float Neglect = 5f; // WD EDIT

public GetPryTimeModifierEvent(EntityUid user)
{
Expand Down
11 changes: 9 additions & 2 deletions Content.Shared/Prying/Systems/PryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ private bool StartPry(EntityUid target, EntityUid user, EntityUid? tool, float t
var modEv = new GetPryTimeModifierEvent(user);

RaiseLocalEvent(target, ref modEv);
var doAfterArgs = new DoAfterArgs(EntityManager, user, TimeSpan.FromSeconds(modEv.BaseTime * modEv.PryTimeModifier / toolModifier), new DoorPryDoAfterEvent(), target, target, tool)

// WD EDIT START
var time = modEv.BaseTime * modEv.PryTimeModifier / toolModifier;

if (time <= modEv.Neglect)
time = 0;

var doAfterArgs = new DoAfterArgs(EntityManager, user, TimeSpan.FromSeconds(time), new DoorPryDoAfterEvent(), target, target, tool) // WD EDIT END
{
BreakOnDamage = true,
BreakOnUserMove = true,
Expand Down Expand Up @@ -167,7 +174,7 @@ private void OnDoAfter(EntityUid uid, DoorComponent door, DoorPryDoAfterEvent ar
return;
}

if (args.Used != null && comp != null)
if (args.Used != null && comp != null && door.State is not DoorState.Closing and not DoorState.Opening) // WD EDIT
{
_audioSystem.PlayPredicted(comp.UseSound, args.Used.Value, args.User);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed partial class ToolTileCompatibleComponent : Component
/// The time it takes to modify the tile.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Delay = TimeSpan.FromSeconds(1);
public TimeSpan Delay = TimeSpan.FromSeconds(0); // WD EDIT

/// <summary>
/// Whether or not the tile being modified must be unobstructed
Expand Down

0 comments on commit 6babeb4

Please sign in to comment.