2019-09-17 16:08:45 -07:00
|
|
|
|
using Content.Shared.Construction;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Content.Shared.GameObjects.EntitySystems;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using Robust.Shared.IoC;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Robust.Shared.Localization;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Robust.Shared.Utility;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2018-08-02 08:29:55 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.GameObjects.Components.Construction
|
|
|
|
|
|
{
|
2019-07-31 15:02:36 +02:00
|
|
|
|
[RegisterComponent]
|
2020-08-01 17:37:12 +02:00
|
|
|
|
public class ConstructionGhostComponent : Component, IExamine
|
2018-08-02 08:29:55 +02:00
|
|
|
|
{
|
2020-10-08 17:41:23 +02:00
|
|
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
|
|
|
2018-08-02 08:29:55 +02:00
|
|
|
|
public override string Name => "ConstructionGhost";
|
|
|
|
|
|
|
2018-09-09 15:34:43 +02:00
|
|
|
|
[ViewVariables] public ConstructionPrototype Prototype { get; set; }
|
|
|
|
|
|
[ViewVariables] public int GhostID { get; set; }
|
2020-08-01 17:37:12 +02:00
|
|
|
|
|
|
|
|
|
|
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
|
|
|
|
|
{
|
2020-10-08 17:41:23 +02:00
|
|
|
|
message.AddMarkup(Loc.GetString("Building: [color=cyan]{0}[/color]\n", Prototype.Name));
|
|
|
|
|
|
|
|
|
|
|
|
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype graph)) return;
|
|
|
|
|
|
var startNode = graph.Nodes[Prototype.StartNode];
|
|
|
|
|
|
var path = graph.Path(Prototype.StartNode, Prototype.TargetNode);
|
|
|
|
|
|
var edge = startNode.GetEdge(path[0].Name);
|
|
|
|
|
|
edge.Steps[0].DoExamine(message, inDetailsRange);
|
2020-08-01 17:37:12 +02:00
|
|
|
|
}
|
2018-08-02 08:29:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|