]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
AME Deconstruction Changes (#29317)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sat, 22 Jun 2024 04:15:21 +0000 (00:15 -0400)
committerGitHub <noreply@github.com>
Sat, 22 Jun 2024 04:15:21 +0000 (14:15 +1000)
* AME deconstruction complexity

* review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Content.Server/Construction/Conditions/AmeShieldIntegrity.cs [new file with mode: 0644]
Resources/Prototypes/Recipes/Construction/Graphs/utilities/ame_shielding.yml

diff --git a/Content.Server/Construction/Conditions/AmeShieldIntegrity.cs b/Content.Server/Construction/Conditions/AmeShieldIntegrity.cs
new file mode 100644 (file)
index 0000000..f76fb6d
--- /dev/null
@@ -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;
+
+    /// <summary>
+    /// If true, checks for the integrity being above the threshold.
+    /// if false, checks for it being below.
+    /// </summary>
+    [DataField]
+    public bool CheckAbove = true;
+
+    public bool Condition(EntityUid uid, IEntityManager entityManager)
+    {
+        if (!entityManager.TryGetComponent<AmeShieldComponent>(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<ConstructionGuideEntry> GenerateGuideEntry()
+    {
+        yield return new ConstructionGuideEntry();
+    }
+}
index cf2bf9aaf7f04c5263ff7983df2f69fdfe132f93..bec98e7310db46039ce4d4c1605f916fa86179ee 100644 (file)
@@ -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"
           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