Content changes for engine exception tolerance PR (#27455)

* Content changes for engine exception tolerance PR

* Poke tests
This commit is contained in:
Leon Friedrich
2024-04-29 20:43:15 +12:00
committed by GitHub
parent 6d619c9420
commit 3c154abb5b
5 changed files with 17 additions and 26 deletions

View File

@@ -86,7 +86,7 @@ public sealed class EyeLerpingSystem : EntitySystem
private void HandleMapChange(EntityUid uid, LerpingEyeComponent component, ref EntParentChangedMessage args) private void HandleMapChange(EntityUid uid, LerpingEyeComponent component, ref EntParentChangedMessage args)
{ {
// Is this actually a map change? If yes, stop any lerps // Is this actually a map change? If yes, stop any lerps
if (args.OldMapId != args.Transform.MapID) if (args.OldMapId != args.Transform.MapUid)
component.LastRotation = GetRotation(uid, args.Transform); component.LastRotation = GetRotation(uid, args.Transform);
} }

View File

@@ -195,7 +195,7 @@ public sealed partial class ReplaySpectatorSystem
if (uid != _player.LocalEntity) if (uid != _player.LocalEntity)
return; return;
if (args.Transform.MapUid != null || args.OldMapId == MapId.Nullspace) if (args.Transform.MapUid != null || args.OldMapId == null)
return; return;
if (_spectatorData != null) if (_spectatorData != null)

View File

@@ -25,16 +25,19 @@ namespace Content.Server.Atmos.EntitySystems
private void OnAirtightInit(Entity<AirtightComponent> airtight, ref ComponentInit args) private void OnAirtightInit(Entity<AirtightComponent> airtight, ref ComponentInit args)
{ {
var xform = EntityManager.GetComponent<TransformComponent>(airtight); // TODO AIRTIGHT what FixAirBlockedDirectionInitialize even for?
if (!airtight.Comp.FixAirBlockedDirectionInitialize)
if (airtight.Comp.FixAirBlockedDirectionInitialize)
{ {
var moveEvent = new MoveEvent(airtight, default, default, Angle.Zero, xform.LocalRotation, xform, false); UpdatePosition(airtight);
if (AirtightMove(airtight, ref moveEvent)) return;
return;
} }
UpdatePosition(airtight); var xform = Transform(airtight);
airtight.Comp.CurrentAirBlockedDirection =
(int) Rotate((AtmosDirection) airtight.Comp.InitialAirBlockedDirection, xform.LocalRotation);
UpdatePosition(airtight, xform);
var airtightEv = new AirtightChanged(airtight, airtight, default);
RaiseLocalEvent(airtight, ref airtightEv, true);
} }
private void OnAirtightShutdown(Entity<AirtightComponent> airtight, ref ComponentShutdown args) private void OnAirtightShutdown(Entity<AirtightComponent> airtight, ref ComponentShutdown args)
@@ -42,13 +45,8 @@ namespace Content.Server.Atmos.EntitySystems
var xform = Transform(airtight); var xform = Transform(airtight);
// If the grid is deleting no point updating atmos. // If the grid is deleting no point updating atmos.
if (HasComp<MapGridComponent>(xform.GridUid) && if (xform.GridUid != null && LifeStage(xform.GridUid.Value) <= EntityLifeStage.MapInitialized)
MetaData(xform.GridUid.Value).EntityLifeStage > EntityLifeStage.MapInitialized) SetAirblocked(airtight, false, xform);
{
return;
}
SetAirblocked(airtight, false, xform);
} }
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args) private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
@@ -83,21 +81,14 @@ namespace Content.Server.Atmos.EntitySystems
} }
} }
private void OnAirtightMoved(Entity<AirtightComponent> airtight, ref MoveEvent ev) private void OnAirtightMoved(Entity<AirtightComponent> ent, ref MoveEvent ev)
{
AirtightMove(airtight, ref ev);
}
private bool AirtightMove(Entity<AirtightComponent> ent, ref MoveEvent ev)
{ {
var (owner, airtight) = ent; var (owner, airtight) = ent;
airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation); airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation);
var pos = airtight.LastPosition; var pos = airtight.LastPosition;
UpdatePosition(ent, ev.Component); UpdatePosition(ent, ev.Component);
var airtightEv = new AirtightChanged(owner, airtight, pos); var airtightEv = new AirtightChanged(owner, airtight, pos);
RaiseLocalEvent(owner, ref airtightEv, true); RaiseLocalEvent(owner, ref airtightEv, true);
return true;
} }
public void SetAirblocked(Entity<AirtightComponent> airtight, bool airblocked, TransformComponent? xform = null) public void SetAirblocked(Entity<AirtightComponent> airtight, bool airblocked, TransformComponent? xform = null)

View File

@@ -259,7 +259,7 @@ namespace Content.Shared.Movement.Systems
} }
var oldMapId = args.OldMapId; var oldMapId = args.OldMapId;
var mapId = args.Transform.MapID; var mapId = args.Transform.MapUid;
// If we change maps then reset eye rotation entirely. // If we change maps then reset eye rotation entirely.
if (oldMapId != mapId) if (oldMapId != mapId)

View File

@@ -113,7 +113,7 @@ public abstract class SharedStealthSystem : EntitySystem
private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEvent args) private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEvent args)
{ {
if (args.FromStateHandling) if (_timing.ApplyingState)
return; return;
if (args.NewPosition.EntityId != args.OldPosition.EntityId) if (args.NewPosition.EntityId != args.OldPosition.EntityId)