From: TriviaSolari <154280615+TriviaSolari@users.noreply.github.com>
Date: Thu, 15 Jan 2026 02:31:05 +0000 (-0500)
Subject: Reduce unnecessary `ComponentInit` work for airtight entities (#42390)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=d6377862c1f8fa7539320a2229fc0486679d5564;p=space-station-14.git
Reduce unnecessary `ComponentInit` work for airtight entities (#42390)
Refactor AirtightSystem to skip rotation checks for omnidirectional blocks on init
Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
---
diff --git a/Content.Server/Atmos/Components/AirtightComponent.cs b/Content.Server/Atmos/Components/AirtightComponent.cs
index 29c1f18af3..731153be41 100644
--- a/Content.Server/Atmos/Components/AirtightComponent.cs
+++ b/Content.Server/Atmos/Components/AirtightComponent.cs
@@ -44,20 +44,6 @@ namespace Content.Server.Atmos.Components
[DataField("rotateAirBlocked")]
public bool RotateAirBlocked { get; set; } = true;
- ///
- /// Whether to fix the on initialization
- /// to the entity's current rotation.
- ///
- /// This is an optimization routine for initializing airtight components.
- /// If this entity doesn't have unique airtight directions
- /// (ex. not all directions are blocked but some are), we can skip
- /// a lot of event/transform business during initialization.
- /// This field marks whether this is skipped or not.
- /// If your entity only blocks air in one direction,
- /// and that can depend on rotation, this needs to be set to true.
- [DataField]
- public bool FixAirBlockedDirectionInitialize = true;
-
///
/// If true, then the tile that this entity is on will have no air at all if all directions are blocked.
///
diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs
index 78f61c80a4..61cd8b280c 100644
--- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs
@@ -25,16 +25,17 @@ namespace Content.Server.Atmos.EntitySystems
private void OnAirtightInit(Entity airtight, ref ComponentInit args)
{
- // If this entity has unique airtight directions that are affected by rotation,
- // we need to fix up the current airtight directions based on its rotation.
- // Otherwise, we can skip all of that logic (stuff adds up when you're initing
- // a morbillion walls).
- if (!airtight.Comp.FixAirBlockedDirectionInitialize)
+ // If this entity blocks air in all directions (e.g. full tile walls, doors, and windows)
+ // we can skip some expensive logic.
+ if (airtight.Comp.InitialAirBlockedDirection == (int)AtmosDirection.All)
{
+ airtight.Comp.CurrentAirBlockedDirection = airtight.Comp.InitialAirBlockedDirection;
UpdatePosition(airtight);
return;
}
+ // Otherwise we need to determine its current blocked air directions based on rotation
+ // and check if it's still airtight.
var xform = Transform(airtight);
airtight.Comp.CurrentAirBlockedDirection =
(int) Rotate((AtmosDirection) airtight.Comp.InitialAirBlockedDirection, xform.LocalRotation);