Delete ghost when player is detached (#12221)
This commit is contained in:
@@ -46,6 +46,7 @@ namespace Content.Server.Ghost
|
|||||||
|
|
||||||
SubscribeLocalEvent<GhostComponent, MindRemovedMessage>(OnMindRemovedMessage);
|
SubscribeLocalEvent<GhostComponent, MindRemovedMessage>(OnMindRemovedMessage);
|
||||||
SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
|
SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
|
||||||
|
SubscribeLocalEvent<GhostComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||||
|
|
||||||
SubscribeLocalEvent<GhostOnMoveComponent, MoveInputEvent>(OnRelayMoveInput);
|
SubscribeLocalEvent<GhostOnMoveComponent, MoveInputEvent>(OnRelayMoveInput);
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ namespace Content.Server.Ghost
|
|||||||
|
|
||||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args)
|
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
@@ -160,6 +162,11 @@ namespace Content.Server.Ghost
|
|||||||
DeleteEntity(uid);
|
DeleteEntity(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerDetached(EntityUid uid, GhostComponent component, PlayerDetachedEvent args)
|
||||||
|
{
|
||||||
|
QueueDel(uid);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnGhostWarpsRequest(GhostWarpsRequestEvent msg, EntitySessionEventArgs args)
|
private void OnGhostWarpsRequest(GhostWarpsRequestEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.SenderSession.AttachedEntity is not {Valid: true} entity ||
|
if (args.SenderSession.AttachedEntity is not {Valid: true} entity ||
|
||||||
|
|||||||
Reference in New Issue
Block a user