Skip to content

Commit

Permalink
[Tweak] Prying / Вскрытие (#43)
Browse files Browse the repository at this point in the history
* tweak: neglecting time when using scrap

* fix

* fix

* fix
  • Loading branch information
Spatison authored Sep 5, 2024
1 parent f815317 commit c039865
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
13 changes: 13 additions & 0 deletions Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ public async Task CancelTilePry()
{
await SetTile(Floor);
await Interact(Pry, awaitDoAfters: false);

// WD EDIT START
if (!ActiveDoAfters.Any())
{
await AssertTile(Plating);
return;
}
// WD EDIT END

await CancelDoAfters();
await AssertTile(Floor);

Expand All @@ -82,6 +91,10 @@ public async Task CancelRepeatedTilePry()
await SetTile(Floor);
await Interact(Pry, awaitDoAfters: false);
await RunTicks(1);

if (!ActiveDoAfters.Any()) // WD EDIT
return;

Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
await AssertTile(Floor);

Expand Down
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
2 changes: 1 addition & 1 deletion Resources/Locale/ru-RU/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chat-manager-entity-whisper-unknown-wrap-message = [font size=11][italic][Bubble
chat-manager-entity-me-wrap-message = { $entityName } { $message }
chat-manager-entity-looc-wrap-message = LOOC: [bold]{$entityName}:[/bold] {$message}
chat-manager-send-ooc-wrap-message = OOC: [bold]{$playerName}{$rep}:[/bold] {$message}
chat-manager-send-ooc-wrap-message = OOC: [bold]{$playerName}:[/bold] {$message}
chat-manager-send-ooc-patron-wrap-message = OOC: [bold][color={$patronColor}]{$playerName}[/color]{$rep}:[/bold] {$message}
chat-manager-send-dead-chat-wrap-message = {$deadChannelName}: [bold][BubbleHeader]{$playerName}[/BubbleHeader]:[/bold] [BubbleContent]{$message}[/BubbleContent]
Expand Down

0 comments on commit c039865

Please sign in to comment.