@@ -25,30 +25,28 @@ public override void Initialize()
2525
2626 private void OnAirtightInit ( Entity < AirtightComponent > airtight , ref ComponentInit args )
2727 {
28- var xform = EntityManager . GetComponent < TransformComponent > ( airtight ) ;
29-
30- if ( airtight . Comp . FixAirBlockedDirectionInitialize )
28+ // TODO AIRTIGHT what FixAirBlockedDirectionInitialize even for?
29+ if ( ! airtight . Comp . FixAirBlockedDirectionInitialize )
3130 {
32- var moveEvent = new MoveEvent ( airtight , default , default , Angle . Zero , xform . LocalRotation , xform , false ) ;
33- if ( AirtightMove ( airtight , ref moveEvent ) )
34- return ;
31+ UpdatePosition ( airtight ) ;
32+ return ;
3533 }
3634
37- UpdatePosition ( airtight ) ;
35+ var xform = Transform ( airtight ) ;
36+ airtight . Comp . CurrentAirBlockedDirection =
37+ ( int ) Rotate ( ( AtmosDirection ) airtight . Comp . InitialAirBlockedDirection , xform . LocalRotation ) ;
38+ UpdatePosition ( airtight , xform ) ;
39+ var airtightEv = new AirtightChanged ( airtight , airtight , default ) ;
40+ RaiseLocalEvent ( airtight , ref airtightEv , true ) ;
3841 }
3942
4043 private void OnAirtightShutdown ( Entity < AirtightComponent > airtight , ref ComponentShutdown args )
4144 {
4245 var xform = Transform ( airtight ) ;
4346
4447 // If the grid is deleting no point updating atmos.
45- if ( HasComp < MapGridComponent > ( xform . GridUid ) & &
46- MetaData ( xform . GridUid . Value ) . EntityLifeStage > EntityLifeStage . MapInitialized )
47- {
48- return ;
49- }
50-
51- SetAirblocked ( airtight , false , xform ) ;
48+ if ( xform . GridUid != null && LifeStage ( xform . GridUid . Value ) <= EntityLifeStage . MapInitialized )
49+ SetAirblocked ( airtight , false , xform ) ;
5250 }
5351
5452 private void OnAirtightPositionChanged ( EntityUid uid , AirtightComponent airtight , ref AnchorStateChangedEvent args )
@@ -83,21 +81,14 @@ private void OnAirtightReAnchor(EntityUid uid, AirtightComponent airtight, ref R
8381 }
8482 }
8583
86- private void OnAirtightMoved ( Entity < AirtightComponent > airtight , ref MoveEvent ev )
87- {
88- AirtightMove ( airtight , ref ev ) ;
89- }
90-
91- private bool AirtightMove ( Entity < AirtightComponent > ent , ref MoveEvent ev )
84+ private void OnAirtightMoved ( Entity < AirtightComponent > ent , ref MoveEvent ev )
9285 {
9386 var ( owner , airtight ) = ent ;
94-
9587 airtight . CurrentAirBlockedDirection = ( int ) Rotate ( ( AtmosDirection ) airtight . InitialAirBlockedDirection , ev . NewRotation ) ;
9688 var pos = airtight . LastPosition ;
9789 UpdatePosition ( ent , ev . Component ) ;
9890 var airtightEv = new AirtightChanged ( owner , airtight , pos ) ;
9991 RaiseLocalEvent ( owner , ref airtightEv , true ) ;
100- return true ;
10192 }
10293
10394 public void SetAirblocked ( Entity < AirtightComponent > airtight , bool airblocked , TransformComponent ? xform = null )
0 commit comments