Files
tbd-station-14/Content.Client/Ghost/GhostComponent.cs
DrSmugleaf 4f4d203d2e Make ghost component ECS (#4159)
* Make ghost component ECS

* Remove players and locations properties from ghost component

* Address reviews

* One more doc

* Fix client ghost component state method error
2021-06-18 09:56:23 +02:00

32 lines
831 B
C#

using Content.Shared.Ghost;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Ghost
{
[RegisterComponent]
public class GhostComponent : SharedGhostComponent
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
public GhostGui? Gui { get; set; }
public bool IsAttached { get; set; }
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);
if (curState is not GhostComponentState)
{
return;
}
if (Owner == _playerManager.LocalPlayer?.ControlledEntity)
{
Gui?.Update();
}
}
}
}