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

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

View File

@@ -31,7 +31,7 @@
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: command
state: science
- type: MachineBoard
prototype: WeaponEnergyTurretAI
@@ -46,3 +46,14 @@
- 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

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
- BasicSilicon
- type: Machine
board: WeaponEnergyTurretSecurityMachineCircuitboard
board: WeaponEnergyTurretCommandMachineCircuitboard
- type: DeviceNetwork
receiveFrequencyId: TurretControl
transmitFrequencyId: Turret

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

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