From fd6e792ad54a8daa6a5e9937d424c96191c4e1ca Mon Sep 17 00:00:00 2001 From: PuroSlavKing <103608145+PuroSlavKing@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:03:49 +0300 Subject: [PATCH] [Port] Advanced Prying (#18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Port] Advanced Prying (#31) * balance: Less rcds, more axe functions (#132) * Revert "Adds RCD and RCD ammo to all engineer lockers. (#22688)" This reverts commit 4e94a2727d63bd5e880929bf57b74726c4d8edd4. * add: Axe can pry platings. Again. * fix: RCD in CE locker * Make Axe great again --------- Co-authored-by: Nair Sark <26607408+NairSark@users.noreply.github.com> * [Tweak] Prying / Вскрытие (#43) * tweak: neglecting time when using scrap * fix * fix * fix * fixik --------- Co-authored-by: RedBurningPhoenix <147742474+RedBurningPhoenix@users.noreply.github.com> Co-authored-by: Nair Sark <26607408+NairSark@users.noreply.github.com> Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com> --- .../Tests/DoAfter/DoAfterCancellationTests.cs | 13 +++++++++++++ Content.Shared/Prying/Components/PryingComponent.cs | 1 + Content.Shared/Prying/Systems/PryingSystem.cs | 11 +++++++++-- .../Tools/Components/ToolTileCompatibleComponent.cs | 2 +- Resources/Locale/en-US/tools/tool-qualities.ftl | 7 ++++++- .../Locale/ru-RU/_white/tools/tool-qualities.ftl | 2 ++ .../Entities/Objects/Weapons/Melee/fireaxe.yml | 1 + Resources/Prototypes/Tiles/plating.yml | 3 +++ Resources/Prototypes/_White/tool_qualities.yml | 6 ++++++ 9 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 Resources/Locale/ru-RU/_white/tools/tool-qualities.ftl create mode 100644 Resources/Prototypes/_White/tool_qualities.yml diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs index 1aaf4a5184..8ced77cf28 100644 --- a/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs +++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs @@ -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); @@ -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); diff --git a/Content.Shared/Prying/Components/PryingComponent.cs b/Content.Shared/Prying/Components/PryingComponent.cs index 93713e52c6..021b5ebeb9 100644 --- a/Content.Shared/Prying/Components/PryingComponent.cs +++ b/Content.Shared/Prying/Components/PryingComponent.cs @@ -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) { diff --git a/Content.Shared/Prying/Systems/PryingSystem.cs b/Content.Shared/Prying/Systems/PryingSystem.cs index 10c80cfab5..9b99ec0ed6 100644 --- a/Content.Shared/Prying/Systems/PryingSystem.cs +++ b/Content.Shared/Prying/Systems/PryingSystem.cs @@ -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, @@ -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); } diff --git a/Content.Shared/Tools/Components/ToolTileCompatibleComponent.cs b/Content.Shared/Tools/Components/ToolTileCompatibleComponent.cs index 57058a5781..d325c9dd15 100644 --- a/Content.Shared/Tools/Components/ToolTileCompatibleComponent.cs +++ b/Content.Shared/Tools/Components/ToolTileCompatibleComponent.cs @@ -18,7 +18,7 @@ public sealed partial class ToolTileCompatibleComponent : Component /// The time it takes to modify the tile. /// [DataField, ViewVariables(VVAccess.ReadWrite)] - public TimeSpan Delay = TimeSpan.FromSeconds(1); + public TimeSpan Delay = TimeSpan.FromSeconds(0); // WD EDIT /// /// Whether or not the tile being modified must be unobstructed diff --git a/Resources/Locale/en-US/tools/tool-qualities.ftl b/Resources/Locale/en-US/tools/tool-qualities.ftl index 14e42390a7..f18e97c61d 100644 --- a/Resources/Locale/en-US/tools/tool-qualities.ftl +++ b/Resources/Locale/en-US/tools/tool-qualities.ftl @@ -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 \ No newline at end of file +tool-quality-digging-tool-name = Shovel + +# White Dream +tool-quality-advanced-prying-name = Advanced Prying +tool-quality-advanced-prying-tool-name = Axe +# White Dream diff --git a/Resources/Locale/ru-RU/_white/tools/tool-qualities.ftl b/Resources/Locale/ru-RU/_white/tools/tool-qualities.ftl new file mode 100644 index 0000000000..f0925d4499 --- /dev/null +++ b/Resources/Locale/ru-RU/_white/tools/tool-qualities.ftl @@ -0,0 +1,2 @@ +tool-quality-advanced-prying-name = Продвинутое монтирование +tool-quality-advanced-prying-tool-name = Топор diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/fireaxe.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/fireaxe.yml index de75ae4be4..aa241929e0 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/fireaxe.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/fireaxe.yml @@ -41,6 +41,7 @@ - type: Tool qualities: - Prying + - AdvancedPrying # White Dream - type: ToolTileCompatible - type: Prying - type: UseDelay diff --git a/Resources/Prototypes/Tiles/plating.yml b/Resources/Prototypes/Tiles/plating.yml index 7edb1ae784..d5997515ff 100644 --- a/Resources/Prototypes/Tiles/plating.yml +++ b/Resources/Prototypes/Tiles/plating.yml @@ -4,6 +4,7 @@ sprite: /Textures/Tiles/plating.png baseTurf: Lattice isSubfloor: true + deconstructTools: [ AdvancedPrying ] # White Dream footstepSounds: collection: FootstepPlating friction: 0.3 @@ -20,6 +21,7 @@ - 1.0 baseTurf: Lattice isSubfloor: true + deconstructTools: [ AdvancedPrying ] # White Dream footstepSounds: collection: FootstepPlating friction: 0.3 @@ -31,6 +33,7 @@ sprite: /Textures/Tiles/plating_burnt.png baseTurf: Lattice isSubfloor: true + deconstructTools: [ AdvancedPrying ] # White Dream footstepSounds: collection: FootstepPlating friction: 0.3 diff --git a/Resources/Prototypes/_White/tool_qualities.yml b/Resources/Prototypes/_White/tool_qualities.yml new file mode 100644 index 0000000000..8bf9d2263f --- /dev/null +++ b/Resources/Prototypes/_White/tool_qualities.yml @@ -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 }