2021-09-21 05:03:14 +02:00
|
|
|
using Content.Client.Ghost.UI;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Ghost;
|
2020-04-05 02:29:04 +02:00
|
|
|
using Robust.Client.Player;
|
2020-03-03 18:04:16 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Ghost
|
2020-03-03 18:04:16 +01:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2021-10-24 15:29:38 +13:00
|
|
|
[ComponentReference(typeof(SharedGhostComponent))]
|
|
|
|
|
public sealed class GhostComponent : SharedGhostComponent
|
2020-03-03 18:04:16 +01:00
|
|
|
{
|
2020-08-24 14:10:28 +02:00
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
2021-02-19 19:29:34 +01:00
|
|
|
|
2021-06-18 09:56:23 +02:00
|
|
|
public GhostGui? Gui { get; set; }
|
|
|
|
|
public bool IsAttached { get; set; }
|
2020-10-16 13:36:20 -05:00
|
|
|
|
|
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
2020-03-03 19:10:07 +01:00
|
|
|
{
|
|
|
|
|
base.HandleComponentState(curState, nextState);
|
|
|
|
|
|
2021-06-18 09:56:23 +02:00
|
|
|
if (curState is not GhostComponentState)
|
2020-04-05 02:29:04 +02:00
|
|
|
{
|
2021-06-18 09:56:23 +02:00
|
|
|
return;
|
2020-04-05 02:29:04 +02:00
|
|
|
}
|
2020-10-16 13:36:20 -05:00
|
|
|
|
2021-06-18 09:56:23 +02:00
|
|
|
if (Owner == _playerManager.LocalPlayer?.ControlledEntity)
|
2020-10-16 13:36:20 -05:00
|
|
|
{
|
2021-06-18 09:56:23 +02:00
|
|
|
Gui?.Update();
|
2020-10-16 13:36:20 -05:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-03 18:04:16 +01:00
|
|
|
}
|
|
|
|
|
}
|