From be7ffd89e2a8f9169e8710e7e639d2d56f1df2df Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 22 Jun 2024 00:15:21 -0400 Subject: [PATCH] AME Deconstruction Changes (#29317) * AME deconstruction complexity * review --------- Co-authored-by: metalgearsloth --- .../Conditions/AmeShieldIntegrity.cs | 43 +++++++++++++++++++ .../Graphs/utilities/ame_shielding.yml | 16 +++++++ 2 files changed, 59 insertions(+) create mode 100644 Content.Server/Construction/Conditions/AmeShieldIntegrity.cs diff --git a/Content.Server/Construction/Conditions/AmeShieldIntegrity.cs b/Content.Server/Construction/Conditions/AmeShieldIntegrity.cs new file mode 100644 index 0000000000..f76fb6d3f7 --- /dev/null +++ b/Content.Server/Construction/Conditions/AmeShieldIntegrity.cs @@ -0,0 +1,43 @@ +using Content.Server.Ame.Components; +using Content.Shared.Construction; +using JetBrains.Annotations; +using Content.Shared.Examine; + +namespace Content.Server.Construction.Conditions; + +[UsedImplicitly] +[DataDefinition] +public sealed partial class AmeShieldIntegrity : IGraphCondition +{ + [DataField] + public float IntegrityThreshold = 80; + + /// + /// If true, checks for the integrity being above the threshold. + /// if false, checks for it being below. + /// + [DataField] + public bool CheckAbove = true; + + public bool Condition(EntityUid uid, IEntityManager entityManager) + { + if (!entityManager.TryGetComponent(uid, out var shield)) + return true; + + if (CheckAbove) + { + return shield.CoreIntegrity >= IntegrityThreshold; + } + return shield.CoreIntegrity < IntegrityThreshold; + } + + public bool DoExamine(ExaminedEvent args) + { + return false; + } + + public IEnumerable GenerateGuideEntry() + { + yield return new ConstructionGuideEntry(); + } +} diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/ame_shielding.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/ame_shielding.yml index cf2bf9aaf7..bec98e7310 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/ame_shielding.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/ame_shielding.yml @@ -3,11 +3,14 @@ start: start graph: - node: start + - node: startBroken - node: ameShielding entity: AmeShielding edges: - to: start + conditions: + - !type:AmeShieldIntegrity completed: - !type:AdminLog # I don't like logging it like this. The log should include the user, AMEShielding EntityID, and AMEPart EntityID, and there should also be a start of attempt log. message: "An AME shielding was deconstructed" @@ -18,3 +21,16 @@ steps: - tool: Welding doAfter: 3 + + - to: startBroken + conditions: + - !type:AmeShieldIntegrity + checkAbove: false + completed: + - !type:SpawnPrototype + prototype: SheetSteel1 + amount: 5 + - !type:DeleteEntity + steps: + - tool: Welding + doAfter: 3 -- 2.51.2