diff --git a/Content.Server/GameObjects/Components/NodeContainer/NodeContainerComponent.cs b/Content.Server/GameObjects/Components/NodeContainer/NodeContainerComponent.cs index 73d75455f6..67ca51083e 100644 --- a/Content.Server/GameObjects/Components/NodeContainer/NodeContainerComponent.cs +++ b/Content.Server/GameObjects/Components/NodeContainer/NodeContainerComponent.cs @@ -1,7 +1,11 @@ using System.Collections.Generic; +using Content.Server.GameObjects.Components.NodeContainer.NodeGroups; using Content.Server.GameObjects.Components.NodeContainer.Nodes; +using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; +using Robust.Shared.Localization; using Robust.Shared.Serialization; +using Robust.Shared.Utility; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.NodeContainer @@ -10,18 +14,20 @@ namespace Content.Server.GameObjects.Components.NodeContainer /// Creates and maintains a set of s. /// [RegisterComponent] - public class NodeContainerComponent : Component + public class NodeContainerComponent : Component, IExamine { public override string Name => "NodeContainer"; [ViewVariables] public IReadOnlyList Nodes => _nodes; private List _nodes = new(); + private bool _examinable; public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); serializer.DataField(ref _nodes, "nodes", new List()); + serializer.DataField(ref _examinable, "examinable", false); } public override void Initialize() @@ -50,5 +56,34 @@ namespace Content.Server.GameObjects.Components.NodeContainer } base.OnRemove(); } + + public void Examine(FormattedMessage message, bool inDetailsRange) + { + if (!_examinable || !inDetailsRange) return; + + for (var i = 0; i < Nodes.Count; i++) + { + var node = Nodes[i]; + if (node == null) continue; + switch (node.NodeGroupID) + { + case NodeGroupID.HVPower: + message.AddMarkup( + Loc.GetString("It has a connector for [color=orange]HV cables[/color].")); + break; + case NodeGroupID.MVPower: + message.AddMarkup( + Loc.GetString("It has a connector for [color=yellow]MV cables[/color].")); + break; + case NodeGroupID.Apc: + message.AddMarkup( + Loc.GetString("It has a connector for [color=green]LV cables[/color].")); + break; + } + + if(i != Nodes.Count - 1) + message.AddMarkup("\n"); + } + } } } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs index c84c416a04..520de52709 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs @@ -1,5 +1,6 @@ #nullable enable using System; +using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer.NodeGroups; using Content.Shared.GameObjects.Components.Power; using Content.Shared.GameObjects.EntitySystems; diff --git a/Resources/Prototypes/Entities/Constructible/Power/particleAccelerator.yml b/Resources/Prototypes/Entities/Constructible/Power/particleAccelerator.yml index f2d66ba3e6..3398afd385 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/particleAccelerator.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/particleAccelerator.yml @@ -225,6 +225,7 @@ - type: PowerConsumer voltage: High - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower diff --git a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml index cb671c9513..02680ecc4f 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml @@ -30,6 +30,7 @@ sprite: Constructible/Power/power.rsi state: generator - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower @@ -80,6 +81,7 @@ maxCharge: 1000 startingCharge: 1000 - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower @@ -131,6 +133,7 @@ maxCharge: 1000 startingCharge: 1000 - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower @@ -177,6 +180,7 @@ maxCharge: 10000 startingCharge: 10000 - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: MVPower @@ -226,6 +230,7 @@ sprite: Constructible/Power/solar_panel.rsi state: normal - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/ame_controller.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/ame_controller.yml index bcfbc3d1f9..c4c1442a6f 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/ame_controller.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/AME/ame_controller.yml @@ -43,6 +43,7 @@ visuals: - type: AMEControllerVisualizer - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: AMEngine diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/emitter.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/emitter.yml index 4edcccbceb..fa21ea3ee4 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/emitter.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/emitter.yml @@ -38,6 +38,7 @@ - type: PowerConsumer voltage: Medium - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: MVPower diff --git a/Resources/Prototypes/Entities/singularity.yml b/Resources/Prototypes/Entities/singularity.yml index a466e02059..97cc72271b 100644 --- a/Resources/Prototypes/Entities/singularity.yml +++ b/Resources/Prototypes/Entities/singularity.yml @@ -51,6 +51,7 @@ visuals: - type: RadiationCollectorVisualizer - type: NodeContainer + examinable: true nodes: - !type:AdjacentNode nodeGroupID: HVPower