Files
OldThink/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs
ThereDrD0 f56e97b122 Порт атмоса с ЕЕ + пара фиксво (#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>
2024-07-24 22:40:38 +03:00

73 lines
4.9 KiB
C#

using Content.Shared.CCVar;
using Robust.Shared.Configuration;
namespace Content.Server.Atmos.EntitySystems
{
public sealed partial class AtmosphereSystem
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
public bool SpaceWind { get; private set; }
public float SpaceWindPressureForceDivisorThrow { get; private set; }
public float SpaceWindPressureForceDivisorPush { get; private set; }
public float SpaceWindMaxVelocity { get; private set; }
public float SpaceWindMaxPushForce { get; private set; }
public float SpaceWindMinimumCalculatedMass { get; private set; }
public float SpaceWindMaximumCalculatedInverseMass { get; private set; }
public bool MonstermosUseExpensiveAirflow { get; private set; }
public bool MonstermosEqualization { get; private set; }
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; }
public float SpacingMaxWind { get; private set; }
public bool Superconduction { get; private set; }
public bool ExcitedGroups { get; private set; }
public bool ExcitedGroupsSpaceIsAllConsuming { get; private set; }
public float AtmosMaxProcessTime { get; private set; }
public float AtmosTickRate { get; private set; }
public float Speedup { get; private set; }
public float HeatScale { get; private set; }
public float HumanoidThrowMultiplier { get; private set; }
/// <summary>
/// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt
/// instead of this value, because atmos devices do not update each are sub-update and sometimes are skipped to
/// meet the tick deadline.
/// </summary>
public float AtmosTime => 1f / AtmosTickRate;
private void InitializeCVars()
{
Subs.CVar(_cfg, CCVars.SpaceWind, value => SpaceWind = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindPressureForceDivisorThrow, value => SpaceWindPressureForceDivisorThrow = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindPressureForceDivisorPush, value => SpaceWindPressureForceDivisorPush = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindMaxVelocity, value => SpaceWindMaxVelocity = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindMaxPushForce, value => SpaceWindMaxPushForce = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindMinimumCalculatedMass, value => SpaceWindMinimumCalculatedMass = value, true);
Subs.CVar(_cfg, CCVars.SpaceWindMaximumCalculatedInverseMass, value => SpaceWindMaximumCalculatedInverseMass = value, true);
Subs.CVar(_cfg, CCVars.MonstermosUseExpensiveAirflow, value => MonstermosUseExpensiveAirflow = value, true);
Subs.CVar(_cfg, CCVars.MonstermosEqualization, value => MonstermosEqualization = value, true);
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);
Subs.CVar(_cfg, CCVars.AtmosSpacingMaxWind, value => SpacingMaxWind = value, true);
Subs.CVar(_cfg, CCVars.Superconduction, value => Superconduction = value, true);
Subs.CVar(_cfg, CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true);
Subs.CVar(_cfg, CCVars.AtmosTickRate, value => AtmosTickRate = value, true);
Subs.CVar(_cfg, CCVars.AtmosSpeedup, value => Speedup = value, true);
Subs.CVar(_cfg, CCVars.AtmosHeatScale, value => { HeatScale = value; InitializeGases(); }, true);
Subs.CVar(_cfg, CCVars.ExcitedGroups, value => ExcitedGroups = value, true);
Subs.CVar(_cfg, CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true);
Subs.CVar(_cfg, CCVars.AtmosHumanoidThrowMultiplier, value => HumanoidThrowMultiplier = value, true);
}
}
}