reverted illegal code added by oniks

This commit is contained in:
Valtos
2024-09-19 14:23:49 +03:00
parent 17e2020f14
commit ebb15a911b
9 changed files with 79 additions and 254 deletions

View File

@@ -5,11 +5,8 @@ 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
@@ -139,7 +136,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 (!MonstermosUseExpensiveAirflow && giverTilesLength > logN && takerTilesLength > logN)
if (giverTilesLength > logN && takerTilesLength > logN)
{
// Even if it fails, it will speed up the next part.
Array.Sort(_equalizeTiles, 0, tileCount, _monstermosComparer);
@@ -552,8 +549,7 @@ namespace Content.Server.Atmos.EntitySystems
}
InvalidateVisuals(ent, otherTile);
if (MonstermosRipTiles && otherTile.PressureDifference > MonstermosRipTilesMinimumPressure)
HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.PressureDifference);
HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.MonstermosInfo.CurrentTransferAmount);
}
if (GridImpulse && tileCount > 0)
@@ -685,14 +681,14 @@ namespace Content.Server.Atmos.EntitySystems
adj.MonstermosInfo[idx.ToOppositeDir()] -= amount;
}
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float delta)
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float sum)
{
if (!mapGrid.TryGetTileRef(tile.GridIndices, out var tileRef))
if (!MonstermosRipTiles)
return;
var tileref = tileRef.Tile;
var tileDef = (ContentTileDefinition) _tileDefinitionManager[tileref.TypeId];
if (!tileDef.Reinforced && tileDef.TileRipResistance < delta * MonstermosRipTilesPressureOffset)
var chance = MathHelper.Clamp(0.01f + (sum / SpacingMaxWind) * 0.3f, 0.003f, 0.3f);
if (sum > 20 && _robustRandom.Prob(chance))
PryTile(mapGrid, tile.GridIndices);
}