From b96fa3dcfafab6c5a722fc49f14919ad07c67f51 Mon Sep 17 00:00:00 2001 From: lzk <124214523+lzk228@users.noreply.github.com> Date: Sat, 19 Apr 2025 00:52:09 +0200 Subject: [PATCH] Fix space wind layer removal (#33888) * Fix space wind layer removal * apply review * Update MovedByPressureComponent.cs * remove this --- .../AtmosphereSystem.HighPressureDelta.cs | 16 ++++++++++++---- .../Atmos/Components/MovedByPressureComponent.cs | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 6a5b07bb17..cdf7018e23 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -56,11 +56,15 @@ namespace Content.Server.Atmos.EntitySystems _physics.SetBodyStatus(uid, body, BodyStatus.OnGround); } - if (TryComp(uid, out var fixtures)) + if (TryComp(uid, out var fixtures) + && TryComp(uid, out var component)) { foreach (var (id, fixture) in fixtures.Fixtures) { - _physics.AddCollisionMask(uid, id, fixture, (int) CollisionGroup.TableLayer, manager: fixtures); + if (component.TableLayerRemoved.Contains(id)) + { + _physics.AddCollisionMask(uid, id, fixture, (int)CollisionGroup.TableLayer, manager: fixtures); + } } } } @@ -80,9 +84,13 @@ namespace Content.Server.Atmos.EntitySystems foreach (var (id, fixture) in fixtures.Fixtures) { - _physics.RemoveCollisionMask(uid, id, fixture, (int) CollisionGroup.TableLayer, manager: fixtures); + // Mark fixtures that have TableLayer removed + if ((fixture.CollisionMask & (int)CollisionGroup.TableLayer) != 0) + { + component.TableLayerRemoved.Add(id); + _physics.RemoveCollisionMask(uid, id, fixture, (int)CollisionGroup.TableLayer, manager: fixtures); + } } - // TODO: Make them dynamic type? Ehh but they still want movement so uhh make it non-predicted like weightless? // idk it's hard. diff --git a/Content.Shared/Atmos/Components/MovedByPressureComponent.cs b/Content.Shared/Atmos/Components/MovedByPressureComponent.cs index 8a4e2c6d4c..67647daa80 100644 --- a/Content.Shared/Atmos/Components/MovedByPressureComponent.cs +++ b/Content.Shared/Atmos/Components/MovedByPressureComponent.cs @@ -27,5 +27,11 @@ public sealed partial class MovedByPressureComponent : Component [ViewVariables(VVAccess.ReadWrite)] public int LastHighPressureMovementAirCycle { get; set; } = 0; + + /// + /// Used to remember which fixtures we have to remove the table mask from and give it back accordingly + /// + [DataField] + public HashSet TableLayerRemoved = new(); }