Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

[Port] Advanced Prying #18

Merged
merged 3 commits into from
Sep 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ public async Task CancelTilePry()
{
await SetTile(Floor);
await InteractUsing(Pry, awaitDoAfters: false);

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

await CancelDoAfters();
await AssertTile(Floor);

Expand All @@ -79,6 +88,10 @@ public async Task CancelRepeatedTilePry()
await SetTile(Floor);
await InteractUsing(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 @@ -87,6 +87,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 @@ -134,7 +134,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,
BreakOnMove = true,
Expand Down Expand Up @@ -168,7 +175,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
7 changes: 6 additions & 1 deletion Resources/Locale/en-US/tools/tool-qualities.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ tool-quality-rolling-name = Rolling
tool-quality-rolling-tool-name = Rolling Pin

tool-quality-digging-name = Digging
tool-quality-digging-tool-name = Shovel
tool-quality-digging-tool-name = Shovel

# White Dream
tool-quality-advanced-prying-name = Advanced Prying
tool-quality-advanced-prying-tool-name = Axe
# White Dream
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/_white/tools/tool-qualities.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tool-quality-advanced-prying-name = Продвинутое монтирование
tool-quality-advanced-prying-tool-name = Топор
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- type: Tool
qualities:
- Prying
- AdvancedPrying # White Dream
- type: ToolTileCompatible
- type: Prying
- type: UseDelay
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/Tiles/plating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
sprite: /Textures/Tiles/plating.png
baseTurf: Lattice
isSubfloor: true
deconstructTools: [ AdvancedPrying ] # White Dream
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand All @@ -20,6 +21,7 @@
- 1.0
baseTurf: Lattice
isSubfloor: true
deconstructTools: [ AdvancedPrying ] # White Dream
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand All @@ -31,6 +33,7 @@
sprite: /Textures/Tiles/plating_burnt.png
baseTurf: Lattice
isSubfloor: true
deconstructTools: [ AdvancedPrying ] # White Dream
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/_White/tool_qualities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- type: tool
id: AdvancedPrying
name: tool-quality-advanced-prying-name
toolName: tool-quality-advanced-prying-tool-name
spawn: FireAxe
icon: { sprite: Objects/Weapons/Melee/fireaxe.rsi, state: icon }
Loading