ECS warppoint (#6409)
This commit is contained in:
@@ -1,25 +1,15 @@
|
|||||||
using Content.Shared.Examine;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Warps
|
namespace Content.Server.Warps
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
/// <summary>
|
||||||
#pragma warning disable 618
|
/// Allows ghosts etc to warp to this entity by name.
|
||||||
public sealed class WarpPointComponent : Component, IExamine
|
/// </summary>
|
||||||
#pragma warning restore 618
|
[RegisterComponent, ComponentProtoName("WarpPoint")]
|
||||||
|
public sealed class WarpPointComponent : Component
|
||||||
{
|
{
|
||||||
public override string Name => "WarpPoint";
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("location")] public string? Location { get; set; }
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("location")] public string? Location { get; set; }
|
||||||
|
|
||||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
|
||||||
{
|
|
||||||
var loc = Location == null ? "<null>" : $"'{Location}'";
|
|
||||||
message.AddText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
Content.Server/Warps/WarpPointSystem.cs
Normal file
20
Content.Server/Warps/WarpPointSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Shared.Examine;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
|
||||||
|
namespace Content.Server.Warps;
|
||||||
|
|
||||||
|
public sealed class WarpPointSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<WarpPointComponent, ExaminedEvent>(OnWarpPointExamine);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnWarpPointExamine(EntityUid uid, WarpPointComponent component, ExaminedEvent args)
|
||||||
|
{
|
||||||
|
var loc = component.Location == null ? "<null>" : $"'{component.Location}'";
|
||||||
|
args.PushText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user