]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Makes defib cabinets constructable and deconstructable (#42571)
authorMinerva <218184747+mnva0@users.noreply.github.com>
Thu, 22 Jan 2026 18:27:45 +0000 (13:27 -0500)
committerGitHub <noreply@github.com>
Thu, 22 Jan 2026 18:27:45 +0000 (18:27 +0000)
* Makes defib cabinets constructable and deconstructable

* fix crash on master

---------

Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
Content.Client/Construction/ConstructionSystem.cs
Resources/Prototypes/Entities/Structures/Wallmounts/Storage/Cabinets/defib_cabinet.yml
Resources/Prototypes/Recipes/Crafting/Graphs/storage/defib_cabinet.yml [new file with mode: 0644]
Resources/Prototypes/Recipes/Crafting/defib_cabinet.yml [new file with mode: 0644]

index d693f4ac47c5292e3c8f9ab9b29f23674a237bce..9900f860c370818d06ec903c2b7e408f1a47546a 100644 (file)
@@ -306,6 +306,7 @@ namespace Content.Client.Construction
                 var targetSprite = EnsureComp<SpriteComponent>(dummy);
                 EntityManager.System<AppearanceSystem>().OnChangeData(dummy, targetSprite);
 
+                var addedIndex = 0;
                 for (var i = 0; i < targetSprite.AllLayers.Count(); i++)
                 {
                     if (!targetSprite[i].Visible || !targetSprite[i].RsiState.IsValid)
@@ -316,10 +317,11 @@ namespace Content.Client.Construction
                         state.StateId.Name is null)
                         continue;
 
-                    _sprite.AddBlankLayer((ghost.Value, sprite), i);
-                    _sprite.LayerSetSprite((ghost.Value, sprite), i, new SpriteSpecifier.Rsi(rsi.Path, state.StateId.Name));
-                    sprite.LayerSetShader(i, "unshaded");
-                    _sprite.LayerSetVisible((ghost.Value, sprite), i, true);
+                    _sprite.AddBlankLayer((ghost.Value, sprite), addedIndex);
+                    _sprite.LayerSetSprite((ghost.Value, sprite), addedIndex, new SpriteSpecifier.Rsi(rsi.Path, state.StateId.Name));
+                    sprite.LayerSetShader(addedIndex, "unshaded");
+                    _sprite.LayerSetVisible((ghost.Value, sprite), addedIndex, true);
+                    addedIndex++;
                 }
 
                 Del(dummy);
index 0ca51b5c78e9f6a6d17ec42c945e8a9814fa0592..66528890a885956f09d15df28787b37ff333cfb2 100644 (file)
@@ -24,6 +24,9 @@
         whitelist:
           components:
           - Defibrillator
+  - type: Construction
+    graph: DefibrillatorCabinet
+    node: done
   - type: Destructible
     thresholds:
     - trigger: !type:DamageTrigger
diff --git a/Resources/Prototypes/Recipes/Crafting/Graphs/storage/defib_cabinet.yml b/Resources/Prototypes/Recipes/Crafting/Graphs/storage/defib_cabinet.yml
new file mode 100644 (file)
index 0000000..9e774d5
--- /dev/null
@@ -0,0 +1,27 @@
+- type: constructionGraph
+  id: DefibrillatorCabinet
+  start: start
+  graph:
+  - node: start
+    edges:
+    - to: done
+      steps:
+      - material: Steel
+        amount: 2
+        doAfter: 5
+  - node: done
+    entity: DefibrillatorCabinet
+    edges:
+    - to: start
+      steps:
+      - tool: Screwing
+        doAfter: 5
+      conditions:
+      - !type:ContainerEmpty
+        container: "ItemCabinet"
+      completed:
+      - !type:SpawnPrototype
+        prototype: SheetSteel1
+        amount: 2
+      - !type:EmptyAllContainers
+      - !type:DeleteEntity
diff --git a/Resources/Prototypes/Recipes/Crafting/defib_cabinet.yml b/Resources/Prototypes/Recipes/Crafting/defib_cabinet.yml
new file mode 100644 (file)
index 0000000..042a796
--- /dev/null
@@ -0,0 +1,12 @@
+- type: construction
+  id: DefibrillatorCabinet
+  graph: DefibrillatorCabinet
+  startNode: start
+  targetNode: done
+  category: construction-category-storage
+  objectType: Structure
+  placementMode: SnapgridCenter
+  canRotate: true
+  canBuildInImpassable: true
+  conditions:
+  - !type:WallmountCondition