From 65bffbebf1540d9349f5eb009c971603dea0db61 Mon Sep 17 00:00:00 2001 From: chromiumboy <50505512+chromiumboy@users.noreply.github.com> Date: Fri, 29 Aug 2025 07:10:47 -0500 Subject: [PATCH] Sentry turrets - Part 7: Electronics and construction graphs (#35236) * 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 --- .../Components/ElectronicsBoardComponent.cs | 16 ++++ .../NodeEntities/BoardNodeEntity.cs | 8 +- Resources/Locale/en-US/recipes/tags.ftl | 1 + .../Devices/Circuitboards/Machine/turrets.yml | 13 ++- .../Devices/Electronics/turret_controls.yml | 43 ++++++++++ .../Weapons/Guns/Turrets/turrets_energy.yml | 2 +- .../Structures/Wallmounts/turret_controls.yml | 50 +++++------ .../Graphs/utilities/turret_controls.yml | 85 +++++++++++++++++++ .../Recipes/Construction/utilities.yml | 14 +++ 9 files changed, 204 insertions(+), 28 deletions(-) create mode 100644 Content.Shared/Construction/Components/ElectronicsBoardComponent.cs create mode 100644 Resources/Prototypes/Entities/Objects/Devices/Electronics/turret_controls.yml create mode 100644 Resources/Prototypes/Recipes/Construction/Graphs/utilities/turret_controls.yml diff --git a/Content.Shared/Construction/Components/ElectronicsBoardComponent.cs b/Content.Shared/Construction/Components/ElectronicsBoardComponent.cs new file mode 100644 index 0000000000..734edfba23 --- /dev/null +++ b/Content.Shared/Construction/Components/ElectronicsBoardComponent.cs @@ -0,0 +1,16 @@ +using Robust.Shared.Prototypes; + +namespace Content.Shared.Construction.Components; + +/// +/// Used in construction graphs for building wall-mounted electronic devices. +/// +[RegisterComponent] +public sealed partial class ElectronicsBoardComponent : Component +{ + /// + /// The device that is produced when the construction is completed. + /// + [DataField(required: true)] + public EntProtoId Prototype; +} diff --git a/Content.Shared/Construction/NodeEntities/BoardNodeEntity.cs b/Content.Shared/Construction/NodeEntities/BoardNodeEntity.cs index c1540c4a64..be55c6f733 100644 --- a/Content.Shared/Construction/NodeEntities/BoardNodeEntity.cs +++ b/Content.Shared/Construction/NodeEntities/BoardNodeEntity.cs @@ -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; } } diff --git a/Resources/Locale/en-US/recipes/tags.ftl b/Resources/Locale/en-US/recipes/tags.ftl index 39d39e7f0c..34eadc37d8 100644 --- a/Resources/Locale/en-US/recipes/tags.ftl +++ b/Resources/Locale/en-US/recipes/tags.ftl @@ -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 diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/turrets.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/turrets.yml index d9d8a848c3..d9bb861171 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/turrets.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/turrets.yml @@ -31,7 +31,7 @@ components: - type: Sprite sprite: Objects/Misc/module.rsi - state: command + state: science - type: MachineBoard prototype: WeaponEnergyTurretAI @@ -45,4 +45,15 @@ 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 index 0000000000..ced73dd949 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Devices/Electronics/turret_controls.yml @@ -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 + diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_energy.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_energy.yml index 1fe926294c..33d5fd6e97 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_energy.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Turrets/turrets_energy.yml @@ -190,7 +190,7 @@ - Borg - BasicSilicon - type: Machine - board: WeaponEnergyTurretSecurityMachineCircuitboard + board: WeaponEnergyTurretCommandMachineCircuitboard - type: DeviceNetwork receiveFrequencyId: TurretControl transmitFrequencyId: Turret diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/turret_controls.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/turret_controls.yml index e65530509b..651a5fe10a 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/turret_controls.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/turret_controls.yml @@ -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 @@ -36,9 +36,11 @@ - 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: @@ -157,13 +159,13 @@ - 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 @@ -172,10 +174,10 @@ 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 @@ -197,10 +199,10 @@ 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 @@ -214,10 +216,10 @@ 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 index 0000000000..ae48638d92 --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/turret_controls.yml @@ -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 diff --git a/Resources/Prototypes/Recipes/Construction/utilities.yml b/Resources/Prototypes/Recipes/Construction/utilities.yml index eac72ef657..e863689677 100644 --- a/Resources/Prototypes/Recipes/Construction/utilities.yml +++ b/Resources/Prototypes/Recipes/Construction/utilities.yml @@ -1006,3 +1006,17 @@ 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 -- 2.51.2