]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix space wind layer removal (#33888)
authorlzk <124214523+lzk228@users.noreply.github.com>
Fri, 18 Apr 2025 22:52:09 +0000 (00:52 +0200)
committerGitHub <noreply@github.com>
Fri, 18 Apr 2025 22:52:09 +0000 (00:52 +0200)
* Fix space wind layer removal

* apply review

* Update MovedByPressureComponent.cs

* remove this

Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs
Content.Shared/Atmos/Components/MovedByPressureComponent.cs

index 6a5b07bb17a5e0b0e7bf6533b3b510cf14f7e621..cdf7018e234f84da0899631f3d82f2fd7c843dec 100644 (file)
@@ -56,11 +56,15 @@ namespace Content.Server.Atmos.EntitySystems
                     _physics.SetBodyStatus(uid, body, BodyStatus.OnGround);
                 }
 
-                if (TryComp<FixturesComponent>(uid, out var fixtures))
+                if (TryComp<FixturesComponent>(uid, out var fixtures)
+                    && TryComp<MovedByPressureComponent>(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.
 
index 8a4e2c6d4c9a8c6b468c31eec4c9be9eb512f775..67647daa80ce551bc01c09668f44457c98926285 100644 (file)
@@ -27,5 +27,11 @@ public sealed partial class MovedByPressureComponent : Component
 
     [ViewVariables(VVAccess.ReadWrite)]
     public int LastHighPressureMovementAirCycle { get; set; } = 0;
+
+    /// <summary>
+    /// Used to remember which fixtures we have to remove the table mask from and give it back accordingly
+    /// </summary>
+    [DataField]
+    public HashSet<string> TableLayerRemoved = new();
 }