From 319cd18ee87d048d8d19203108d0039d2fbe802d Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:35:38 +0300 Subject: [PATCH] demiplane closing - adventurers tp out and gib (#629) --- .../CP14DemiplanSystem.Stabilization.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs b/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs index 5d13b71512..a5fc47347f 100644 --- a/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs +++ b/Content.Server/_CP14/Demiplane/CP14DemiplanSystem.Stabilization.cs @@ -1,3 +1,4 @@ +using Content.Server.Body.Systems; using Content.Shared._CP14.Demiplane.Components; using Content.Shared.Mobs.Systems; @@ -9,6 +10,7 @@ public sealed partial class CP14DemiplaneSystem private TimeSpan _nextCheckTime = TimeSpan.Zero; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly BodySystem _body = default!; private void InitStabilization() { @@ -49,13 +51,26 @@ public sealed partial class CP14DemiplaneSystem } var query2 = EntityQueryEnumerator(); - while (query2.MoveNext(out var uid, out var demiplan, out var stabilization)) + while (query2.MoveNext(out var uid, out var demiplane, out var stabilization)) { if (_timing.CurTime < stabilization.EndProtectionTime) continue; if (!stabilizedMaps.Contains(uid)) - QueueDel(uid); + DeleteDemiplane((uid, demiplane)); } } + + private void DeleteDemiplane(Entity demiplane) + { + var query = EntityQueryEnumerator(); + + while (query.MoveNext(out var uid, out var stabilizer, out var xform)) + { + TryTeleportOutDemiplane(demiplane, uid); + _body.GibBody(uid); + } + + QueueDel(demiplane); + } }