mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description
This PR fixes all remaining bugs with Space Wind, while providing
extremely significant performance improvements by way of aggressive
early exits, and also completely reworking how pressure moved entities
are tracked(The server now caches entities under active air movements).
I haven't profiled it yet, but the performance improvements are
extremely noticeable on the machine I'm running in comparison to before,
which is particularly noteworthy since previous versions of space wind
caused significant frame drops in testing on my monster rig. While this
new update to space wind straight up doesn't even budge the tickrate on
my machine anymore.
I had to also rip out some of Monstermos' Guts, and deprecate the
tileripping system. In the future, Tile-ripping will be handled by MAS.
Also, MAS outright no longer requires Monstermos to work, and can
operate entirely off of the much cheaper LINDA system. However, while
LINDA is cheaper, Monstermos is needed for handling "Extra violent air".
Eventually I can do away with Monstermos entirely, and have it replaced
with an airflow system that outright does not require pathfinding
algorithms.
# Changelog
🆑
- fix: Fixed a bug where items thrown by space wind could remain in air
for as long as 500 seconds. Items thrown by space wind can now remain in
the air for a maximum of 2 seconds past the last time they were thrown.
- fix: DRAMATICALLY IMPROVED SPACE WIND PERFORMANCE.
- tweak: ShowAtmos command now shows vectors representing the exact
direction space wind at a given tile is trying to throw objects! The
length of the lines shown directly correspond to how powerful the flow
of air is at that tile. Shorter lines = shorter throws. Longer lines =
more powerful throws. These are also no longer restricted to compass
directions, and can point in arbitrarily any direction on a circle.
- tweak: Space Wind now no longer has Monstermos as a hard requirement.
It'll be as weak as a toddler without it, but if you're running your
server on a toaster, you can turn off Monstermos and still have working
space wind.
- tweak: Wreckages in space are now never airtight. I'm sorry, but this
was basically the cost I had to pay in exchange for making Atmos no
longer even on the top 20 systems for server tickrate cost.
(cherry picked from commit 2fcc806423a259fd75977b78350c2232a823739b)
149 lines
4.6 KiB
C#
149 lines
4.6 KiB
C#
using Content.Server.Atmos.Components;
|
|
using Content.Server.Atmos.EntitySystems;
|
|
using Content.Shared.Atmos;
|
|
using System.Numerics;
|
|
|
|
namespace Content.Server.Atmos;
|
|
|
|
/// <summary>
|
|
/// Internal Atmos class that stores data about the atmosphere in a grid.
|
|
/// You shouldn't use this directly, use <see cref="AtmosphereSystem"/> instead.
|
|
/// </summary>
|
|
[Access(typeof(AtmosphereSystem), typeof(GasTileOverlaySystem), typeof(AtmosDebugOverlaySystem))]
|
|
public sealed class TileAtmosphere : IGasMixtureHolder
|
|
{
|
|
[ViewVariables]
|
|
public int ArchivedCycle;
|
|
|
|
[ViewVariables]
|
|
public int CurrentCycle;
|
|
|
|
[ViewVariables]
|
|
public float Temperature { get; set; } = Atmospherics.T20C;
|
|
|
|
[ViewVariables]
|
|
public float TemperatureArchived { get; set; } = Atmospherics.T20C;
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public float HeatCapacity { get; set; } = Atmospherics.MinimumHeatCapacity;
|
|
|
|
[ViewVariables]
|
|
public float ThermalConductivity { get; set; } = 0.05f;
|
|
|
|
[ViewVariables]
|
|
public bool Excited { get; set; }
|
|
|
|
/// <summary>
|
|
/// Whether this tile should be considered space.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool Space { get; set; }
|
|
|
|
/// <summary>
|
|
/// Adjacent tiles in the same order as <see cref="AtmosDirection"/>. (NSEW)
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public readonly TileAtmosphere?[] AdjacentTiles = new TileAtmosphere[Atmospherics.Directions];
|
|
|
|
/// <summary>
|
|
/// Neighbouring tiles to which air can flow. This is a combination of this tile's unblocked direction, and the
|
|
/// unblocked directions on adjacent tiles.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public AtmosDirection AdjacentBits = AtmosDirection.Invalid;
|
|
|
|
[ViewVariables, Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)]
|
|
public MonstermosInfo MonstermosInfo;
|
|
|
|
[ViewVariables]
|
|
public Hotspot Hotspot;
|
|
|
|
// For debug purposes.
|
|
[ViewVariables]
|
|
public Vector2 LastPressureDirection;
|
|
|
|
[ViewVariables]
|
|
[Access(typeof(AtmosphereSystem))]
|
|
public EntityUid GridIndex { get; set; }
|
|
|
|
[ViewVariables]
|
|
public Vector2i GridIndices;
|
|
|
|
[ViewVariables]
|
|
public ExcitedGroup? ExcitedGroup { get; set; }
|
|
|
|
/// <summary>
|
|
/// The air in this tile. If null, this tile is completely air-blocked.
|
|
/// This can be immutable if the tile is spaced.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
[Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
|
public GasMixture? Air { get; set; }
|
|
|
|
[DataField("lastShare")]
|
|
public float LastShare;
|
|
|
|
[ViewVariables]
|
|
public readonly float[] MolesArchived = new float[Atmospherics.AdjustedNumberOfGases];
|
|
|
|
GasMixture IGasMixtureHolder.Air
|
|
{
|
|
get => Air ?? new GasMixture(Atmospherics.CellVolume){ Temperature = Temperature };
|
|
set => Air = value;
|
|
}
|
|
|
|
[ViewVariables]
|
|
public float MaxFireTemperatureSustained { get; set; }
|
|
|
|
/// <summary>
|
|
/// If true, then this tile is directly exposed to the map's atmosphere, either because the grid has no tile at
|
|
/// this position, or because the tile type is not airtight.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool MapAtmosphere;
|
|
|
|
/// <summary>
|
|
/// If true, this tile does not actually exist on the grid, it only exists to represent the map's atmosphere for
|
|
/// adjacent grid tiles.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool NoGridTile;
|
|
|
|
/// <summary>
|
|
/// If true, this tile is queued for processing in <see cref="GridAtmosphereComponent.PossiblyDisconnectedTiles"/>
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool TrimQueued;
|
|
|
|
/// <summary>
|
|
/// Cached information about airtight entities on this tile. This gets updated anytime a tile gets invalidated
|
|
/// (i.e., gets added to <see cref="GridAtmosphereComponent.InvalidatedCoords"/>).
|
|
/// </summary>
|
|
public AtmosphereSystem.AirtightData AirtightData;
|
|
|
|
public TileAtmosphere(EntityUid gridIndex, Vector2i gridIndices, GasMixture? mixture = null, bool immutable = false, bool space = false)
|
|
{
|
|
GridIndex = gridIndex;
|
|
GridIndices = gridIndices;
|
|
Air = mixture;
|
|
Space = space;
|
|
|
|
if(immutable)
|
|
Air?.MarkImmutable();
|
|
}
|
|
|
|
public TileAtmosphere() { }
|
|
|
|
public TileAtmosphere(TileAtmosphere other)
|
|
{
|
|
GridIndex = other.GridIndex;
|
|
GridIndices = other.GridIndices;
|
|
Space = other.Space;
|
|
NoGridTile = other.NoGridTile;
|
|
MapAtmosphere = other.MapAtmosphere;
|
|
Air = other.Air?.Clone();
|
|
Array.Copy(other.MolesArchived, MolesArchived, MolesArchived.Length);
|
|
}
|
|
}
|