Порт атмоса с ЕЕ + пара фиксво (#491)

* fix a lot of spaces in shuttle call reason

* fix tts fatal without api url

* Physics Based Air Throws (#342)

I've made it so that when a room is explosively depressurized(or when a
body of high pressure air flows into one of lower pressure air), that
entities inside are launched by the air pressure with effects according
to their mass. An entity's mass is now used as an innate resistance to
forced movement by airflow, and more massive entities are both less
likely to be launched, and will launch less far than others. While
lighter entities are launched far more easily, and will shoot off into
space quite quickly! Spacing departments has never been so exciting!
This can be made extraordinarily fun if more objects are given the
ability to injure people when colliding with them at high speeds.

As a note, Humans are very unlikely to be sucked into space at a typical
force generated from a 101kpa room venting into 0kpa, unless they
happened to be standing right next to the opening to space when it was
created. The same cannot be said for "Lighter-Than-Human" species such
as Felinids and Harpies. I guess that's just the price to pay for being
cute. :)

On a plus side, because the math behind this is simplified even further
than it was before, this actually runs more efficiently than the
previous system.

Nothing, this is basically done. I've spent a good 6 hours straight
finely tuning the system until I was satisfied that it reflects
something close to reality.

**Before the Space Wind Rework:**

https://github.com/Simple-Station/Einstein-Engines/assets/16548818/0bf56c50-58e6-4aef-97f8-027fbe62331e

**With this Rework:**

https://github.com/Simple-Station/Einstein-Engines/assets/16548818/6be507a9-e9de-4bb8-9d46-8b7c83ed5f1d

🆑 VMSolidus
- add: Atmospheric "Throws" are now calculated using object mass, and
behave accordingly. Tiny objects will shoot out of rooms quite fast!

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>

* fixes

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
This commit is contained in:
ThereDrD0
2024-07-24 22:40:38 +03:00
committed by GitHub
parent c4ed22638b
commit f56e97b122
11 changed files with 262 additions and 87 deletions

View File

@@ -5,11 +5,13 @@ using Content.Server.Doors.Systems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Database;
using Content.Shared.Maps;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server.Atmos.EntitySystems
{
public sealed partial class AtmosphereSystem
@@ -137,7 +139,7 @@ namespace Content.Server.Atmos.EntitySystems
var logN = MathF.Log2(tileCount);
// Optimization - try to spread gases using an O(n log n) algorithm that has a chance of not working first to avoid O(n^2)
if (giverTilesLength > logN && takerTilesLength > logN)
if (!MonstermosUseExpensiveAirflow && giverTilesLength > logN && takerTilesLength > logN)
{
// Even if it fails, it will speed up the next part.
Array.Sort(_equalizeTiles, 0, tileCount, _monstermosComparer);
@@ -550,7 +552,8 @@ namespace Content.Server.Atmos.EntitySystems
}
InvalidateVisuals(ent, otherTile);
HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.MonstermosInfo.CurrentTransferAmount);
if (MonstermosRipTiles && otherTile.PressureDifference > MonstermosRipTilesMinimumPressure)
HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.PressureDifference);
}
if (GridImpulse && tileCount > 0)
@@ -682,14 +685,14 @@ namespace Content.Server.Atmos.EntitySystems
adj.MonstermosInfo[idx.ToOppositeDir()] -= amount;
}
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float sum)
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float delta)
{
if (!MonstermosRipTiles)
if (!mapGrid.TryGetTileRef(tile.GridIndices, out var tileRef))
return;
var tileref = tileRef.Tile;
var chance = MathHelper.Clamp(0.01f + (sum / SpacingMaxWind) * 0.3f, 0.003f, 0.3f);
if (sum > 20 && _robustRandom.Prob(chance))
var tileDef = (ContentTileDefinition) _tileDefinitionManager[tileref.TypeId];
if (!tileDef.Reinforced && tileDef.TileRipResistance < delta * MonstermosRipTilesPressureOffset)
PryTile(mapGrid, tile.GridIndices);
}