Delete ghost when player is detached (#12221)

This commit is contained in:
Jacob Tong
2022-10-27 07:09:35 -07:00
committed by GitHub
parent 0e9213f523
commit 52382aa7a6

View File

@@ -46,6 +46,7 @@ namespace Content.Server.Ghost
SubscribeLocalEvent<GhostComponent, MindRemovedMessage>(OnMindRemovedMessage);
SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
SubscribeLocalEvent<GhostComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<GhostOnMoveComponent, MoveInputEvent>(OnRelayMoveInput);
@@ -58,6 +59,7 @@ namespace Content.Server.Ghost
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => 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 ||