Skip to content

Commit

Permalink
[Port] Advanced Prying (space-syndicate#18) (space-syndicate#760)
Browse files Browse the repository at this point in the history
* [Port] Advanced Prying (space-syndicate#31)

* balance: Less rcds, more axe functions (space-syndicate#132)

* Revert "Adds RCD and RCD ammo to all engineer lockers. (#22688)"

This reverts commit 4e94a27.

* add: Axe can pry platings. Again.

* fix: RCD in CE locker

* Make Axe great again

---------



* [Tweak] Prying / Вскрытие (space-syndicate#43)

* tweak: neglecting time when using scrap

* fix

* fix

* fix

* fixik

---------

Co-authored-by: RedBurningPhoenix <[email protected]>
Co-authored-by: Nair Sark <[email protected]>
Co-authored-by: Spatison <[email protected]>
  • Loading branch information
4 people committed Nov 25, 2024
1 parent dd0017f commit d31fa54
Show file tree
Hide file tree
Showing 9 changed files with 42 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 @@ -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 }

0 comments on commit d31fa54

Please sign in to comment.