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
This commit is contained in:
chromiumboy
2025-08-29 07:10:47 -05:00
committed by GitHub
parent 8739271e43
commit 65bffbebf1
9 changed files with 204 additions and 28 deletions

View File

@@ -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;
}

View File

@@ -12,7 +12,8 @@ namespace Content.Shared.Construction.NodeEntities;
[DataDefinition] [DataDefinition]
public sealed partial class BoardNodeEntity : IGraphNodeEntity 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) public string? GetId(EntityUid? uid, EntityUid? userUid, GraphNodeEntityArgs args)
{ {
@@ -27,13 +28,16 @@ public sealed partial class BoardNodeEntity : IGraphNodeEntity
var board = container.ContainedEntities[0]; 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)) if (args.EntityManager.TryGetComponent(board, out MachineBoardComponent? machine))
return machine.Prototype; return machine.Prototype;
if (args.EntityManager.TryGetComponent(board, out ComputerBoardComponent? computer)) if (args.EntityManager.TryGetComponent(board, out ComputerBoardComponent? computer))
return computer.Prototype; return computer.Prototype;
if (args.EntityManager.TryGetComponent(board, out ElectronicsBoardComponent? electronics))
return electronics.Prototype;
return null; return null;
} }
} }

View 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-surveillance-camera-monitor-board = surveillance camera monitor board
construction-graph-tag-television-board = television board construction-graph-tag-television-board = television board
construction-graph-tag-freezer-electronics = freezer electronics construction-graph-tag-freezer-electronics = freezer electronics
construction-graph-tag-turret-control-electronics = sentry turret control panel electronics
# crystals # crystals
construction-graph-tag-cyan-crystal-shard = cyan crystal shard construction-graph-tag-cyan-crystal-shard = cyan crystal shard

View File

@@ -31,7 +31,7 @@
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Misc/module.rsi sprite: Objects/Misc/module.rsi
state: command state: science
- type: MachineBoard - type: MachineBoard
prototype: WeaponEnergyTurretAI prototype: WeaponEnergyTurretAI
@@ -45,4 +45,15 @@
state: security state: security
- type: MachineBoard - type: MachineBoard
prototype: WeaponEnergyTurretSecurity prototype: WeaponEnergyTurretSecurity
- type: entity
parent: WeaponEnergyTurretStationMachineCircuitboardBase
id: WeaponEnergyTurretCommandMachineCircuitboard
suffix: Command
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: command
- type: MachineBoard
prototype: WeaponEnergyTurretCommand

View File

@@ -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

View File

@@ -190,7 +190,7 @@
- Borg - Borg
- BasicSilicon - BasicSilicon
- type: Machine - type: Machine
board: WeaponEnergyTurretSecurityMachineCircuitboard board: WeaponEnergyTurretCommandMachineCircuitboard
- type: DeviceNetwork - type: DeviceNetwork
receiveFrequencyId: TurretControl receiveFrequencyId: TurretControl
transmitFrequencyId: Turret transmitFrequencyId: Turret

View File

@@ -24,8 +24,8 @@
collection: MetalGlassBreak collection: MetalGlassBreak
params: params:
volume: -4 volume: -4
#- !type:ChangeConstructionNodeBehavior - To be added in a later PR - !type:ChangeConstructionNodeBehavior
# node: machineFrame node: machineFrame
- !type:DoActsBehavior - !type:DoActsBehavior
acts: [ "Destruction" ] acts: [ "Destruction" ]
- type: Transform - type: Transform
@@ -36,9 +36,11 @@
- type: ContainerContainer - type: ContainerContainer
containers: containers:
board: !type:Container board: !type:Container
#- type: Construction - To be added in a later PR - type: Construction
# graph: WeaponEnergyTurretControlPanel graph: WeaponEnergyTurretControlPanel
# node: frame node: frame
containers:
- board
placement: placement:
mode: SnapgridCenter mode: SnapgridCenter
snap: snap:
@@ -157,13 +159,13 @@
- type: Electrified - type: Electrified
enabled: false enabled: false
usesApcPower: true usesApcPower: true
#- type: ContainerFill - Will be added in a later PR - type: ContainerFill
# containers: containers:
# board: board:
# - WeaponEnergyTurretStationControlPanelElectronics - WeaponEnergyTurretStationControlPanelElectronics
#- type: Construction - Will be added in a later PR - type: Construction
# graph: WeaponEnergyTurretControlPanel graph: WeaponEnergyTurretControlPanel
# node: finish node: finish
- type: entity - type: entity
parent: WeaponEnergyTurretStationControlPanelBase parent: WeaponEnergyTurretStationControlPanelBase
@@ -172,10 +174,10 @@
components: components:
- type: AccessReader - type: AccessReader
access: [["StationAi"], ["ResearchDirector"]] access: [["StationAi"], ["ResearchDirector"]]
#- type: ContainerFill - Will be added in a later PR - type: ContainerFill
# containers: containers:
# board: board:
# - WeaponEnergyTurretAIControlPanelElectronics - WeaponEnergyTurretAIControlPanelElectronics
- type: DeviceNetwork - type: DeviceNetwork
receiveFrequencyId: TurretAI receiveFrequencyId: TurretAI
transmitFrequencyId: TurretControlAI transmitFrequencyId: TurretControlAI
@@ -197,10 +199,10 @@
components: components:
- type: AccessReader - type: AccessReader
access: [["StationAi"], ["Security"]] access: [["StationAi"], ["Security"]]
#- type: ContainerFill - Will be added in a later PR - type: ContainerFill
# containers: containers:
# board: board:
# - WeaponEnergyTurretSecurityControlPanelElectronics - WeaponEnergyTurretSecurityControlPanelElectronics
- type: TurretTargetSettings - type: TurretTargetSettings
exemptAccessLevels: exemptAccessLevels:
- Security - Security
@@ -214,10 +216,10 @@
components: components:
- type: AccessReader - type: AccessReader
access: [["StationAi"], ["Command"]] access: [["StationAi"], ["Command"]]
#- type: ContainerFill - Will be added in a later PR - type: ContainerFill
# containers: containers:
# board: board:
# - WeaponEnergyTurretCommandControlPanelElectronics - WeaponEnergyTurretCommandControlPanelElectronics
- type: TurretTargetSettings - type: TurretTargetSettings
exemptAccessLevels: exemptAccessLevels:
- Command - Command

View File

@@ -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

View File

@@ -1006,3 +1006,17 @@
canBuildInImpassable: true canBuildInImpassable: true
conditions: conditions:
- !type:WallmountCondition - !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