Literally Murder IExamine (#7352)

This commit is contained in:
Rane
2022-04-08 17:17:25 -04:00
committed by GitHub
parent 427f7378c3
commit 7900abb888
27 changed files with 372 additions and 469 deletions

View File

@@ -1,13 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Examine;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.NodeContainer
{
@@ -15,14 +7,12 @@ namespace Content.Server.NodeContainer
/// Creates and maintains a set of <see cref="Node"/>s.
/// </summary>
[RegisterComponent]
#pragma warning disable 618
public sealed class NodeContainerComponent : Component, IExamine
#pragma warning restore 618
public sealed class NodeContainerComponent : Component
{
//HACK: THIS BEING readOnly IS A FILTHY HACK AND I HATE IT --moony
[DataField("nodes", readOnly: true)] [ViewVariables] public Dictionary<string, Node> Nodes { get; } = new();
[DataField("examinable")] private bool _examinable = false;
[DataField("examinable")] public bool Examinable = false;
public T GetNode<T>(string identifier) where T : Node
{
@@ -40,30 +30,5 @@ namespace Content.Server.NodeContainer
node = null;
return false;
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!_examinable || !inDetailsRange) return;
foreach (var node in Nodes.Values)
{
if (node == null) continue;
switch (node.NodeGroupID)
{
case NodeGroupID.HVPower:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-hvpower") + "\n");
break;
case NodeGroupID.MVPower:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-mvpower") + "\n");
break;
case NodeGroupID.Apc:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-apc") + "\n");
break;
}
}
}
}
}