From 72ece2191d2aafea7b96650ce072d5fec21fb3d2 Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Tue, 1 Feb 2022 17:15:58 +1100
Subject: [PATCH] ECS warppoint (#6409)
---
Content.Server/Warps/WarpPointComponent.cs | 20 +++++---------------
Content.Server/Warps/WarpPointSystem.cs | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+), 15 deletions(-)
create mode 100644 Content.Server/Warps/WarpPointSystem.cs
diff --git a/Content.Server/Warps/WarpPointComponent.cs b/Content.Server/Warps/WarpPointComponent.cs
index e0b87f1ea2..f2d6382869 100644
--- a/Content.Server/Warps/WarpPointComponent.cs
+++ b/Content.Server/Warps/WarpPointComponent.cs
@@ -1,25 +1,15 @@
-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.Warps
{
- [RegisterComponent]
-#pragma warning disable 618
- public sealed class WarpPointComponent : Component, IExamine
-#pragma warning restore 618
+ ///
+ /// Allows ghosts etc to warp to this entity by name.
+ ///
+ [RegisterComponent, ComponentProtoName("WarpPoint")]
+ public sealed class WarpPointComponent : Component
{
- public override string Name => "WarpPoint";
-
[ViewVariables(VVAccess.ReadWrite)] [DataField("location")] public string? Location { get; set; }
-
- public void Examine(FormattedMessage message, bool inDetailsRange)
- {
- var loc = Location == null ? "" : $"'{Location}'";
- message.AddText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc)));
- }
}
}
diff --git a/Content.Server/Warps/WarpPointSystem.cs b/Content.Server/Warps/WarpPointSystem.cs
new file mode 100644
index 0000000000..64b0a08dc1
--- /dev/null
+++ b/Content.Server/Warps/WarpPointSystem.cs
@@ -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(OnWarpPointExamine);
+ }
+
+ private static void OnWarpPointExamine(EntityUid uid, WarpPointComponent component, ExaminedEvent args)
+ {
+ var loc = component.Location == null ? "" : $"'{component.Location}'";
+ args.PushText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc)));
+ }
+}