]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Sentry turrets - Part 7: Electronics and construction graphs (#35236)
authorchromiumboy <50505512+chromiumboy@users.noreply.github.com>
Fri, 29 Aug 2025 12:10:47 +0000 (07:10 -0500)
committerGitHub <noreply@github.com>
Fri, 29 Aug 2025 12:10:47 +0000 (14:10 +0200)
* Initial commit

* Fixing merge conflict

* Updated for deployment

* Whitespace fixes

* Linter fixes

* Test fail fix

* Fixed test failure

* Add separate command circuitboards

* Addressed review comments

Content.Shared/Construction/Components/ElectronicsBoardComponent.cs [new file with mode: 0644]
Content.Shared/Construction/NodeEntities/BoardNodeEntity.cs
Resources/Locale/en-US/recipes/tags.ftl
Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/turrets.yml
Resources/Prototypes/Entities/Objects/Devices/Electronics/turret_controls.yml [new file with mode: 0644]
Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_energy.yml
Resources/Prototypes/Entities/Structures/Wallmounts/turret_controls.yml
Resources/Prototypes/Recipes/Construction/Graphs/utilities/turret_controls.yml [new file with mode: 0644]
Resources/Prototypes/Recipes/Construction/utilities.yml

diff --git a/Content.Shared/Construction/Components/ElectronicsBoardComponent.cs b/Content.Shared/Construction/Components/ElectronicsBoardComponent.cs
new file mode 100644 (file)
index 0000000..734edfb
--- /dev/null
@@ -0,0 +1,16 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Construction.Components;
+
+/// <summary>
+/// Used in construction graphs for building wall-mounted electronic devices.
+/// </summary>
+[RegisterComponent]
+public sealed partial class ElectronicsBoardComponent : Component
+{
+    /// <summary>
+    /// The device that is produced when the construction is completed.
+    /// </summary>
+    [DataField(required: true)]
+    public EntProtoId Prototype;
+}
index c1540c4a64651a5091343426551f7988963f2cf1..be55c6f733036c6f06e4fe688af93643e936254e 100644 (file)
@@ -12,7 +12,8 @@ namespace Content.Shared.Construction.NodeEntities;
 [DataDefinition]
 public sealed partial class BoardNodeEntity : IGraphNodeEntity
 {
-    [DataField("container")] public string Container { get; private set; } = string.Empty;
+    [DataField]
+    public string Container { get; private set; } = string.Empty;
 
     public string? GetId(EntityUid? uid, EntityUid? userUid, GraphNodeEntityArgs args)
     {
@@ -27,13 +28,16 @@ public sealed partial class BoardNodeEntity : IGraphNodeEntity
 
         var board = container.ContainedEntities[0];
 
-        // There should not be a case where both of these components exist on the same entity...
+        // There should not be a case where more than one of these components exist on the same entity
         if (args.EntityManager.TryGetComponent(board, out MachineBoardComponent? machine))
             return machine.Prototype;
 
         if (args.EntityManager.TryGetComponent(board, out ComputerBoardComponent? computer))
             return computer.Prototype;
 
+        if (args.EntityManager.TryGetComponent(board, out ElectronicsBoardComponent? electronics))
+            return electronics.Prototype;
+
         return null;
     }
 }
index 39d39e7f0ccfa1bc5fd05a502d807292105179ad..34eadc37d85ab46772d008e40839b2b20fb1b911 100644 (file)
@@ -125,6 +125,7 @@ construction-graph-tag-wallmount-substation-circuit-board = wallmount substation
 construction-graph-tag-surveillance-camera-monitor-board = surveillance camera monitor board
 construction-graph-tag-television-board = television board
 construction-graph-tag-freezer-electronics = freezer electronics
+construction-graph-tag-turret-control-electronics = sentry turret control panel electronics
 
 # crystals
 construction-graph-tag-cyan-crystal-shard = cyan crystal shard
index d9d8a848c38959da1a0f432434ac1bcb298df434..d9bb8611715970a7e09dd0377efd15bdb49358e9 100644 (file)
@@ -31,7 +31,7 @@
   components:
   - type: Sprite
     sprite: Objects/Misc/module.rsi
-    state: command
+    state: science
   - type: MachineBoard
     prototype: WeaponEnergyTurretAI
 
     state: security
   - type: MachineBoard
     prototype: WeaponEnergyTurretSecurity
+    
+- type: entity
+  parent: WeaponEnergyTurretStationMachineCircuitboardBase
+  id: WeaponEnergyTurretCommandMachineCircuitboard
+  suffix: Command
+  components:
+  - type: Sprite
+    sprite: Objects/Misc/module.rsi
+    state: command
+  - type: MachineBoard
+    prototype: WeaponEnergyTurretCommand
 
diff --git a/Resources/Prototypes/Entities/Objects/Devices/Electronics/turret_controls.yml b/Resources/Prototypes/Entities/Objects/Devices/Electronics/turret_controls.yml
new file mode 100644 (file)
index 0000000..ced73dd
--- /dev/null
@@ -0,0 +1,43 @@
+- type: entity
+  abstract: true
+  parent: BaseElectronics
+  id: WeaponEnergyTurretStationControlPanelElectronicsBase 
+  name: sentry turret control panel electronics
+  description: An electronics board used in a sentry turret control panel.
+  components:
+  - type: Sprite
+    sprite: Objects/Misc/module.rsi
+    state: security
+  - type: ElectronicsBoard
+    prototype: WeaponEnergyTurretSecurityControlPanel
+  - type: Tag
+    tags:
+    - TurretControlElectronics
+
+- type: entity
+  parent: WeaponEnergyTurretStationControlPanelElectronicsBase
+  id: WeaponEnergyTurretSecurityControlPanelElectronics
+  suffix: Security
+
+- type: entity
+  parent: WeaponEnergyTurretStationControlPanelElectronicsBase
+  id: WeaponEnergyTurretAIControlPanelElectronics
+  suffix: AI, Silicon
+  components:
+  - type: Sprite
+    sprite: Objects/Misc/module.rsi
+    state: science
+  - type: ElectronicsBoard
+    prototype: WeaponEnergyTurretAIControlPanel
+    
+- type: entity
+  parent: WeaponEnergyTurretStationControlPanelElectronicsBase
+  id: WeaponEnergyTurretCommandControlPanelElectronics
+  suffix: Command
+  components:
+  - type: Sprite
+    sprite: Objects/Misc/module.rsi
+    state: command
+  - type: ElectronicsBoard
+    prototype: WeaponEnergyTurretCommandControlPanel
+
index 1fe926294c96a393d21e288f15d9017f99b3223e..33d5fd6e970a52fcdf36f092ab1a8a76c0323be1 100644 (file)
     - Borg
     - BasicSilicon
   - type: Machine
-    board: WeaponEnergyTurretSecurityMachineCircuitboard
+    board: WeaponEnergyTurretCommandMachineCircuitboard
   - type: DeviceNetwork
     receiveFrequencyId: TurretControl
     transmitFrequencyId: Turret
index e65530509b55559145a42e572597f7f810ce96e9..651a5fe10af986b079b062c122e7af8c93c53d05 100644 (file)
@@ -24,8 +24,8 @@
           collection: MetalGlassBreak
           params:
             volume: -4
-      #- !type:ChangeConstructionNodeBehavior - To be added in a later PR
-      #  node: machineFrame
+      - !type:ChangeConstructionNodeBehavior
+        node: machineFrame
       - !type:DoActsBehavior
         acts: [ "Destruction" ]
   - type: Transform
   - type: ContainerContainer
     containers:
       board: !type:Container
-  #- type: Construction - To be added in a later PR
-  #  graph: WeaponEnergyTurretControlPanel
-  #  node: frame
+  - type: Construction
+    graph: WeaponEnergyTurretControlPanel
+    node: frame
+    containers:
+    - board
   placement:
     mode: SnapgridCenter
     snap:
   - type: Electrified
     enabled: false
     usesApcPower: true
-  #- type: ContainerFill - Will be added in a later PR
-  #  containers:
-  #    board:
-  #    - WeaponEnergyTurretStationControlPanelElectronics
-  #- type: Construction - Will be added in a later PR
-  #  graph: WeaponEnergyTurretControlPanel
-  #  node: finish
+  - type: ContainerFill
+    containers:
+      board:
+      - WeaponEnergyTurretStationControlPanelElectronics
+  - type: Construction
+    graph: WeaponEnergyTurretControlPanel
+    node: finish
 
 - type: entity
   parent: WeaponEnergyTurretStationControlPanelBase
   components:
   - type: AccessReader
     access: [["StationAi"], ["ResearchDirector"]]
-  #- type: ContainerFill - Will be added in a later PR
-  #  containers:
-  #    board:
-  #    - WeaponEnergyTurretAIControlPanelElectronics
+  - type: ContainerFill
+    containers:
+      board:
+      - WeaponEnergyTurretAIControlPanelElectronics
   - type: DeviceNetwork
     receiveFrequencyId: TurretAI
     transmitFrequencyId: TurretControlAI
   components:
   - type: AccessReader
     access: [["StationAi"], ["Security"]]
-  #- type: ContainerFill - Will be added in a later PR
-  #  containers:
-  #    board:
-  #    - WeaponEnergyTurretSecurityControlPanelElectronics
+  - type: ContainerFill
+    containers:
+      board:
+      - WeaponEnergyTurretSecurityControlPanelElectronics
   - type: TurretTargetSettings
     exemptAccessLevels:
     - Security
   components:
   - type: AccessReader
     access: [["StationAi"], ["Command"]]
-  #- type: ContainerFill - Will be added in a later PR
-  #  containers:
-  #    board:
-  #    - WeaponEnergyTurretCommandControlPanelElectronics
+  - type: ContainerFill
+    containers:
+      board:
+      - WeaponEnergyTurretCommandControlPanelElectronics
   - type: TurretTargetSettings
     exemptAccessLevels:
     - Command
diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/turret_controls.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/turret_controls.yml
new file mode 100644 (file)
index 0000000..ae48638
--- /dev/null
@@ -0,0 +1,85 @@
+- type: constructionGraph
+  id: WeaponEnergyTurretControlPanel
+  start: start
+  graph:
+  - node: start
+    edges:
+    - to: frame
+      steps:
+      - material: Steel
+        amount: 3
+        doAfter: 2
+
+  - node: frame
+    entity: WeaponEnergyTurretControlPanelFrame
+    edges:
+    - to: board
+      steps:
+      - tag: TurretControlElectronics
+        name: construction-graph-tag-turret-control-electronics
+        icon:
+          sprite: Objects/Misc/module.rsi
+          state: command
+        store: board
+
+    - to: start
+      completed:
+      - !type:GivePrototype
+        prototype: SheetSteel1
+        amount: 3
+      - !type:DeleteEntity {}
+      steps:
+      - tool: Screwing
+        doAfter: 4
+
+  - node: board
+    entity: WeaponEnergyTurretControlPanelFrame
+    edges:
+    - to: glass
+      steps:
+      - material: Glass
+        amount: 1
+        doAfter: 1
+
+    - to: frame
+      completed:
+      - !type:EmptyContainer
+        container: board
+        pickup: true
+      steps:
+      - tool: Prying
+        doAfter: 4
+
+  - node: glass
+    edges:
+    - to: finish
+      steps:
+      - tool: Screwing
+        doAfter: 2
+
+    - to: board
+      completed:
+      - !type:GivePrototype
+        prototype: SheetGlass1
+        amount: 1
+      steps:
+      - tool: Prying
+        doAfter: 2
+
+  - node: finish
+    entity: !type:BoardNodeEntity { container: board }
+    actions:
+    - !type:AddContainer
+      container: board
+    edges:
+    - to: board
+      conditions:
+      - !type:AllWiresCut {}
+      - !type:WirePanel {}
+      completed:
+      - !type:GivePrototype
+        prototype: SheetGlass1
+        amount: 1
+      steps:
+      - tool: Prying
+        doAfter: 4
index eac72ef65760012fc38a8b5cd3370f8d16bdb6ba..e863689677d59e06296d83d1aa9c5420fb3dc821 100644 (file)
   canBuildInImpassable: true
   conditions:
   - !type:WallmountCondition
+
+# DEFENSES
+- type: construction
+  id: WeaponEnergyTurretControlPanel
+  graph: WeaponEnergyTurretControlPanel
+  startNode: start
+  targetNode: finish
+  category: construction-category-utilities
+  objectType: Structure
+  canRotate: true
+  placementMode: SnapgridCenter
+  canBuildInImpassable: true
+  conditions:
+  - !type:WallmountCondition