diff --git a/Content.Client/Observer/GhostComponent.cs b/Content.Client/Observer/GhostComponent.cs new file mode 100644 index 0000000000..31f45d84b8 --- /dev/null +++ b/Content.Client/Observer/GhostComponent.cs @@ -0,0 +1,53 @@ +using Content.Client.UserInterface; +using Content.Shared.Observer; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Interfaces.Network; +using Robust.Shared.IoC; + +namespace Content.Client.Observer +{ + [RegisterComponent] + public class GhostComponent : SharedGhostComponent + { + private GhostGui _gui; + +#pragma warning disable 649 + [Dependency] private readonly IGameHud _gameHud; +#pragma warning restore 649 + + public override void OnRemove() + { + base.OnRemove(); + + _gui?.Dispose(); + } + + public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, + IComponent component = null) + { + base.HandleMessage(message, netChannel, component); + + switch (message) + { + case PlayerAttachedMsg _: + if (_gui == null) + { + _gui = new GhostGui(); + } + else + { + _gui.Parent?.RemoveChild(_gui); + } + + _gameHud.HandsContainer.AddChild(_gui); + break; + + case PlayerDetachedMsg _: + _gui.Parent?.RemoveChild(_gui); + break; + } + } + } +} diff --git a/Content.Client/UserInterface/GhostGui.cs b/Content.Client/UserInterface/GhostGui.cs new file mode 100644 index 0000000000..63f7a870ba --- /dev/null +++ b/Content.Client/UserInterface/GhostGui.cs @@ -0,0 +1,18 @@ +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Shared.IoC; + +namespace Content.Client.UserInterface +{ + public class GhostGui : Control + { + public GhostGui() + { + IoCManager.InjectDependencies(this); + + MouseFilter = MouseFilterMode.Ignore; + + AddChild(new Label(){Text = "YES THIS IS GHOST WHOOOOOO"}); + } + } +} diff --git a/Content.Shared/Observer/SharedGhostComponent.cs b/Content.Shared/Observer/SharedGhostComponent.cs new file mode 100644 index 0000000000..dca348b285 --- /dev/null +++ b/Content.Shared/Observer/SharedGhostComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameObjects; + +namespace Content.Shared.Observer +{ + public class SharedGhostComponent : Component + { + public override string Name => "Ghost"; + } +} diff --git a/Resources/Prototypes/Entities/mobs/observer.yml b/Resources/Prototypes/Entities/mobs/observer.yml index c99257b300..8fc3adb84f 100644 --- a/Resources/Prototypes/Entities/mobs/observer.yml +++ b/Resources/Prototypes/Entities/mobs/observer.yml @@ -15,3 +15,4 @@ - type: Examiner DoRangeCheck: false - type: IgnorePause + - type: Ghost