* Make ghost component ECS * Remove players and locations properties from ghost component * Address reviews * One more doc * Fix client ghost component state method error
32 lines
831 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|