diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 6495373c1b..4693761b33 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -13,6 +13,7 @@ namespace Content.Server.Atmos.EntitySystems public bool MonstermosEqualization { get; private set; } public bool MonstermosDepressurization { get; private set; } public bool MonstermosRipTiles { get; private set; } + public bool GridImpulse { get; private set; } public bool Superconduction { get; private set; } public bool ExcitedGroupsSpaceIsAllConsuming { get; private set; } public float AtmosMaxProcessTime { get; private set; } @@ -26,6 +27,7 @@ namespace Content.Server.Atmos.EntitySystems _cfg.OnValueChanged(CCVars.MonstermosEqualization, value => MonstermosEqualization = value, true); _cfg.OnValueChanged(CCVars.MonstermosDepressurization, value => MonstermosDepressurization = value, true); _cfg.OnValueChanged(CCVars.MonstermosRipTiles, value => MonstermosRipTiles = value, true); + _cfg.OnValueChanged(CCVars.AtmosGridImpulse, value => GridImpulse = value, true); _cfg.OnValueChanged(CCVars.Superconduction, value => Superconduction = value, true); _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true); _cfg.OnValueChanged(CCVars.AtmosTickRate, value => AtmosTickRate = value, true); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index 68101922b0..2535ecb9e9 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Content.Server.Atmos.Components; using Content.Server.Coordinates.Helpers; using Content.Shared.Atmos; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -462,6 +463,17 @@ namespace Content.Server.Atmos.EntitySystems HandleDecompressionFloorRip(mapGrid, otherTile, sum); } + if (GridImpulse && tileCount > 0) + { + var direction = ((Vector2)tiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized; + + var gridPhysics = ComponentManager.GetComponent(mapGrid.GridEntityId); + + // TODO ATMOS: Come up with better values for these. + gridPhysics.ApplyLinearImpulse(direction * totalGasesRemoved * gridPhysics.Mass); + gridPhysics.ApplyAngularImpulse(Vector2.Cross(tile.GridIndices - gridPhysics.LocalCenter, direction) * totalGasesRemoved); + } + ArrayPool.Shared.Return(tiles); ArrayPool.Shared.Return(spaceTiles); ArrayPool.Shared.Return(progressionOrder); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 4677de532a..5ca08cdbe2 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -269,6 +269,14 @@ namespace Content.Shared.CCVar public static readonly CVarDef MonstermosRipTiles = CVarDef.Create("atmos.monstermos_rip_tiles", true, CVar.SERVERONLY); + /// + /// Whether explosive depressurization will cause the grid to gain an impulse. + /// Needs and to be enabled to work. + /// + public static readonly CVarDef AtmosGridImpulse = + CVarDef.Create("atmos.grid_impulse", false, CVar.SERVERONLY); + + /// /// Whether atmos superconduction is enabled. ///