Files
wwdpublic/Content.Server/Atmos/EntitySystems/AtmosphereSystem.MAS.cs
Spatison 0f88cb6f4f Upstream 12.07-23.07 (#695)
* Make All Jetpacks Go on Suit Storage + Combat First Aid Kit Easier to Find (#2501)

make all jetpacks go on suit storage aswell

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
(cherry picked from commit f3e58032028de79a9ede1171ec27b7b0dec6f087)

make combat FAK easier to find

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
(cherry picked from commit d989dd1edb40837037e6eded435b66c0764bf1b3)

* Automatic Changelog Update (#2501)

(cherry picked from commit 3179e7d346aadf0735a1262d99db5c84373b4a14)

* Automatic Changelog Update (#2492)

(cherry picked from commit e113f7e9eb8d5b39b3457b9aee93e2a97505e2af)

* PDA Passport Slots (#2499)

# Description

By request from Ghost581 on behalf of Hullrot. I'll let the image speak
for itself. Your passport won't automatically spawn in the PDA, but to
be honest it's a space station 13 tradition that the ID shouldn't spawn
there either, so I don't wanna hear any complaints about it lol.

![image](https://github.com/user-attachments/assets/c22e58ef-3421-460b-a8ad-54ecdfedd3b8)

# Changelog

🆑
- add: Added a PDA slot for storing your character's passport.

Signed-off-by: VMSolidus <evilexecutive@gmail.com>

(cherry picked from commit 016768d5e66b012d17c830c12b75e1cc18f6215a)

* Automatic Changelog Update (#2499)

(cherry picked from commit 9d5ddc78a360a4418f97c472fe55228338947683)

* Fix Traits Anticheat (#2502)

# Description

Traits Anticheat was not accounting for traits having variable slot
occupancy, and was treating the "0 slot traits" as if they always had a
slot cost of 1. This PR corrects this by making it count the actual slot
costs of traits for the purpose of checking for illegal totals.

# Changelog

🆑
- fix: Fixed a bug with Traits Anticheat incorrectly triggering if the
player had selected enough 0 slot traits.

(cherry picked from commit 13eb1351b81f16fe26dc3fa14c9b05a8da600a31)

* Automatic Changelog Update (#2502)

(cherry picked from commit 3620f0ae93dae51ca425ef51802273270993ccae)

* Update Credits (#2504)

Co-authored-by: SimpleStation Changelogs <SimpleStation14@users.noreply.github.com>
(cherry picked from commit d1611704b5e69e66997e62d728e8a07c61a101b4)

* Fix SpaceWindv5 Wall Smoothing (#2506)

Update AtmosphereSystem.MAS.cs

(cherry picked from commit b4c3450331e4f2b8f4f5aabb6761d6ad13ad369f)

* Automatic Changelog Update (#2506)

(cherry picked from commit b3b26a48554cb528f5f4eb43cffafd8dd2dcbdb4)

* Fix Wizden's Division By Zero Error (#2507)

Update GunComponent.cs

(cherry picked from commit f36d91391b5c5a18c2f95da0ff3c2f1ea52b6914)

* Disable Contraband Examine (#2511)

Who fucking added this?

(cherry picked from commit ce2a85ccc1ca1d146f3ed627c4483d8b3db34d90)

* fix: emergency shuttle docked announcement

(cherry picked from commit 559b37d747e14698c2e4fcf4359f45dee0ad8aea)

* fix: non-functioning mining shuttle

(cherry picked from commit 4fc049036a1a8c6839d9bfc8c35f6a8374d79059)

* Disable shadows for observer pointlight (#36897)

no shadows

(cherry picked from commit b3b6d4731078950d3e3a8b1558ec0ab7d6cbbcb1)
(cherry picked from commit 470ded5b22e7a1a8d4296ba210cd05f5c217f138)

* Fix observer pointlights being broken (#37335)

(cherry picked from commit dfc8934782045106b07ccf1de6ee4e66d4aa4cb2)
(cherry picked from commit 11e0ed317b662f80ca7e4a754e183b18cde3506b)

* Automatic Changelog Update (#2512)

(cherry picked from commit 0cc861ac096ad5005f36528b7c02c8e612f5df37)

---------

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
Co-authored-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
Co-authored-by: SimpleStation Changelogs <SimpleStation14@users.noreply.github.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
2025-07-23 15:29:58 +03:00

86 lines
4.6 KiB
C#

using Content.Server.Atmos.Components;
using System.Numerics;
using Robust.Shared.Map.Components;
using Content.Shared.Atmos;
namespace Content.Server.Atmos.EntitySystems;
// WELCOME TO THE MATRIX AIRFLOW SYSTEM.
public sealed partial class AtmosphereSystem
{
# pragma warning disable IDE1006
/// <summary>
/// The standard issue "Search Pattern" used by the Matrix Airflow System.
/// </summary>
private readonly List<(int, int, AtmosDirection)> MASSearchPattern = new List<(int, int, AtmosDirection)>
{
(-1,1, AtmosDirection.SouthEast), (0,1, AtmosDirection.South), (1,1, AtmosDirection.SouthWest),
(-1,0, AtmosDirection.East), (1,0, AtmosDirection.West),
(-1,-1, AtmosDirection.NorthEast), (0,-1, AtmosDirection.North), (1,-1, AtmosDirection.NorthWest)
};
# pragma warning restore IDE1006
/// <summary>
/// This function solves for the flow of air across a given tile, expressed in the format of (Vector) kg/ms^2.
/// Multiply this output against any "Area"(such as a human cross section) in the form of meters squared to get the force of air flowing against that object in Newtons.
/// From there, you can divide by the object's mass (in kg) to get the object's acceleration in meters per second squared.
/// To solve for the object's change in velocity per CPU tick, you then multiply by frameTime to get Delta-V.
/// </summary>
/// <remarks>
/// This function is a direct implementation of the Navier-Stokes system of partial differential equations.
/// Simplified since we don't need to account for fluid viscosity(yet) as this is currently only being used to handle breathable atmosphere.
/// </remarks>
public Vector2 GetPressureVectorFromTile(GridAtmosphereComponent gridAtmos, TileAtmosphere tile)
{
if (!HasComp<MapGridComponent>(tile.GridIndex))
return new Vector2(0, 0);
var centerPressure = tile.AirArchived?.Pressure ?? 0f;
var pressureVector = new Vector2(0, 0);
foreach (var (x, y, dir) in MASSearchPattern)
{
// Create a new "Integer Vector2" using the search pattern, which will first be used to search the matrix of air tiles via its index.
// It'll be normalized immediately after that check is performed.
var offsetVector = new Vector2(x, y);
offsetVector.Normalize();
// If the tile checked doesn't exist, or has no air, or it's space,
// then there's nothing to "push back" against our center tile's air.
if (!gridAtmos.Tiles.TryGetValue(tile.GridIndices + (x, y), out var tileAtmosphere)
|| tileAtmosphere.Space)
{
pressureVector += offsetVector * centerPressure;
if (!gridAtmos.Tiles.TryGetValue(tile.GridIndices - (x, y), out var opposingTile)
|| opposingTile.AirArchived is null)
continue;
pressureVector += offsetVector * (opposingTile.AirArchived.Pressure - centerPressure);
continue;
}
// If the tile checked is blocking airflow from this direction, the center tile's air "Bounces" off it and into the
// opposite direction.
if (tileAtmosphere.AirtightData.BlockedDirections is AtmosDirection.All
|| tileAtmosphere.AirtightData.BlockedDirections.HasFlag(dir)
|| tileAtmosphere.AirArchived is null)
{
pressureVector -= offsetVector * centerPressure;
if (!gridAtmos.Tiles.TryGetValue(tile.GridIndices - (x, y), out var opposingTile)
|| opposingTile.AirArchived is null)
continue;
pressureVector += offsetVector * (opposingTile.AirArchived.Pressure - centerPressure);
continue;
}
// Center tile now transfers its pressure across the target.
var pressureDiff = centerPressure - tileAtmosphere.AirArchived.Pressure;
pressureVector += offsetVector * pressureDiff;
// And finally, the pressure in the target tile is resisting the original target pressure.
pressureVector -= offsetVector * tileAtmosphere.AirArchived.Pressure;
}
// from TCJ: By this point in the equation, all possible conditions are now checked, and for any airtight vessel with a standard atmosphere, the final output will be <0, 0>.
// Should any holes exist in the ship, the air will now flow at an exponential rate towards it, while deflecting around walls.
return pressureVector;
}
}