Improves AirtightComponent.

- Atmos now nulls air in fully airblocked tiles ONLY if one of the airtight entities in it has NoAirWhenFullyAirBlocked to true.
- Fixes edge firelocks atmos airtight direction
- Fixes atmos debug overlay not accounting for angle 0 being south.
This commit is contained in:
Vera Aguilera Puerto
2021-03-08 14:57:05 +01:00
parent ca8a2e4502
commit d86623eed7
7 changed files with 35 additions and 10 deletions

View File

@@ -105,7 +105,8 @@ namespace Content.Client.Atmos
{ {
if (data.BlockDirection.HasFlag(dir)) if (data.BlockDirection.HasFlag(dir))
{ {
var atmosAngle = dir.ToAngle(); // Account for South being 0.
var atmosAngle = dir.ToAngle() - Angle.FromDegrees(90);
var atmosAngleOfs = atmosAngle.ToVec() * 0.45f; var atmosAngleOfs = atmosAngle.ToVec() * 0.45f;
var atmosAngleOfsR90 = new Vector2(atmosAngleOfs.Y, -atmosAngleOfs.X); var atmosAngleOfsR90 = new Vector2(atmosAngleOfs.Y, -atmosAngleOfs.X);
var tileCentre = new Vector2(tile.X + 0.5f, tile.Y + 0.5f); var tileCentre = new Vector2(tile.X + 0.5f, tile.Y + 0.5f);
@@ -121,7 +122,8 @@ namespace Content.Client.Atmos
// -- Pressure Direction -- // -- Pressure Direction --
if (data.PressureDirection != AtmosDirection.Invalid) if (data.PressureDirection != AtmosDirection.Invalid)
{ {
var atmosAngle = data.PressureDirection.ToAngle(); // Account for South being 0.
var atmosAngle = data.PressureDirection.ToAngle() - Angle.FromDegrees(90);
var atmosAngleOfs = atmosAngle.ToVec() * 0.4f; var atmosAngleOfs = atmosAngle.ToVec() * 0.4f;
var tileCentre = new Vector2(tile.X + 0.5f, tile.Y + 0.5f); var tileCentre = new Vector2(tile.X + 0.5f, tile.Y + 0.5f);
var basisA = mapGrid.LocalToWorld(tileCentre); var basisA = mapGrid.LocalToWorld(tileCentre);

View File

@@ -39,6 +39,10 @@ namespace Content.Server.GameObjects.Components.Atmos
[DataField("fixAirBlockedDirectionInitialize")] [DataField("fixAirBlockedDirectionInitialize")]
private bool _fixAirBlockedDirectionInitialize = true; private bool _fixAirBlockedDirectionInitialize = true;
[ViewVariables]
[field: DataField("noAirWhenFullyAirBlocked")]
public bool NoAirWhenFullyAirBlocked { get; } = true;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public bool AirBlocked public bool AirBlocked
{ {
@@ -78,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Atmos
Owner.EnsureComponentWarn(out SnapGridComponent _); Owner.EnsureComponentWarn(out SnapGridComponent _);
if (_fixAirBlockedDirectionInitialize) if (_fixAirBlockedDirectionInitialize)
RotateEvent(new RotateEvent(Owner, Angle.Zero, Owner.Transform.LocalRotation)); RotateEvent(new RotateEvent(Owner, Angle.Zero, Owner.Transform.WorldRotation));
UpdatePosition(); UpdatePosition();
} }

View File

@@ -288,6 +288,18 @@ namespace Content.Server.GameObjects.Components.Atmos
} else if (isAirBlocked) } else if (isAirBlocked)
{ {
var nullAir = false;
foreach (var airtight in GetObstructingComponents(indices))
{
if (airtight.NoAirWhenFullyAirBlocked)
{
nullAir = true;
break;
}
}
if(nullAir)
tile.Air = null; tile.Air = null;
} }
else else

View File

@@ -90,12 +90,12 @@ namespace Content.Shared.Atmos
{ {
AtmosDirection.East => Angle.FromDegrees(90), AtmosDirection.East => Angle.FromDegrees(90),
AtmosDirection.North => Angle.FromDegrees(180), AtmosDirection.North => Angle.FromDegrees(180),
AtmosDirection.West => Angle.FromDegrees(-90), AtmosDirection.West => Angle.FromDegrees(270),
AtmosDirection.South => Angle.FromDegrees(0), AtmosDirection.South => Angle.FromDegrees(0),
AtmosDirection.NorthEast => Angle.FromDegrees(135), AtmosDirection.NorthEast => Angle.FromDegrees(135),
AtmosDirection.NorthWest => Angle.FromDegrees(-135), AtmosDirection.NorthWest => Angle.FromDegrees(205),
AtmosDirection.SouthWest => Angle.FromDegrees(-45), AtmosDirection.SouthWest => Angle.FromDegrees(315),
AtmosDirection.SouthEast => Angle.FromDegrees(45), AtmosDirection.SouthEast => Angle.FromDegrees(45),
_ => throw new ArgumentOutOfRangeException(nameof(direction), $"It was {direction}."), _ => throw new ArgumentOutOfRangeException(nameof(direction), $"It was {direction}."),

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix
message: Having four edge firelocks in a single tile no longer destroys any air within it.

View File

@@ -53,6 +53,7 @@
openTimeTwo: 0.6 openTimeTwo: 0.6
startOpen: true startOpen: true
bumpOpen: false bumpOpen: false
inhibitCrush: false
- type: Firelock - type: Firelock
- type: Appearance - type: Appearance
visuals: visuals:
@@ -88,6 +89,7 @@
components: components:
- type: Door - type: Door
occludes: false occludes: false
inhibitCrush: false
- type: Occluder - type: Occluder
enabled: false enabled: false
- type: Sprite - type: Sprite
@@ -100,13 +102,14 @@
components: components:
- type: Door - type: Door
occludes: false occludes: false
inhibitCrush: true inhibitCrush: false
- type: Sprite - type: Sprite
sprite: Constructible/Structures/Doors/edge_door_hazard.rsi sprite: Constructible/Structures/Doors/edge_door_hazard.rsi
- type: Airtight - type: Airtight
fixVacuum: true fixVacuum: true
noAirWhenFullyAirBlocked: false
airBlockedDirection: airBlockedDirection:
- East - South
- type: Physics - type: Physics
fixtures: fixtures:
- shape: - shape: