Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass Scanner and Radar Telescreens #2351

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions Content.Server/Construction/NodeEntities/BoardNodeEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Construction.Components;
using Content.Server._NF.Construction.Components; // Frontier
using Content.Shared.Construction;
using Content.Shared.Construction.Components;
using JetBrains.Annotations;
Expand All @@ -15,6 +15,7 @@ namespace Content.Server.Construction.NodeEntities;
public sealed partial class BoardNodeEntity : IGraphNodeEntity
{
[DataField("container")] public string Container { get; private set; } = string.Empty;
[DataField] public ComputerType Computer { get; private set; } = ComputerType.Default; // Frontier

public string? GetId(EntityUid? uid, EntityUid? userUid, GraphNodeEntityArgs args)
{
Expand All @@ -29,13 +30,22 @@ public sealed partial class BoardNodeEntity : IGraphNodeEntity

var board = container.ContainedEntities[0];

// Frontier - adds tabletop variants
if (args.EntityManager.TryGetComponent(container.Owner, out ConstructionComponent? constructionComponent)
&& constructionComponent.Graph == "ComputerTabletop"
&& args.EntityManager.TryGetComponent(board, out ComputerTabletopBoardComponent? tabletopComputer))
// Frontier - alternative computer variants
switch (Computer)
{
return tabletopComputer.Prototype;
case ComputerType.Tabletop:
if (args.EntityManager.TryGetComponent(board, out ComputerTabletopBoardComponent? tabletopComputer))
return tabletopComputer.Prototype;
break;
case ComputerType.Wallmount:
if (args.EntityManager.TryGetComponent(board, out ComputerWallmountBoardComponent? wallmountComputer))
return wallmountComputer.Prototype;
break;
case ComputerType.Default:
default:
break;
}
// End Frontier

// There should not be a case where both of these components exist on the same entity...
if (args.EntityManager.TryGetComponent(board, out MachineBoardComponent? machine))
Expand All @@ -46,4 +56,13 @@ public sealed partial class BoardNodeEntity : IGraphNodeEntity

return null;
}

// Frontier: support for multiple computer types
public enum ComputerType : byte
{
Default, // Default machines
Tabletop,
Wallmount
}
// End Frontier
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Construction.Components
namespace Content.Server._NF.Construction.Components
{
/// <summary>
/// Used for construction graphs in building tabletop computers.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server._NF.Construction.Components
{
/// <summary>
/// Used for construction graphs in building wallmount computers.
/// </summary>
[RegisterComponent]
public sealed partial class ComputerWallmountBoardComponent : Component
{
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? Prototype { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@
prototype: ComputerRadar
- type: ComputerTabletopBoard # Frontier
prototype: ComputerTabletopRadar # Frontier
- type: ComputerWallmountBoard # Frontier
prototype: ComputerWallmountRadar # Frontier

- type: entity
parent: BaseComputerCircuitboard
Expand All @@ -337,6 +339,8 @@
prototype: ComputerAdvancedRadar
- type: ComputerTabletopBoard # Frontier
prototype: ComputerTabletopAdvancedRadar # Frontier
- type: ComputerWallmountBoard # Frontier
prototype: ComputerWallmountAdvancedRadar # Frontier

- type: entity
parent: BaseComputerCircuitboard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Mass scanner telescreen
- type: entity
parent: [BaseStructureComputerWallmount, ComputerRadar]
id: ComputerWallmountRadar
components:
- type: Sprite
drawdepth: WallMountedItems
sprite: _NF/Structures/Machines/computer_wallmount.rsi
layers:
- map: ["computerLayerBody"]
state: computer_wallmount
- map: ["computerLayerScreen"]
state: screen_mass

- type: entity
parent: [BaseStructureComputerWallmount, ComputerAdvancedRadar]
id: ComputerWallmountAdvancedRadar
components:
- type: Sprite
drawdepth: WallMountedItems
sprite: _NF/Structures/Machines/computer_wallmount.rsi
layers:
- map: ["computerLayerBody"]
state: computer_wallmount
- map: ["computerLayerScreen"]
state: screen_radar
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
- type: entity
id: BaseStructureComputerWallmount
parent: [BaseStructureWallmount, BaseStructure]
suffix: Wallmount
abstract: true
components:
- type: Anchorable
- type: InteractionOutline
- type: Construction
graph: ComputerWallmount
node: wallmount computer
- type: Sprite
sprite: _NF/Structures/Machines/computer_wallmount.rsi
drawdepth: WallMountedItems
layers:
- map: [ "computerLayerBody" ]
sprite: _NF/Structures/Machines/computer_wallmount.rsi
state: computer_wallmount
- map: [ "computerLayerScreen" ]
sprite: _NF/Structures/Machines/computer_wallmount.rsi
state: screen_generic
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Electronic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
behaviors:
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- !type:ChangeConstructionNodeBehavior
node: monitorBroken
- !type:DoActsBehavior
acts: ["Destruction"]
- type: StaticPrice
price: 100

- type: entity
parent: BaseStructureComputerWallmount
name: computer
id: ComputerWallmountFrame
components:
- type: Construction
graph: ComputerWallmount
node: frameUnsecured
containers:
- board
- type: Sprite
drawdepth: WallMountedItems
sprite: _NF/Structures/Machines/computer_wallmount.rsi
layers:
- state: computer_wallmount_frame
map: [ "enum.ConstructionVisuals.Layer" ]
- type: Appearance
- type: GenericVisualizer
visuals:
enum.ConstructionVisuals.Key:
enum.ConstructionVisuals.Layer:
frameUnsecured: { state: computer_wallmount_frame }
boardUnsecured: { state: computer_board_exposed }
missingWires: { state: computer_needs_wires }
monitorMissing: { state: computer_no_monitor }
monitorUnsecured: { state: computer_monitor_unscrewed }

- type: entity
parent: [BaseStructureWallmount, ComputerBroken]
id: ComputerWallmountBroken
suffix: Wallmount
components:
- type: Sprite
drawdepth: WallMountedItems
sprite: _NF/Structures/Machines/computer_wallmount.rsi
state: broken_wallmount
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
amount: 5
- !type:DeleteEntity {}
steps:
- tool: Welding
- tool: Screwing
doAfter: 2

- node: boardUnsecured
Expand Down Expand Up @@ -119,7 +119,9 @@
- tool: Prying

- node: tabletop computer
entity: !type:BoardNodeEntity { container: board }
entity: !type:BoardNodeEntity
container: board
computer: Tabletop
edges:
- to: monitorUnsecured
conditions:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
- type: constructionGraph
id: ComputerWallmount
start: start
graph:
- node: start
edges:
- to: frameUnsecured
completed:
- !type:SetAnchor
value: true # Explicitly true - should always be anchored
steps:
- material: Steel
amount: 5
doAfter: 2.5

- node: frameUnsecured
actions:
- !type:AppearanceChange
entity: ComputerWallmountFrame
edges:
- to: boardUnsecured
steps:
- component: ComputerWallmountBoard
store: board
name: any wallmount computer circuit board
icon:
sprite: "Objects/Misc/module.rsi"
state: "id_mod"

- to: start
completed:
- !type:SpawnPrototype
prototype: SheetSteel1
amount: 5
- !type:DeleteEntity {}
steps:
- tool: Screwing
doAfter: 2

- node: boardUnsecured
actions:
- !type:AppearanceChange
edges:
- to: missingWires
conditions:
- !type:EntityAnchored {}
steps:
- tool: Screwing

- to: frameUnsecured
conditions:
- !type:EntityAnchored { }
completed:
- !type:EmptyAllContainers
emptyAtUser: true # Try and prevent stuff going out into space
steps:
- tool: Prying

- node: missingWires
actions:
- !type:AppearanceChange
edges:
- to: monitorMissing
conditions:
- !type:EntityAnchored {}
steps:
- material: Cable
amount: 5

- to: boardUnsecured
conditions:
- !type:EntityAnchored { }
steps:
- tool: Screwing

- node: monitorMissing
entity: ComputerWallmountFrame
actions:
- !type:AppearanceChange
edges:
- to: monitorUnsecured
conditions:
- !type:EntityAnchored {}
steps:
- material: Glass
amount: 2

- to: missingWires
conditions:
- !type:EntityAnchored { }
completed:
- !type:SpawnPrototype
prototype: CableApcStack1
amount: 5
steps:
- tool: Cutting

- node: monitorUnsecured
actions:
- !type:AppearanceChange
entity: ComputerWallmountFrame
edges:
- to: wallmount computer
conditions:
- !type:EntityAnchored {}
steps:
- tool: Screwing

- to: monitorMissing
conditions:
- !type:EntityAnchored {}
completed:
- !type:SpawnPrototype
prototype: SheetGlass1
amount: 2
steps:
- tool: Prying

- node: wallmount computer
entity: !type:BoardNodeEntity
container: board
computer: Wallmount
edges:
- to: monitorUnsecured
steps:
- tool: Prying
doAfter: 1

- node: monitorBroken
entity: ComputerWallmountBroken
edges:
- to: monitorMissing
conditions:
- !type:EntityAnchored {}
completed:
- !type:SpawnPrototype
prototype: ShardGlass
amount: 2
steps:
- tool: Prying
doAfter: 2
17 changes: 17 additions & 0 deletions Resources/Prototypes/_NF/Recipes/Construction/machines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@
icon:
sprite: _NF/Structures/Machines/computer_tabletop.rsi
state: computer_tabletop_frame

- type: construction
name: computer (wallmount)
id: ConstructionComputerWallmount
graph: ComputerWallmount
startNode: start
targetNode: wallmount computer
category: construction-category-machines
description: A frame used to construct anything with a computer circuitboard.
icon:
sprite: _NF/Structures/Machines/computer_wallmount.rsi
state: computer_wallmount_frame
objectType: Structure
placementMode: SnapgridCenter
canBuildInImpassable: true
conditions:
- !type:WallmountCondition {}
Loading
Loading