From 52382aa7a6ce6df87f4ff66cd891db7234cc29c3 Mon Sep 17 00:00:00 2001 From: Jacob Tong <10494922+ShadowCommander@users.noreply.github.com> Date: Thu, 27 Oct 2022 07:09:35 -0700 Subject: [PATCH] Delete ghost when player is detached (#12221) --- Content.Server/Ghost/GhostSystem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index d353364645..5b4da33782 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -46,6 +46,7 @@ namespace Content.Server.Ghost SubscribeLocalEvent(OnMindRemovedMessage); SubscribeLocalEvent(OnMindUnvisitedMessage); + SubscribeLocalEvent(OnPlayerDetached); SubscribeLocalEvent(OnRelayMoveInput); @@ -58,6 +59,7 @@ namespace Content.Server.Ghost SubscribeLocalEvent(_ => MakeVisible(true)); } + private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args) { if (args.Handled) @@ -160,6 +162,11 @@ namespace Content.Server.Ghost DeleteEntity(uid); } + private void OnPlayerDetached(EntityUid uid, GhostComponent component, PlayerDetachedEvent args) + { + QueueDel(uid); + } + private void OnGhostWarpsRequest(GhostWarpsRequestEvent msg, EntitySessionEventArgs args) { if (args.SenderSession.AttachedEntity is not {Valid: true} entity ||