Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space Wind Version 3 #1537

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Space Wind Version 2
VMSolidus committed Jan 14, 2025
commit 3b44ce3a3868be2e0dbe17244b2ca6e4dcb2f56f
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ public sealed partial class AtmosphereSystem
public bool MonstermosDepressurization { get; private set; }
public bool MonstermosRipTiles { get; private set; }
public float MonstermosRipTilesMinimumPressure { get; private set; }
public float MonstermosRipTilesPressureOffset { get; private set; }
public bool GridImpulse { get; private set; }
public float SpacingEscapeRatio { get; private set; }
public float SpacingMinGas { get; private set; }
@@ -54,7 +53,6 @@ private void InitializeCVars()
Subs.CVar(_cfg, CCVars.MonstermosDepressurization, value => MonstermosDepressurization = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTiles, value => MonstermosRipTiles = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTilesMinimumPressure, value => MonstermosRipTilesMinimumPressure = value, true);
Subs.CVar(_cfg, CCVars.MonstermosRipTilesPressureOffset, value => MonstermosRipTilesPressureOffset = value, true);
Subs.CVar(_cfg, CCVars.AtmosGridImpulse, value => GridImpulse = value, true);
Subs.CVar(_cfg, CCVars.AtmosSpacingEscapeRatio, value => SpacingEscapeRatio = value, true);
Subs.CVar(_cfg, CCVars.AtmosSpacingMinGas, value => SpacingMinGas = value, true);

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -685,14 +685,14 @@ private void AdjustEqMovement(TileAtmosphere tile, AtmosDirection direction, flo
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);
}

Original file line number Diff line number Diff line change
@@ -381,7 +381,7 @@ private bool ProcessExcitedGroups(
return true;
}

private bool ProcessHighPressureDelta(Entity<GridAtmosphereComponent> ent)
private bool ProcessHighPressureDelta(Entity<GridAtmosphereComponent> ent, float frameTime)
{
var atmosphere = ent.Comp;
if (!atmosphere.ProcessingPaused)
@@ -397,7 +397,7 @@ private bool ProcessHighPressureDelta(Entity<GridAtmosphereComponent> ent)

while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
{
HighPressureMovements(ent, tile, bodies, xforms, pressureQuery, metas);
HighPressureMovements(ent, tile, bodies, xforms, pressureQuery, metas, frameTime);
tile.PressureDifference = 0f;
tile.LastPressureDirection = tile.PressureDirection;
tile.PressureDirection = AtmosDirection.Invalid;
@@ -647,7 +647,7 @@ private void UpdateProcessing(float frameTime)
atmosphere.State = AtmosphereProcessingState.HighPressureDelta;
continue;
case AtmosphereProcessingState.HighPressureDelta:
if (!ProcessHighPressureDelta((ent, ent)))
if (!ProcessHighPressureDelta((ent, ent), frameTime))
{
atmosphere.ProcessingPaused = true;
return;
16 changes: 6 additions & 10 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
@@ -1361,6 +1361,9 @@ public static readonly CVarDef<bool>
public static readonly CVarDef<bool> SpaceWind =
CVarDef.Create("atmos.space_wind", true, CVar.SERVERONLY);

public static readonly CVarDef<float> SpaceWindStrengthMultiplier =
CVarDef.Create("atmos.space_wind_strength_multiplier", 1f, CVar.SERVERONLY);

/// <summary>
/// Divisor from maxForce (pressureDifference * 2.25f) to force applied on objects.
/// </summary>
@@ -1396,7 +1399,7 @@ public static readonly CVarDef<bool>
/// And maybe do your part to fix that? :)
/// </remarks>
public static readonly CVarDef<float> SpaceWindMinimumCalculatedMass =
CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 10f, CVar.SERVERONLY);
CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 5f, CVar.SERVERONLY);

/// <summary>
/// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold.
@@ -1433,14 +1436,7 @@ public static readonly CVarDef<bool>
/// This should be set by default to the cube of the game's lowest mass tile as defined in their prototypes, but can be increased for server performance reasons
/// </summary>
public static readonly CVarDef<float> MonstermosRipTilesMinimumPressure =
CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 7500f, CVar.SERVERONLY);

/// <summary>
/// Taken after the minimum pressure is checked, the effective pressure is multiplied by this amount.
/// This allows server hosts to finely tune how likely floor tiles are to be ripped apart by air pressure
/// </summary>
public static readonly CVarDef<float> MonstermosRipTilesPressureOffset =
CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 0.44f, CVar.SERVERONLY);
CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 20f, CVar.SERVERONLY);

/// <summary>
/// Whether explosive depressurization will cause the grid to gain an impulse.
@@ -1476,7 +1472,7 @@ public static readonly CVarDef<bool>
/// This solves the problem of objects being trapped in an infinite loop of slamming into a wall repeatedly.
/// </summary>
public static readonly CVarDef<bool> MonstermosUseExpensiveAirflow =
CVarDef.Create("atmos.mmos_expensive_airflow", true, CVar.SERVERONLY);
CVarDef.Create("atmos.mmos_expensive_airflow", false, CVar.SERVERONLY);

/// <summary>
/// Whether atmos superconduction is enabled.
Original file line number Diff line number Diff line change
@@ -90,7 +90,8 @@ private void OnItemToggleMapInit(EntityUid uid, ItemToggleDamageOtherOnHitCompon

private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
{
if (component.HitQuantity >= component.MaxHitQuantity)
if (TerminatingOrDeleted(args.Target)
|| component.HitQuantity >= component.MaxHitQuantity)
return;

var modifiedDamage = _damageable.TryChangeDamage(args.Target, GetDamage(uid, component, args.Component.Thrower),
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Objects/Misc/tiles.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
- type: Item
sprite: Objects/Tiles/tile.rsi
size: Normal
- type: EmbeddableProjectile
- type: DamageOtherOnHit
damage:
types:
102 changes: 0 additions & 102 deletions Resources/Prototypes/Tiles/floors.yml

Large diffs are not rendered by default.