Fix ghosts not being hidden when you do-aghost.
This commit is contained in:
@@ -18,6 +18,8 @@ namespace Content.Client.GameObjects.Components.Observer
|
|||||||
[ViewVariables(VVAccess.ReadOnly)]
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
public bool CanReturnToBody { get; private set; } = true;
|
public bool CanReturnToBody { get; private set; } = true;
|
||||||
|
|
||||||
|
private bool _isAttached;
|
||||||
|
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IGameHud _gameHud;
|
[Dependency] private readonly IGameHud _gameHud;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager;
|
[Dependency] private readonly IPlayerManager _playerManager;
|
||||||
@@ -29,6 +31,12 @@ namespace Content.Client.GameObjects.Components.Observer
|
|||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
|
|
||||||
_gui?.Dispose();
|
_gui?.Dispose();
|
||||||
|
|
||||||
|
// PlayerDetachedMsg might not fire due to deletion order so...
|
||||||
|
if (_isAttached)
|
||||||
|
{
|
||||||
|
SetGhostVisibility(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,12 +76,14 @@ namespace Content.Client.GameObjects.Components.Observer
|
|||||||
|
|
||||||
_gameHud.HandsContainer.AddChild(_gui);
|
_gameHud.HandsContainer.AddChild(_gui);
|
||||||
SetGhostVisibility(true);
|
SetGhostVisibility(true);
|
||||||
|
_isAttached = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PlayerDetachedMsg _:
|
case PlayerDetachedMsg _:
|
||||||
_gui.Parent?.RemoveChild(_gui);
|
_gui.Parent?.RemoveChild(_gui);
|
||||||
SetGhostVisibility(false);
|
SetGhostVisibility(false);
|
||||||
|
_isAttached = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user