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

[Port] Advanced Prying #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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);

// CORVAX-NEXT START
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// CORVAX-NEXT START
// Corvax-Next-AdvancedPrying-Start

if (!ActiveDoAfters.Any())
{
await AssertTile(Plating);
return;
}
// CORVAX-NEXT 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()) // CORVAX-NEXT
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; // CORVAX-NEXT

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)

// CORVAX-NEXT 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) // CORVAX-NEXT 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) // CORVAX-NEXT-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); // CORVAX-NEXT-EDIT

/// <summary>
/// Whether or not the tile being modified must be unobstructed
Expand Down
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_corvaxnext/tools/tool-qualities.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tool-quality-advanced-prying-name = Advanced Prying
tool-quality-advanced-prying-tool-name = Axe
2 changes: 1 addition & 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,4 @@ 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
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/_corvaxnext/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 # Corvax-Next-AdvancedPrying
- 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 ] # Corvax-Next-AdvancedPrying
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand All @@ -20,6 +21,7 @@
- 1.0
baseTurf: Lattice
isSubfloor: true
deconstructTools: [ AdvancedPrying ] # Corvax-Next-AdvancedPrying
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand All @@ -31,6 +33,7 @@
sprite: /Textures/Tiles/plating_burnt.png
baseTurf: Lattice
isSubfloor: true
deconstructTools: [ AdvancedPrying ] # Corvax-Next-AdvancedPrying
footstepSounds:
collection: FootstepPlating
friction: 0.3
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/_CorvaxNext/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