From 4212fbb23e025c4f94c02ce3026a8602638b0a0c Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 29 Apr 2024 07:45:41 -0400 Subject: [PATCH 01/27] Physics based air throws --- .../AtmosphereSystem.HighPressureDelta.cs | 41 +++---------------- .../Storage/Closets/base_structureclosets.yml | 6 +++ 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 53035e1ed3c..cb788f40063 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -1,14 +1,11 @@ using Content.Server.Atmos.Components; using Content.Shared.Atmos; -using Content.Shared.Audio; using Content.Shared.Mobs.Components; using Content.Shared.Physics; using Robust.Shared.Audio; using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; -using Robust.Shared.Player; -using Robust.Shared.Random; using Robust.Shared.Utility; namespace Content.Server.Atmos.EntitySystems @@ -51,8 +48,7 @@ private void UpdateHighPressure(float frameTime) comp.Accumulator = 0f; toRemove.Add(ent); - if (HasComp(uid) && - TryComp(uid, out var body)) + if (TryComp(uid, out var body)) { _physics.SetBodyStatus(body, BodyStatus.OnGround); } @@ -162,7 +158,7 @@ private void HighPressureMovements(Entity gridAtmospher (entity, pressureMovements), gridAtmosphere.Comp.UpdateCounter, tile.PressureDifference, - tile.PressureDirection, 0, + tile.PressureDirection, tile.PressureSpecificTarget != null ? _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.PressureSpecificTarget.GridIndices) : EntityCoordinates.Invalid, gridWorldRotation, xforms.GetComponent(entity), @@ -188,7 +184,6 @@ public void ExperiencePressureDifference( int cycle, float pressureDifference, AtmosDirection direction, - float pressureResistanceProbDelta, EntityCoordinates throwTarget, Angle gridWorldRotation, TransformComponent? xform = null, @@ -201,37 +196,14 @@ public void ExperiencePressureDifference( if (!Resolve(uid, ref xform)) return; - // TODO ATMOS stuns? - - var maxForce = MathF.Sqrt(pressureDifference) * 2.25f; - var moveProb = 100f; - - if (component.PressureResistance > 0) - moveProb = MathF.Abs((pressureDifference / component.PressureResistance * MovedByPressureComponent.ProbabilityBasePercent) - - MovedByPressureComponent.ProbabilityOffset); - // Can we yeet the thing (due to probability, strength, etc.) - if (moveProb > MovedByPressureComponent.ProbabilityOffset && _robustRandom.Prob(MathF.Min(moveProb / 100f, 1f)) - && !float.IsPositiveInfinity(component.MoveResist) - && (physics.BodyType != BodyType.Static - && (maxForce >= (component.MoveResist * MovedByPressureComponent.MoveForcePushRatio))) - || (physics.BodyType == BodyType.Static && (maxForce >= (component.MoveResist * MovedByPressureComponent.MoveForceForcePushRatio)))) + if (physics.BodyType != BodyType.Static && !float.IsPositiveInfinity(component.MoveResist)) { - if (HasComp(uid)) - { - AddMobMovedByPressure(uid, component, physics); - } + var moveForce = pressureDifference / physics.Mass; - if (maxForce > MovedByPressureComponent.ThrowForce) + if (moveForce > physics.Mass) { - var moveForce = maxForce; - moveForce /= (throwTarget != EntityCoordinates.Invalid) ? SpaceWindPressureForceDivisorThrow : SpaceWindPressureForceDivisorPush; - moveForce *= MathHelper.Clamp(moveProb, 0, 100); - - // Apply a sanity clamp to prevent being thrown through objects. - var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; - moveForce = MathF.Min(moveForce, maxSafeForceForObject); - + AddMobMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); @@ -243,7 +215,6 @@ public void ExperiencePressureDifference( } else { - moveForce = MathF.Min(moveForce, SpaceWindMaxPushForce); _physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics); } diff --git a/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml b/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml index 66647d168f6..d7ee462d322 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml @@ -90,6 +90,12 @@ stateDoorClosed: generic_door - type: StaticPrice price: 50 + - type: DamageOtherOnHit #If the new atmos update throws a locker at you, you're in for a bad time. Enjoy. + damage: + types: + Blunt: 25 + - type: StaminaDamageOnCollide + damage: 75 # steel closet base (that can be constructed/deconstructed) - type: entity From bddb87b26ff8926275589a5f6ca88ec028bb39b6 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 29 Apr 2024 07:54:07 -0400 Subject: [PATCH 02/27] Update base_structureclosets.yml --- .../Structures/Storage/Closets/base_structureclosets.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml b/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml index d7ee462d322..66647d168f6 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Closets/base_structureclosets.yml @@ -90,12 +90,6 @@ stateDoorClosed: generic_door - type: StaticPrice price: 50 - - type: DamageOtherOnHit #If the new atmos update throws a locker at you, you're in for a bad time. Enjoy. - damage: - types: - Blunt: 25 - - type: StaminaDamageOnCollide - damage: 75 # steel closet base (that can be constructed/deconstructed) - type: entity From 162c2848a5700167976baa59956ddbe52afa468e Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 29 Apr 2024 09:12:01 -0400 Subject: [PATCH 03/27] Updates for review --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index cb788f40063..32c0ad03b10 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -68,7 +68,7 @@ private void UpdateHighPressure(float frameTime) } } - private void AddMobMovedByPressure(EntityUid uid, MovedByPressureComponent component, PhysicsComponent body) + private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent component, PhysicsComponent body) { if (!TryComp(uid, out var fixtures)) return; @@ -179,6 +179,8 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, tile.PressureDirection = differenceDirection; } + //The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function + //And it isn't working, you've probably still got the ResistancePobDelta line included. public void ExperiencePressureDifference( Entity ent, int cycle, @@ -203,7 +205,7 @@ public void ExperiencePressureDifference( if (moveForce > physics.Mass) { - AddMobMovedByPressure(uid, component, physics); + AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); From 3374757899282fb32c4372b8dd7d215d1fcb3adb Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 29 Apr 2024 09:21:14 -0400 Subject: [PATCH 04/27] Hello, this is an asymptote. Divide by zero must be an exit condition. --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 32c0ad03b10..f453f0d5ea1 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -180,7 +180,7 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, } //The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function - //And it isn't working, you've probably still got the ResistancePobDelta line included. + //And it isn't working, you've probably still got the ResistancePobDelta line included. public void ExperiencePressureDifference( Entity ent, int cycle, @@ -199,7 +199,9 @@ public void ExperiencePressureDifference( return; // Can we yeet the thing (due to probability, strength, etc.) - if (physics.BodyType != BodyType.Static && !float.IsPositiveInfinity(component.MoveResist)) + if (physics.BodyType != BodyType.Static + && !float.IsPositiveInfinity(component.MoveResist) + && physics.Mass != 0) { var moveForce = pressureDifference / physics.Mass; From 3dc71fb95c374714a9f2f63869feed4ba094df56 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 29 Apr 2024 14:35:19 -0400 Subject: [PATCH 05/27] Adding the clamp back in --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index f453f0d5ea1..889d9584fb2 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -210,16 +210,17 @@ public void ExperiencePressureDifference( AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); + var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; // TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs. if (throwTarget != EntityCoordinates.Invalid) { var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized(); - _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); + _physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics); } else { - _physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics); + _physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics); } component.LastHighPressureMovementAirCycle = cycle; From b3c503c4eebaa53181bb6b58f517562f38d152a5 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Wed, 1 May 2024 15:51:15 -0400 Subject: [PATCH 06/27] I found another small optimization --- .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 889d9584fb2..1738f9212dc 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -203,7 +203,7 @@ public void ExperiencePressureDifference( && !float.IsPositiveInfinity(component.MoveResist) && physics.Mass != 0) { - var moveForce = pressureDifference / physics.Mass; + var moveForce = pressureDifference * physics.InvMass; if (moveForce > physics.Mass) { From 68e05100225838a470c89ce9ab02b29310e35fee Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Wed, 1 May 2024 15:54:01 -0400 Subject: [PATCH 07/27] Another one --- .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 1738f9212dc..a67eb217e51 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -200,8 +200,7 @@ public void ExperiencePressureDifference( // Can we yeet the thing (due to probability, strength, etc.) if (physics.BodyType != BodyType.Static - && !float.IsPositiveInfinity(component.MoveResist) - && physics.Mass != 0) + && !float.IsPositiveInfinity(component.MoveResist)) { var moveForce = pressureDifference * physics.InvMass; From 9e7aa5d91e3c8ae1bab1008622dc21a9ea04c627 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sat, 4 May 2024 17:24:19 -0400 Subject: [PATCH 08/27] New Cvar --- .../Atmos/EntitySystems/AtmosphereSystem.CVars.cs | 2 ++ .../AtmosphereSystem.HighPressureDelta.cs | 2 +- Content.Shared/CCVar/CCVars.cs | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 3aaa5429fb0..f3ef2be6cab 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -12,6 +12,7 @@ public sealed partial class AtmosphereSystem public float SpaceWindPressureForceDivisorPush { get; private set; } public float SpaceWindMaxVelocity { get; private set; } public float SpaceWindMaxPushForce { get; private set; } + public float SpaceWindMinimumMassThreshold { get; private set; } public bool MonstermosEqualization { get; private set; } public bool MonstermosDepressurization { get; private set; } public bool MonstermosRipTiles { get; private set; } @@ -41,6 +42,7 @@ private void InitializeCVars() 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.SpaceWindMinimumMassThreshold, value => SpaceWindMinimumMassThreshold = 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); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index a67eb217e51..64b1f02542a 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -204,7 +204,7 @@ public void ExperiencePressureDifference( { var moveForce = pressureDifference * physics.InvMass; - if (moveForce > physics.Mass) + if (moveForce > MathF.MaxMagnitude(physics.Mass, SpaceWindMinimumMassThreshold)) { AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 6427faa113f..284ac57cfa5 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1049,6 +1049,17 @@ public static readonly CVarDef public static readonly CVarDef SpaceWindMaxPushForce = CVarDef.Create("atmos.space_wind_max_push_force", 20f, CVar.SERVERONLY); + /// + /// If an object's mass is below this number, then this number is used in place of mass to determine whether air pressure can throw an object. + /// This has nothing to do with throwing force, only acting as a way of reducing the odds of tiny 5 gram objects from being yeeted by people's breath + /// + /// + /// If you are reading this because you want to change it, consider looking into why almost every item in the game weighs only 5 grams + /// And maybe do your part to fix that? :) + /// + public static readonly CVarDef SpaceWindMinimumMassThreshold = + CVarDef.Create("atmos.space_wind_minimum_mass_threshold", 10f, CVar.SERVERONLY); + /// /// Whether monstermos tile equalization is enabled. /// From 3d0326245bda042a1c4a173d9b7200c45d22fba2 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sat, 4 May 2024 17:41:50 -0400 Subject: [PATCH 09/27] Update comments for documentation --- .../AtmosphereSystem.HighPressureDelta.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 64b1f02542a..3c16a9b33b3 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -198,7 +198,19 @@ public void ExperiencePressureDifference( if (!Resolve(uid, ref xform)) return; - // Can we yeet the thing (due to probability, strength, etc.) + // EXPLANATION: + // pressureDifference = Force of Air Flow on a given tile + // physics.Mass = Mass of the object potentially being thrown + // physics.InvMass = 1 divided by said Mass. More CPU efficient way to do division. + // + // Objects can only be thrown if the force of air flow is greater than the SQUARE of their mass or {SpaceWindMinimumMassThreshold}, whichever is heavier + // This means that the heavier an object is, the exponentially more force is required to move it + // The force of a throw is equal to the force of air pressure, divided by an object's mass. So not only are heavier objects + // less likely to be thrown, they are also harder to throw. + // While lighter objects are yeeted easily, and from great distance. + // + // For a human sized entity with a standard weight of 80kg and a spacing between a hard vacuum and a room pressurized at 101kpa, + // The human shall only be moved if he is either very close to the hole, or is standing in a region of high airflow if (physics.BodyType != BodyType.Static && !float.IsPositiveInfinity(component.MoveResist)) { @@ -211,7 +223,7 @@ public void ExperiencePressureDifference( var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; - // TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs. + // TODO: Consider replacing throw target with proper trigonometry angles. if (throwTarget != EntityCoordinates.Invalid) { var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized(); From 67fdaff50836631f647a15fc50b9fd0a6e152fc6 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 6 May 2024 02:39:27 -0400 Subject: [PATCH 10/27] Apply suggestions from code review Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 3c16a9b33b3..3a96c252cd7 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -180,7 +180,7 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, } //The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function - //And it isn't working, you've probably still got the ResistancePobDelta line included. + //And it isn't working, you've probably still got the pressureResistanceProbDelta line included. public void ExperiencePressureDifference( Entity ent, int cycle, @@ -206,8 +206,8 @@ public void ExperiencePressureDifference( // Objects can only be thrown if the force of air flow is greater than the SQUARE of their mass or {SpaceWindMinimumMassThreshold}, whichever is heavier // This means that the heavier an object is, the exponentially more force is required to move it // The force of a throw is equal to the force of air pressure, divided by an object's mass. So not only are heavier objects - // less likely to be thrown, they are also harder to throw. - // While lighter objects are yeeted easily, and from great distance. + // less likely to be thrown, they are also harder to throw, + // while lighter objects are yeeted easily, and from great distance. // // For a human sized entity with a standard weight of 80kg and a spacing between a hard vacuum and a room pressurized at 101kpa, // The human shall only be moved if he is either very close to the hole, or is standing in a region of high airflow From 6cc47047edca5c71085ccdcbbdecc76bc305c93e Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Wed, 15 May 2024 23:57:38 -0400 Subject: [PATCH 11/27] MORE --- .../EntitySystems/AtmosphereSystem.CVars.cs | 6 +- .../AtmosphereSystem.HighPressureDelta.cs | 62 +++++++++++-------- Content.Shared/CCVar/CCVars.cs | 16 +++-- 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index f3ef2be6cab..211c5dd945b 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -12,7 +12,8 @@ public sealed partial class AtmosphereSystem public float SpaceWindPressureForceDivisorPush { get; private set; } public float SpaceWindMaxVelocity { get; private set; } public float SpaceWindMaxPushForce { get; private set; } - public float SpaceWindMinimumMassThreshold { get; private set; } + public float SpaceWindMinimumCalculatedMass { get; private set; } + public float SpaceWindMaximumCalculatedInverseMass { get; private set; } public bool MonstermosEqualization { get; private set; } public bool MonstermosDepressurization { get; private set; } public bool MonstermosRipTiles { get; private set; } @@ -42,7 +43,8 @@ private void InitializeCVars() 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.SpaceWindMinimumMassThreshold, value => SpaceWindMinimumMassThreshold = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindMinimumCalculatedMass, value => SpaceWindMinimumCalculatedMass = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindMaximumCalculatedInverseMass, value => SpaceWindMaximumCalculatedInverseMass = 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); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 3a96c252cd7..1f637ec951d 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -1,6 +1,5 @@ using Content.Server.Atmos.Components; using Content.Shared.Atmos; -using Content.Shared.Mobs.Components; using Content.Shared.Physics; using Robust.Shared.Audio; using Robust.Shared.Map; @@ -89,10 +88,12 @@ private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent componen private void HighPressureMovements(Entity gridAtmosphere, TileAtmosphere tile, EntityQuery bodies, EntityQuery xforms, EntityQuery pressureQuery, EntityQuery metas) { + if (tile.PressureDifference < MathF.Pow(SpaceWindMinimumCalculatedMass, 2)) + return; // TODO ATMOS finish this // Don't play the space wind sound on tiles that are on fire... - if(tile.PressureDifference > 15 && !tile.Hotspot.Valid) + if (tile.PressureDifference > 15 && !tile.Hotspot.Valid) { if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound)) { @@ -118,7 +119,8 @@ private void HighPressureMovements(Entity gridAtmospher var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation; // If we're using monstermos, smooth out the yeet direction to follow the flow - if (MonstermosEqualization) + //WTF:This is bad, don't run this. It just makes the throws worse by somehow rounding them to orthogonal + if (!MonstermosEqualization) { // We step through tiles according to the pressure direction on the current tile. // The goal is to get a general direction of the airflow in the area. @@ -179,8 +181,32 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, tile.PressureDirection = differenceDirection; } - //The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function - //And it isn't working, you've probably still got the pressureResistanceProbDelta line included. + //INFO:The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function + //INFO:And it isn't working, you've probably still got the pressureResistanceProbDelta line included. + /// + /// EXPLANATION: + /// pressureDifference = Force of Air Flow on a given tile + /// physics.Mass = Mass of the object potentially being thrown + /// physics.InvMass = 1 divided by said Mass. More CPU efficient way to do division. + /// + /// Objects can only be thrown if the force of air flow is greater than the SQUARE of their mass or {SpaceWindMinimumCalculatedMass}, whichever is heavier + /// This means that the heavier an object is, the exponentially more force is required to move it + /// The force of a throw is equal to the force of air pressure, divided by an object's mass. So not only are heavier objects + /// less likely to be thrown, they are also harder to throw, + /// while lighter objects are yeeted easily, and from great distance. + /// + /// For a human sized entity with a standard weight of 80kg and a spacing between a hard vacuum and a room pressurized at 101kpa, + /// The human shall only be moved if he is either very close to the hole, or is standing in a region of high airflow + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void ExperiencePressureDifference( Entity ent, int cycle, @@ -198,40 +224,26 @@ public void ExperiencePressureDifference( if (!Resolve(uid, ref xform)) return; - // EXPLANATION: - // pressureDifference = Force of Air Flow on a given tile - // physics.Mass = Mass of the object potentially being thrown - // physics.InvMass = 1 divided by said Mass. More CPU efficient way to do division. - // - // Objects can only be thrown if the force of air flow is greater than the SQUARE of their mass or {SpaceWindMinimumMassThreshold}, whichever is heavier - // This means that the heavier an object is, the exponentially more force is required to move it - // The force of a throw is equal to the force of air pressure, divided by an object's mass. So not only are heavier objects - // less likely to be thrown, they are also harder to throw, - // while lighter objects are yeeted easily, and from great distance. - // - // For a human sized entity with a standard weight of 80kg and a spacing between a hard vacuum and a room pressurized at 101kpa, - // The human shall only be moved if he is either very close to the hole, or is standing in a region of high airflow + if (physics.BodyType != BodyType.Static && !float.IsPositiveInfinity(component.MoveResist)) { - var moveForce = pressureDifference * physics.InvMass; - - if (moveForce > MathF.MaxMagnitude(physics.Mass, SpaceWindMinimumMassThreshold)) + var moveForce = pressureDifference * MathF.Max(physics.InvMass, SpaceWindMaximumCalculatedInverseMass); + if (moveForce > physics.Mass) { AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); - var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; // TODO: Consider replacing throw target with proper trigonometry angles. if (throwTarget != EntityCoordinates.Invalid) { - var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized(); - _physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics); + var pos = throwTarget.ToMap(EntityManager).Position - xform.WorldPosition + dirVec; + _physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, SpaceWindMaxVelocity), body: physics); } else { - _physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics); + _physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, SpaceWindMaxVelocity), body: physics); } component.LastHighPressureMovementAirCycle = cycle; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 284ac57cfa5..a63c4be9a5d 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1040,7 +1040,7 @@ public static readonly CVarDef /// Useful to prevent clipping through objects. /// public static readonly CVarDef SpaceWindMaxVelocity = - CVarDef.Create("atmos.space_wind_max_velocity", 30f, CVar.SERVERONLY); + CVarDef.Create("atmos.space_wind_max_velocity", 25f, CVar.SERVERONLY); /// /// The maximum force that may be applied to an object by pushing (i.e. not throwing) atmospheric pressure differences. @@ -1057,8 +1057,16 @@ public static readonly CVarDef /// If you are reading this because you want to change it, consider looking into why almost every item in the game weighs only 5 grams /// And maybe do your part to fix that? :) /// - public static readonly CVarDef SpaceWindMinimumMassThreshold = - CVarDef.Create("atmos.space_wind_minimum_mass_threshold", 10f, CVar.SERVERONLY); + public static readonly CVarDef SpaceWindMinimumCalculatedMass = + CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 10f, CVar.SERVERONLY); + + /// + /// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold. + /// If an object's inverse mass is lower than this, it is capped at this. Basically, an upper limit to how heavy an object can be + /// before it stops resisting space wind more. + /// + public static readonly CVarDef SpaceWindMaximumCalculatedInverseMass = + CVarDef.Create("atmos.space_wind_maximum_calculated_inverse_mass", 0.025f, CVar.SERVERONLY); /// /// Whether monstermos tile equalization is enabled. @@ -1081,7 +1089,7 @@ public static readonly CVarDef /// Also looks weird on slow spacing for unrelated reasons. If you do want to enable this, you should probably turn on instaspacing. /// public static readonly CVarDef MonstermosRipTiles = - CVarDef.Create("atmos.monstermos_rip_tiles", false, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles", true, CVar.SERVERONLY); /// /// Whether explosive depressurization will cause the grid to gain an impulse. From 54ca8cef8ba0808da2603531fe80919489629b2d Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 16 May 2024 00:05:58 -0400 Subject: [PATCH 12/27] Update AtmosphereSystem.HighPressureDelta.cs --- .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 1f637ec951d..61d6a356796 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -88,7 +88,8 @@ private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent componen private void HighPressureMovements(Entity gridAtmosphere, TileAtmosphere tile, EntityQuery bodies, EntityQuery xforms, EntityQuery pressureQuery, EntityQuery metas) { - if (tile.PressureDifference < MathF.Pow(SpaceWindMinimumCalculatedMass, 2)) + //!MAGIC EXIT CONDITION THAT MAKES ALMOST 200 LINES RUN 1/100TH AS OFTEN. + if (tile.PressureDifference < SpaceWindMinimumCalculatedMass * SpaceWindMinimumCalculatedMass) return; // TODO ATMOS finish this From 7500efd72910c56d82c850fffc0ee48738d4fa38 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 16 May 2024 00:52:47 -0400 Subject: [PATCH 13/27] guh, last push --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 6 ++++-- Content.Shared/CCVar/CCVars.cs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 61d6a356796..b64f8b4ccf3 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -232,6 +232,8 @@ public void ExperiencePressureDifference( var moveForce = pressureDifference * MathF.Max(physics.InvMass, SpaceWindMaximumCalculatedInverseMass); if (moveForce > physics.Mass) { + var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; + moveForce = MathF.Min(moveForce, maxSafeForceForObject); AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); @@ -240,11 +242,11 @@ public void ExperiencePressureDifference( if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager).Position - xform.WorldPosition + dirVec; - _physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, SpaceWindMaxVelocity), body: physics); + _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); } else { - _physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, SpaceWindMaxVelocity), body: physics); + _physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics); } component.LastHighPressureMovementAirCycle = cycle; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index a63c4be9a5d..784f87fdcb7 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1058,7 +1058,7 @@ public static readonly CVarDef /// And maybe do your part to fix that? :) /// public static readonly CVarDef SpaceWindMinimumCalculatedMass = - CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 10f, CVar.SERVERONLY); + CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 6f, CVar.SERVERONLY); /// /// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold. @@ -1066,7 +1066,7 @@ public static readonly CVarDef /// before it stops resisting space wind more. /// public static readonly CVarDef SpaceWindMaximumCalculatedInverseMass = - CVarDef.Create("atmos.space_wind_maximum_calculated_inverse_mass", 0.025f, CVar.SERVERONLY); + CVarDef.Create("atmos.space_wind_maximum_calculated_inverse_mass", 0.04f, CVar.SERVERONLY); /// /// Whether monstermos tile equalization is enabled. From 7470ba7d19c1466d027eeec6dafbf5a400f6923c Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 16 May 2024 14:52:38 -0400 Subject: [PATCH 14/27] Fix for objects getting stuck on walls, new CVar for more expensive airflow option. --- .../Atmos/EntitySystems/AtmosphereSystem.CVars.cs | 2 ++ .../Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs | 2 +- Content.Shared/CCVar/CCVars.cs | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 211c5dd945b..517fc1469b5 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -14,6 +14,7 @@ public sealed partial class AtmosphereSystem 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; } @@ -45,6 +46,7 @@ private void InitializeCVars() 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); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index aceda3cd332..ed1c877662c 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -135,7 +135,7 @@ private void EqualizePressureInZone(Entity 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); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 2da77e1b37c..449faba101f 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1169,6 +1169,13 @@ public static readonly CVarDef public static readonly CVarDef AtmosSpacingMaxWind = CVarDef.Create("atmos.mmos_max_wind", 500f, CVar.SERVERONLY); + /// + /// Increases default airflow calculations to O(n^2) complexity, for use with heavy space wind optimizations. Potato servers BEWARE + /// This solves the problem of objects being trapped in an infinite loop of slamming into a wall repeatedly. + /// + public static readonly CVarDef MonstermosUseExpensiveAirflow = + CVarDef.Create("atmos.mmos_expensive_airflow", true, CVar.SERVERONLY); + /// /// Whether atmos superconduction is enabled. /// From b32872560669f6d5543180c26f173eead8d91f12 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 16 May 2024 15:17:17 -0400 Subject: [PATCH 15/27] Update animals.yml --- .../Prototypes/Entities/Mobs/NPCs/animals.yml | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 378b3f8a9d8..d28bc4550a6 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -22,7 +22,7 @@ shape: !type:PhysShapeCircle radius: 0.25 - density: 10 + density: 0.8 mask: - FlyingMobMask layer: @@ -84,7 +84,7 @@ shape: !type:PhysShapeCircle radius: 0.1 - density: 30 + density: 0.1 mask: - FlyingMobMask layer: @@ -328,7 +328,7 @@ shape: !type:PhysShapeCircle radius: 0.2 - density: 100 + density: 0.0007 mask: - SmallMobMask layer: @@ -432,7 +432,7 @@ shape: !type:PhysShapeCircle radius: 0.2 - density: 120 + density: 0.007 mask: - SmallMobMask layer: @@ -1508,7 +1508,7 @@ shape: !type:PhysShapeCircle radius: 0.2 - density: 100 + density: 0.76 mask: - SmallMobMask layer: @@ -2417,7 +2417,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 50 #They actually are pretty light, I looked it up + density: 16.66 mask: - MobMask layer: @@ -2494,7 +2494,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 50 + density: 25.5 mask: - MobMask layer: @@ -2644,7 +2644,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 15 + density: 9 mask: - MobMask layer: @@ -2787,6 +2787,17 @@ Base: caracal_flop Dead: Base: caracal_dead + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeCircle + radius: 0.35 + density: 30 + mask: + - MobMask + layer: + - MobLayer - type: entity name: kitten @@ -2820,6 +2831,17 @@ thresholds: 0: Alive 25: Dead + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeCircle + radius: 0.35 + density: 2 + mask: + - MobMask + layer: + - MobLayer - type: entity name: sloth @@ -2900,7 +2922,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 5 + density: 4 mask: - MobMask layer: @@ -2977,7 +2999,7 @@ shape: !type:PhysShapeCircle radius: 0.2 - density: 120 + density: 0.8 mask: - SmallMobMask layer: @@ -3095,7 +3117,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 250 + density: 750 mask: - MobMask layer: @@ -3168,7 +3190,7 @@ shape: !type:PhysShapeCircle radius: 0.35 - density: 100 # High, because wood is heavy. + density: 15 mask: - MobMask layer: From f7e2f70aef16c8952eddf54aa4adea07acf93128 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 16 May 2024 15:46:17 -0400 Subject: [PATCH 16/27] Fix tiny mobs boiling themselves to death --- Content.Server/Temperature/Systems/TemperatureSystem.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/Temperature/Systems/TemperatureSystem.cs b/Content.Server/Temperature/Systems/TemperatureSystem.cs index aef4b89d509..aca902b9d38 100644 --- a/Content.Server/Temperature/Systems/TemperatureSystem.cs +++ b/Content.Server/Temperature/Systems/TemperatureSystem.cs @@ -163,8 +163,9 @@ public float GetHeatCapacity(EntityUid uid, TemperatureComponent? comp = null, P { return Atmospherics.MinimumHeatCapacity; } - - return comp.SpecificHeat * physics.FixturesMass; + if (physics.Mass < 1) + return comp.SpecificHeat; + else return comp.SpecificHeat * physics.FixturesMass; } private void OnInit(EntityUid uid, InternalTemperatureComponent comp, MapInitEvent args) From 9d81e241336ef1362869264ee403b5307613154d Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 11 Jun 2024 20:22:36 -0400 Subject: [PATCH 17/27] Initial Beta for Rip Tile Rework --- .../EntitySystems/AtmosphereSystem.CVars.cs | 2 + .../AtmosphereSystem.Monstermos.cs | 20 ++-- Content.Shared/CCVar/CCVars.cs | 7 ++ Content.Shared/Maps/ContentTileDefinition.cs | 3 + Resources/Prototypes/Tiles/floors.yml | 103 ++++++++++++++++++ 5 files changed, 127 insertions(+), 8 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 517fc1469b5..9038200a30b 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -18,6 +18,7 @@ public sealed partial class AtmosphereSystem 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 bool GridImpulse { get; private set; } public float SpacingEscapeRatio { get; private set; } public float SpacingMinGas { get; private set; } @@ -50,6 +51,7 @@ private void InitializeCVars() 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.AtmosGridImpulse, value => GridImpulse = value, true); Subs.CVar(_cfg, CCVars.AtmosSpacingEscapeRatio, value => SpacingEscapeRatio = value, true); Subs.CVar(_cfg, CCVars.AtmosSpacingMinGas, value => SpacingMinGas = value, true); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index 934fc93f468..dee2bf13467 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -5,17 +5,18 @@ 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 { [Dependency] private readonly FirelockSystem _firelockSystem = default!; - private readonly TileAtmosphereComparer _monstermosComparer = new(); private readonly TileAtmosphere?[] _equalizeTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit]; @@ -550,7 +551,8 @@ private void ExplosivelyDepressurize( } InvalidateVisuals(otherTile.GridIndex, otherTile.GridIndices, visuals); - HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.MonstermosInfo.CurrentTransferAmount); + if (MonstermosRipTiles && otherTile.PressureDifference > MonstermosRipTilesMinimumPressure) + HandleDecompressionFloorRip(mapGrid, otherTile, otherTile.PressureDifference); } if (GridImpulse && tileCount > 0) @@ -676,15 +678,17 @@ private void AdjustEqMovement(TileAtmosphere tile, AtmosDirection direction, flo adj.MonstermosInfo[direction.GetOpposite()] -= 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) + { PryTile(mapGrid, tile.GridIndices); + } } private sealed class TileAtmosphereComparer : IComparer diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 449faba101f..ac0d0614fd0 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1140,6 +1140,13 @@ public static readonly CVarDef public static readonly CVarDef MonstermosRipTiles = CVarDef.Create("atmos.monstermos_rip_tiles", true, CVar.SERVERONLY); + /// + /// Taken as the cube of a tile's mass, this acts as a minimum threshold of mass for which air pressure calculates whether or not to rip a tile from the floor + /// This should be set by default to the cube of the game's lowest mass tile as defined in .yml prototypes, but can be increased for server performance reasons + /// + public static readonly CVarDef MonstermosRipTilesMinimumPressure = + CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 125f, CVar.SERVERONLY); + /// /// Whether explosive depressurization will cause the grid to gain an impulse. /// Needs and to be enabled to work. diff --git a/Content.Shared/Maps/ContentTileDefinition.cs b/Content.Shared/Maps/ContentTileDefinition.cs index 32f5db0e821..339e9f6f39b 100644 --- a/Content.Shared/Maps/ContentTileDefinition.cs +++ b/Content.Shared/Maps/ContentTileDefinition.cs @@ -121,5 +121,8 @@ public void AssignTileId(ushort id) { TileId = id; } + + [DataField] public bool Reinforced = false; + [DataField] public float TileRipResistance = 125f; } } diff --git a/Resources/Prototypes/Tiles/floors.yml b/Resources/Prototypes/Tiles/floors.yml index b5ca240d5ca..b55eb0942fd 100644 --- a/Resources/Prototypes/Tiles/floors.yml +++ b/Resources/Prototypes/Tiles/floors.yml @@ -15,6 +15,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelCheckerLight @@ -33,6 +34,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteelCheckerLight heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelCheckerDark @@ -51,6 +53,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteelCheckerDark heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelMini @@ -69,6 +72,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelPavement @@ -87,6 +91,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelDiagonal @@ -105,6 +110,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelOffset @@ -117,6 +123,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelMono @@ -135,6 +142,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelPavementVertical @@ -153,6 +161,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelHerringbone @@ -171,6 +180,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorSteelDiagonalMini @@ -189,6 +199,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorBrassFilled @@ -201,6 +212,7 @@ collection: FootstepHull itemDrop: FloorTileItemBrassFilled heatCapacity: 10000 + tileRipResistance: 220 - type: tile id: FloorBrassReebe @@ -213,6 +225,7 @@ collection: FootstepHull itemDrop: FloorTileItemBrassReebe heatCapacity: 10000 + tileRipResistance: 220 - type: tile id: FloorPlastic @@ -231,6 +244,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWood @@ -251,6 +265,7 @@ collection: BarestepWood itemDrop: FloorTileItemWood heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhite @@ -269,6 +284,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteMini @@ -287,6 +303,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhitePavement @@ -305,6 +322,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteDiagonal @@ -323,6 +341,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteOffset @@ -335,6 +354,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteMono @@ -353,6 +373,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhitePavementVertical @@ -371,6 +392,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteHerringbone @@ -389,6 +411,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhiteDiagonalMini @@ -407,6 +430,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorWhitePlastic @@ -425,6 +449,7 @@ collection: FootstepTile itemDrop: FloorTileItemWhite heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorDark @@ -443,6 +468,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkMini @@ -461,6 +487,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkPavement @@ -479,6 +506,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkDiagonal @@ -497,6 +525,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkOffset @@ -509,6 +538,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkMono @@ -527,6 +557,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkPavementVertical @@ -545,6 +576,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkHerringbone @@ -563,6 +595,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkDiagonalMini @@ -581,6 +614,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorDarkPlastic @@ -599,6 +633,7 @@ collection: FootstepTile itemDrop: FloorTileItemDark heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorTechMaint @@ -611,6 +646,7 @@ collection: FootstepHull itemDrop: FloorTileItemTechmaint heatCapacity: 10000 + tileRipResistance: 250 - type: tile id: FloorReinforced @@ -623,6 +659,7 @@ collection: FootstepHull itemDrop: FloorTileItemReinforced heatCapacity: 10000 + reinforced: true - type: tile id: FloorMono @@ -635,6 +672,7 @@ collection: FootstepTile itemDrop: FloorTileItemMono heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorLino @@ -647,6 +685,7 @@ collection: FootstepTile itemDrop: FloorTileItemLino heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorSteelDirty @@ -659,6 +698,7 @@ collection: FootstepPlating itemDrop: FloorTileItemDirty heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorElevatorShaft @@ -671,6 +711,7 @@ collection: FootstepHull itemDrop: FloorTileItemElevatorShaft heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorMetalDiamond @@ -683,6 +724,7 @@ collection: FootstepHull itemDrop: FloorTileItemMetalDiamond heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorRockVault @@ -695,6 +737,7 @@ collection: FootstepAsteroid itemDrop: FloorTileItemRockVault heatCapacity: 10000 + tileRipResistance: 400 - type: tile id: FloorBlue @@ -707,6 +750,7 @@ collection: FootstepTile itemDrop: FloorTileItemBlue heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorSteelLime @@ -725,6 +769,7 @@ collection: FootstepFloor itemDrop: FloorTileItemLime heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorMining @@ -737,6 +782,7 @@ collection: FootstepTile itemDrop: FloorTileItemMining heatCapacity: 10000 + tileRipResistance: 250 - type: tile id: FloorMiningDark @@ -749,6 +795,7 @@ collection: FootstepTile itemDrop: FloorTileItemMiningDark heatCapacity: 10000 + tileRipResistance: 250 - type: tile id: FloorMiningLight @@ -761,6 +808,7 @@ collection: FootstepTile itemDrop: FloorTileItemMiningLight heatCapacity: 10000 + tileRipResistance: 250 # Departamental - type: tile @@ -774,6 +822,7 @@ collection: FootstepHull itemDrop: FloorTileItemFreezer heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorShowroom @@ -786,6 +835,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShowroom heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorHydro @@ -798,6 +848,7 @@ collection: FootstepFloor itemDrop: FloorTileItemHydro heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorBar @@ -816,6 +867,7 @@ collection: FootstepFloor itemDrop: FloorTileItemBar heatCapacity: 10000 + tileRipResistance: 100 - type: tile id: FloorClown @@ -828,6 +880,7 @@ collection: FootstepFloor itemDrop: FloorTileItemClown heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorMime @@ -840,6 +893,7 @@ collection: FootstepFloor itemDrop: FloorTileItemMime heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorKitchen @@ -852,6 +906,7 @@ collection: FootstepTile itemDrop: FloorTileItemKitchen heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorLaundry @@ -864,6 +919,7 @@ collection: FootstepTile itemDrop: FloorTileItemLaundry heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorSteelDamaged @@ -883,6 +939,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel #This should probably be made null when it becomes possible to make it such, in SS13 prying destroyed tiles wouldn't give you anything. heatCapacity: 10000 + tileRipResistance: 175 - type: tile id: FloorSteelBurnt @@ -899,6 +956,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel #Same case as FloorSteelDamaged, make it null when possible heatCapacity: 10000 + tileRipResistance: 175 # Concrete @@ -920,6 +978,7 @@ itemDrop: FloorTileItemConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorConcreteMono @@ -939,6 +998,7 @@ itemDrop: FloorTileItemConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorConcreteSmooth @@ -958,6 +1018,7 @@ itemDrop: FloorTileItemConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorGrayConcrete @@ -977,6 +1038,7 @@ itemDrop: FloorTileItemGrayConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorGrayConcreteMono @@ -996,6 +1058,7 @@ itemDrop: FloorTileItemGrayConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorGrayConcreteSmooth @@ -1015,6 +1078,7 @@ itemDrop: FloorTileItemGrayConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorOldConcrete @@ -1034,6 +1098,7 @@ itemDrop: FloorTileItemOldConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorOldConcreteMono @@ -1053,6 +1118,7 @@ itemDrop: FloorTileItemOldConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 - type: tile id: FloorOldConcreteSmooth @@ -1072,6 +1138,7 @@ itemDrop: FloorTileItemOldConcrete heatCapacity: 10000 weather: true + tileRipResistance: 300 # Carpets (non smoothing) - type: tile @@ -1088,6 +1155,7 @@ friction: 0.25 itemDrop: FloorTileItemArcadeBlue heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorArcadeBlue2 @@ -1103,6 +1171,7 @@ friction: 0.25 itemDrop: FloorTileItemArcadeBlue2 heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorArcadeRed @@ -1118,6 +1187,7 @@ friction: 0.25 itemDrop: FloorTileItemArcadeRed heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorEighties @@ -1133,6 +1203,7 @@ friction: 0.25 itemDrop: FloorTileItemEighties heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorCarpetClown @@ -1148,6 +1219,7 @@ friction: 0.25 itemDrop: FloorTileItemCarpetClown heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorCarpetOffice @@ -1163,6 +1235,7 @@ friction: 0.25 itemDrop: FloorTileItemCarpetOffice heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorBoxing @@ -1182,6 +1255,7 @@ friction: 0.25 itemDrop: FloorTileItemBoxing heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorGym @@ -1201,6 +1275,7 @@ friction: 0.25 itemDrop: FloorTileItemGym heatCapacity: 10000 + tileRipResistance: 50 # Shuttle - type: tile @@ -1214,6 +1289,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleWhite heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttleGrey @@ -1226,6 +1302,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleGrey heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttleBlack @@ -1238,6 +1315,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleBlack heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttleBlue @@ -1250,6 +1328,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleBlue heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttleOrange @@ -1262,6 +1341,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleOrange heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttlePurple @@ -1274,6 +1354,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttlePurple heatCapacity: 10000 + tileRipResistance: 200 - type: tile id: FloorShuttleRed @@ -1286,6 +1367,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleRed heatCapacity: 10000 + tileRipResistance: 200 # Materials @@ -1300,6 +1382,7 @@ collection: FootstepTile itemDrop: FloorTileItemGold heatCapacity: 10000 + tileRipResistance: 600 - type: tile id: FloorSilver @@ -1312,6 +1395,7 @@ collection: FootstepTile itemDrop: FloorTileItemSilver heatCapacity: 10000 + tileRipResistance: 500 - type: tile id: FloorGlass @@ -1330,6 +1414,7 @@ collection: FootstepTile itemDrop: SheetGlass1 heatCapacity: 10000 + tileRipResistance: 150 - type: tile id: FloorRGlass @@ -1348,6 +1433,7 @@ collection: FootstepTile itemDrop: SheetRGlass1 heatCapacity: 10000 + tileRipResistance: 175 # Circuits - type: tile @@ -1361,6 +1447,7 @@ collection: FootstepHull itemDrop: FloorTileItemGCircuit heatCapacity: 10000 + tileRipResistance: 225 - type: tile id: FloorBlueCircuit @@ -1373,6 +1460,7 @@ collection: FootstepHull itemDrop: FloorTileItemBCircuit heatCapacity: 10000 + tileRipResistance: 225 # Terrain - type: tile @@ -1666,6 +1754,7 @@ itemDrop: FloorTileItemFlesh friction: 0.05 #slippy heatCapacity: 10000 + tileRipResistance: 80 - type: tile id: FloorTechMaint2 @@ -1678,6 +1767,7 @@ collection: FootstepHull itemDrop: FloorTileItemSteelMaint heatCapacity: 10000 + tileRipResistance: 225 - type: tile id: FloorTechMaint3 @@ -1696,6 +1786,7 @@ collection: FootstepHull itemDrop: FloorTileItemGratingMaint heatCapacity: 10000 + tileRipResistance: 225 - type: tile id: FloorWoodTile @@ -1716,6 +1807,7 @@ collection: BarestepWood itemDrop: FloorTileItemWoodPattern heatCapacity: 10000 + tileRipResistance: 75 - type: tile id: FloorBrokenWood @@ -1739,6 +1831,7 @@ collection: BarestepWood itemDrop: MaterialWoodPlank1 heatCapacity: 10000 + tileRipResistance: 60 - type: tile id: FloorWebTile @@ -1753,6 +1846,7 @@ collection: BarestepCarpet itemDrop: FloorTileItemWeb heatCapacity: 10000 + tileRipResistance: 30 - type: tile id: FloorChromite @@ -1784,6 +1878,7 @@ collection: FootstepHull itemDrop: FloorTileItemSteel #probably should not be normally obtainable, but the game shits itself and dies when you try to put null here heatCapacity: 10000 + tileRipResistance: 500 - type: tile id: FloorHullReinforced @@ -1796,6 +1891,7 @@ itemDrop: FloorTileItemSteel heatCapacity: 100000 #/tg/ has this set as "INFINITY." I don't know if that exists here so I've just added an extra 0 indestructible: true + reinforced: true - type: tile id: FloorReinforcedHardened @@ -1806,6 +1902,7 @@ footstepSounds: collection: FootstepHull itemDrop: FloorTileItemReinforced #same case as FloorHull + reinforced: true # Faux sci tiles @@ -1837,6 +1934,7 @@ collection: FootstepGrass itemDrop: FloorTileItemAstroGrass heatCapacity: 10000 + tileRipResistance: 50 - type: tile id: FloorMowedAstroGrass @@ -1846,6 +1944,7 @@ isSubfloor: false deconstructTools: [ Cutting ] itemDrop: FloorTileItemMowedAstroGrass + tileRipResistance: 50 - type: tile id: FloorJungleAstroGrass @@ -1855,6 +1954,7 @@ isSubfloor: false deconstructTools: [ Cutting ] itemDrop: FloorTileItemJungleAstroGrass + tileRipResistance: 50 # Ice - type: tile @@ -1870,6 +1970,7 @@ mobFrictionNoInput: 0.05 mobAcceleration: 2 itemDrop: FloorTileItemAstroIce + tileRipResistance: 50 - type: tile id: FloorAstroSnow @@ -1879,6 +1980,7 @@ isSubfloor: false deconstructTools: [ Prying ] itemDrop: FloorTileItemAstroSnow + tileRipResistance: 50 - type: tile id: FloorWoodLarge @@ -1899,3 +2001,4 @@ collection: BarestepWood itemDrop: FloorTileItemWoodLarge heatCapacity: 10000 + tileRipResistance: 100 From 70a9345453a410f8e8c9ab609499bd4ec4341731 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 11 Jun 2024 20:31:32 -0400 Subject: [PATCH 18/27] Tentative fixes for wall quantum tunneling --- .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 4 ++-- Content.Shared/CCVar/CCVars.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index d1939a92b16..c00a5df7475 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -244,11 +244,11 @@ public void ExperiencePressureDifference( if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition + dirVec; - _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); + _physics.ApplyLinearImpulse(uid, pos.Normalized() * moveForce, body: physics); } else { - _physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics); + _physics.ApplyLinearImpulse(uid, dirVec.Normalized() * moveForce, body: physics); } component.LastHighPressureMovementAirCycle = cycle; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index ac0d0614fd0..1719682ed02 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1089,7 +1089,7 @@ public static readonly CVarDef /// Useful to prevent clipping through objects. /// public static readonly CVarDef SpaceWindMaxVelocity = - CVarDef.Create("atmos.space_wind_max_velocity", 25f, CVar.SERVERONLY); + CVarDef.Create("atmos.space_wind_max_velocity", 15f, CVar.SERVERONLY); /// /// The maximum force that may be applied to an object by pushing (i.e. not throwing) atmospheric pressure differences. @@ -1107,7 +1107,7 @@ public static readonly CVarDef /// And maybe do your part to fix that? :) /// public static readonly CVarDef SpaceWindMinimumCalculatedMass = - CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 6f, CVar.SERVERONLY); + CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 10f, CVar.SERVERONLY); /// /// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold. From 4d1cf7de380c99c0aecaf0c8e4b0f23450f269ef Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 11 Jun 2024 21:56:21 -0400 Subject: [PATCH 19/27] More fixes --- .../EntitySystems/AtmosphereSystem.CVars.cs | 2 + .../AtmosphereSystem.Monstermos.cs | 3 +- Content.Shared/CCVar/CCVars.cs | 9 +++- Resources/Prototypes/Tiles/floors.yml | 44 +++++++++---------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 9038200a30b..7b0b357041d 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -19,6 +19,7 @@ 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; } @@ -52,6 +53,7 @@ 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); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index dee2bf13467..4e90742c850 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -17,6 +17,7 @@ namespace Content.Server.Atmos.EntitySystems public sealed partial class AtmosphereSystem { [Dependency] private readonly FirelockSystem _firelockSystem = default!; + private readonly TileAtmosphereComparer _monstermosComparer = new(); private readonly TileAtmosphere?[] _equalizeTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit]; @@ -685,7 +686,7 @@ private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmospher var tileref = tileRef.Tile; var tileDef = (ContentTileDefinition) _tileDefinitionManager[tileref.TypeId]; - if (!tileDef.Reinforced && tileDef.TileRipResistance < delta) + if (!tileDef.Reinforced && tileDef.TileRipResistance < delta * MonstermosRipTilesPressureOffset) { PryTile(mapGrid, tile.GridIndices); } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 1719682ed02..b0d66a90260 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1145,7 +1145,14 @@ public static readonly CVarDef /// This should be set by default to the cube of the game's lowest mass tile as defined in .yml prototypes, but can be increased for server performance reasons /// public static readonly CVarDef MonstermosRipTilesMinimumPressure = - CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 125f, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 500f, CVar.SERVERONLY); + + /// + /// 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 + /// + public static readonly CVarDef MonstermosRipTilesPressureOffset = + CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 10f, CVar.SERVERONLY); /// /// Whether explosive depressurization will cause the grid to gain an impulse. diff --git a/Resources/Prototypes/Tiles/floors.yml b/Resources/Prototypes/Tiles/floors.yml index b55eb0942fd..2abaab63fb0 100644 --- a/Resources/Prototypes/Tiles/floors.yml +++ b/Resources/Prototypes/Tiles/floors.yml @@ -15,7 +15,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelCheckerLight @@ -34,7 +34,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteelCheckerLight heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelCheckerDark @@ -53,7 +53,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteelCheckerDark heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelMini @@ -72,7 +72,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelPavement @@ -91,7 +91,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelDiagonal @@ -110,7 +110,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelOffset @@ -123,7 +123,7 @@ collection: FootstepFloor itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelMono @@ -142,7 +142,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelPavementVertical @@ -161,7 +161,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelHerringbone @@ -180,7 +180,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorSteelDiagonalMini @@ -199,7 +199,7 @@ collection: FootstepTile itemDrop: FloorTileItemSteel heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorBrassFilled @@ -698,7 +698,7 @@ collection: FootstepPlating itemDrop: FloorTileItemDirty heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorElevatorShaft @@ -711,7 +711,7 @@ collection: FootstepHull itemDrop: FloorTileItemElevatorShaft heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorMetalDiamond @@ -724,7 +724,7 @@ collection: FootstepHull itemDrop: FloorTileItemMetalDiamond heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorRockVault @@ -769,7 +769,7 @@ collection: FootstepFloor itemDrop: FloorTileItemLime heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorMining @@ -1289,7 +1289,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleWhite heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttleGrey @@ -1302,7 +1302,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleGrey heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttleBlack @@ -1315,7 +1315,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleBlack heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttleBlue @@ -1328,7 +1328,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleBlue heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttleOrange @@ -1341,7 +1341,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleOrange heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttlePurple @@ -1354,7 +1354,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttlePurple heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 - type: tile id: FloorShuttleRed @@ -1367,7 +1367,7 @@ collection: FootstepFloor itemDrop: FloorTileItemShuttleRed heatCapacity: 10000 - tileRipResistance: 200 + tileRipResistance: 4500 # Materials From c9286a597875e28604ae52018617fe556e8d6924 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 11 Jun 2024 22:24:22 -0400 Subject: [PATCH 20/27] Update CCVars.cs --- Content.Shared/CCVar/CCVars.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index b0d66a90260..94d0a69d5d8 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1145,14 +1145,14 @@ public static readonly CVarDef /// This should be set by default to the cube of the game's lowest mass tile as defined in .yml prototypes, but can be increased for server performance reasons /// public static readonly CVarDef MonstermosRipTilesMinimumPressure = - CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 500f, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 50f, CVar.SERVERONLY); /// /// 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 /// public static readonly CVarDef MonstermosRipTilesPressureOffset = - CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 10f, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 12f, CVar.SERVERONLY); /// /// Whether explosive depressurization will cause the grid to gain an impulse. From 9c0087195ae16c955d0479d10693e15be3a42aa2 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 11 Jun 2024 22:46:45 -0400 Subject: [PATCH 21/27] Update CCVars.cs --- Content.Shared/CCVar/CCVars.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 94d0a69d5d8..aebbe722fa2 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1145,14 +1145,14 @@ public static readonly CVarDef /// This should be set by default to the cube of the game's lowest mass tile as defined in .yml prototypes, but can be increased for server performance reasons /// public static readonly CVarDef MonstermosRipTilesMinimumPressure = - CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 50f, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 7500f, CVar.SERVERONLY); /// /// 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 /// public static readonly CVarDef MonstermosRipTilesPressureOffset = - CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 12f, CVar.SERVERONLY); + CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 0.44f, CVar.SERVERONLY); /// /// Whether explosive depressurization will cause the grid to gain an impulse. From adf37451ae68123dec8c135116928a497ce29ac1 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sun, 16 Jun 2024 17:30:09 -0400 Subject: [PATCH 22/27] Apply suggestions from code review Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> Signed-off-by: VMSolidus --- .../AtmosphereSystem.HighPressureDelta.cs | 17 ++++------------- .../AtmosphereSystem.Monstermos.cs | 2 -- Content.Shared/CCVar/CCVars.cs | 11 +++++------ Content.Shared/Maps/ContentTileDefinition.cs | 7 +++++-- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index c00a5df7475..0daae7da2c3 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -90,7 +90,6 @@ private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent componen private void HighPressureMovements(Entity gridAtmosphere, TileAtmosphere tile, EntityQuery bodies, EntityQuery xforms, EntityQuery pressureQuery, EntityQuery metas) { - //!MAGIC EXIT CONDITION THAT MAKES ALMOST 200 LINES RUN 1/100TH AS OFTEN. if (tile.PressureDifference < SpaceWindMinimumCalculatedMass * SpaceWindMinimumCalculatedMass) return; // TODO ATMOS finish this @@ -122,7 +121,7 @@ private void HighPressureMovements(Entity gridAtmospher var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation; // If we're using monstermos, smooth out the yeet direction to follow the flow - //WTF:This is bad, don't run this. It just makes the throws worse by somehow rounding them to orthogonal + //TODO This is bad, don't run this. It just makes the throws worse by somehow rounding them to orthogonal if (!MonstermosEqualization) { // We step through tiles according to the pressure direction on the current tile. @@ -184,8 +183,8 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, tile.PressureDirection = differenceDirection; } - //INFO:The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function - //INFO:And it isn't working, you've probably still got the pressureResistanceProbDelta line included. + //INFO The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function + //INFO And if it isn't working, you've probably still got the pressureResistanceProbDelta line included. /// /// EXPLANATION: /// pressureDifference = Force of Air Flow on a given tile @@ -201,14 +200,6 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere, /// For a human sized entity with a standard weight of 80kg and a spacing between a hard vacuum and a room pressurized at 101kpa, /// The human shall only be moved if he is either very close to the hole, or is standing in a region of high airflow /// - /// - /// - /// - /// - /// - /// - /// - /// public void ExperiencePressureDifference( Entity ent, @@ -240,7 +231,7 @@ public void ExperiencePressureDifference( // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); - // TODO: Consider replacing throw target with proper trigonometry angles. + //TODO Consider replacing throw target with proper trigonometry angles. if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition + dirVec; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index 4e90742c850..1ba9a48aa0c 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -687,9 +687,7 @@ private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmospher var tileDef = (ContentTileDefinition) _tileDefinitionManager[tileref.TypeId]; if (!tileDef.Reinforced && tileDef.TileRipResistance < delta * MonstermosRipTilesPressureOffset) - { PryTile(mapGrid, tile.GridIndices); - } } private sealed class TileAtmosphereComparer : IComparer diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index aebbe722fa2..55bd15eef04 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1110,9 +1110,8 @@ public static readonly CVarDef CVarDef.Create("atmos.space_wind_minimum_calculated_mass", 10f, CVar.SERVERONLY); /// - /// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold. - /// If an object's inverse mass is lower than this, it is capped at this. Basically, an upper limit to how heavy an object can be - /// before it stops resisting space wind more. + /// Calculated as 1/Mass, where Mass is the physics.Mass of the desired threshold. + /// If an object's inverse mass is lower than this, it is capped at this. Basically, an upper limit to how heavy an object can be before it stops resisting space wind more. /// public static readonly CVarDef SpaceWindMaximumCalculatedInverseMass = CVarDef.Create("atmos.space_wind_maximum_calculated_inverse_mass", 0.04f, CVar.SERVERONLY); @@ -1142,14 +1141,14 @@ public static readonly CVarDef /// /// Taken as the cube of a tile's mass, this acts as a minimum threshold of mass for which air pressure calculates whether or not to rip a tile from the floor - /// This should be set by default to the cube of the game's lowest mass tile as defined in .yml prototypes, but can be increased for server performance reasons + /// 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 /// public static readonly CVarDef MonstermosRipTilesMinimumPressure = CVarDef.Create("atmos.monstermos_rip_tiles_min_pressure", 7500f, CVar.SERVERONLY); /// - /// 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 + /// 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 /// public static readonly CVarDef MonstermosRipTilesPressureOffset = CVarDef.Create("atmos.monstermos_rip_tiles_pressure_offset", 0.44f, CVar.SERVERONLY); diff --git a/Content.Shared/Maps/ContentTileDefinition.cs b/Content.Shared/Maps/ContentTileDefinition.cs index 339e9f6f39b..be171559d02 100644 --- a/Content.Shared/Maps/ContentTileDefinition.cs +++ b/Content.Shared/Maps/ContentTileDefinition.cs @@ -122,7 +122,10 @@ public void AssignTileId(ushort id) TileId = id; } - [DataField] public bool Reinforced = false; - [DataField] public float TileRipResistance = 125f; + [DataField] + public bool Reinforced = false; + + [DataField] + public float TileRipResistance = 125f; } } From 351c4ec8605c16f3c32023138347d85fe5cdd7fc Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 24 Jun 2024 23:17:50 -0400 Subject: [PATCH 23/27] Add System for making Humanoids get thrown harder --- Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs | 2 ++ .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 3 +++ Content.Shared/CCVar/CCVars.cs | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 7b0b357041d..4d50700738b 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -31,6 +31,7 @@ public sealed partial class AtmosphereSystem public float AtmosTickRate { get; private set; } public float Speedup { get; private set; } public float HeatScale { get; private set; } + public float HumanoidThrowMultiplier { get; private set; } /// /// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt @@ -65,6 +66,7 @@ private void InitializeCVars() 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); } } } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 0daae7da2c3..f8315bd6da7 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -1,5 +1,6 @@ using Content.Server.Atmos.Components; using Content.Shared.Atmos; +using Content.Shared.Humanoid; using Content.Shared.Mobs.Components; using Content.Shared.Physics; using Robust.Shared.Audio; @@ -223,6 +224,8 @@ public void ExperiencePressureDifference( && !float.IsPositiveInfinity(component.MoveResist)) { var moveForce = pressureDifference * MathF.Max(physics.InvMass, SpaceWindMaximumCalculatedInverseMass); + if (HasComp(ent)) + moveForce *= HumanoidThrowMultiplier; if (moveForce > physics.Mass) { var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 55bd15eef04..935396f7224 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1245,6 +1245,9 @@ public static readonly CVarDef public static readonly CVarDef AtmosHeatScale = CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY); + public static readonly CVarDef AtmosHumanoidThrowMultiplier = + CVarDef.Create("atmos.humanoid_throw_multiplier", 2f, CVar.SERVERONLY); + /* * MIDI instruments */ From 9b544bf720a592697fbd307a056f81d65c00a77c Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 24 Jun 2024 23:19:02 -0400 Subject: [PATCH 24/27] Update CCVars.cs --- Content.Shared/CCVar/CCVars.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 935396f7224..3bf4fbb4b3d 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1245,6 +1245,10 @@ public static readonly CVarDef public static readonly CVarDef AtmosHeatScale = CVarDef.Create("atmos.heat_scale", 8f, CVar.SERVERONLY); + /// + /// A multiplier on the amount of force applied to Humanoid entities, as tracked by HumanoidAppearanceComponent + /// This multiplier is added after all other checks are made, and applies to both throwing force, and how easy it is for an entity to be thrown. + /// public static readonly CVarDef AtmosHumanoidThrowMultiplier = CVarDef.Create("atmos.humanoid_throw_multiplier", 2f, CVar.SERVERONLY); From c9eadace9aed05f66fb83a5d0de1a9626dd706d2 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 25 Jun 2024 00:20:42 -0400 Subject: [PATCH 25/27] 1984 move by pressure, reroute to ThrowingSystem because its more advanced --- .../AtmosphereSystem.HighPressureDelta.cs | 24 ++----------------- .../Atmos/EntitySystems/AtmosphereSystem.cs | 2 ++ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index f8315bd6da7..69005332061 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -70,25 +70,6 @@ private void UpdateHighPressure(float frameTime) } } - private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent component, PhysicsComponent body) - { - if (!TryComp(uid, out var fixtures)) - return; - - _physics.SetBodyStatus(uid, body, BodyStatus.InAir); - - foreach (var (id, fixture) in fixtures.Fixtures) - { - _physics.RemoveCollisionMask(uid, id, fixture, (int) CollisionGroup.TableLayer, manager: fixtures); - } - - // TODO: Make them dynamic type? Ehh but they still want movement so uhh make it non-predicted like weightless? - // idk it's hard. - - component.Accumulator = 0f; - _activePressures.Add((uid, component)); - } - private void HighPressureMovements(Entity gridAtmosphere, TileAtmosphere tile, EntityQuery bodies, EntityQuery xforms, EntityQuery pressureQuery, EntityQuery metas) { if (tile.PressureDifference < SpaceWindMinimumCalculatedMass * SpaceWindMinimumCalculatedMass) @@ -230,7 +211,6 @@ public void ExperiencePressureDifference( { var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; moveForce = MathF.Min(moveForce, maxSafeForceForObject); - AddMovedByPressure(uid, component, physics); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); @@ -238,11 +218,11 @@ public void ExperiencePressureDifference( if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition + dirVec; - _physics.ApplyLinearImpulse(uid, pos.Normalized() * moveForce, body: physics); + _throwing.TryThrow(uid, pos.Normalized() * moveForce, pressureDifference); } else { - _physics.ApplyLinearImpulse(uid, dirVec.Normalized() * moveForce, body: physics); + _throwing.TryThrow(uid, dirVec.Normalized() * moveForce, pressureDifference); } component.LastHighPressureMovementAirCycle = cycle; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index d2f40e77169..39425157ad4 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Atmos.EntitySystems; using Content.Shared.Doors.Components; using Content.Shared.Maps; +using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; @@ -37,6 +38,7 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem [Dependency] private readonly TileSystem _tile = default!; [Dependency] private readonly MapSystem _map = default!; [Dependency] public readonly PuddleSystem Puddle = default!; + [Dependency] private readonly ThrowingSystem _throwing = default!; private const float ExposedUpdateDelay = 1f; private float _exposedTimer = 0f; From bc25b781d1d97940fd83965cb860373155db2d24 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Tue, 25 Jun 2024 01:33:48 -0400 Subject: [PATCH 26/27] This is significantly smoother --- .../EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 69005332061..ac9b5c2b0a7 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -209,20 +209,19 @@ public void ExperiencePressureDifference( moveForce *= HumanoidThrowMultiplier; if (moveForce > physics.Mass) { - var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass; - moveForce = MathF.Min(moveForce, maxSafeForceForObject); // Grid-rotation adjusted direction var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec(); + moveForce *= MathF.Max(physics.InvMass, SpaceWindMaximumCalculatedInverseMass); //TODO Consider replacing throw target with proper trigonometry angles. if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition + dirVec; - _throwing.TryThrow(uid, pos.Normalized() * moveForce, pressureDifference); + _throwing.TryThrow(uid, pos.Normalized() * moveForce, moveForce); } else { - _throwing.TryThrow(uid, dirVec.Normalized() * moveForce, pressureDifference); + _throwing.TryThrow(uid, dirVec.Normalized() * moveForce, moveForce); } component.LastHighPressureMovementAirCycle = cycle; From c5946ee4b845580821bbb1f016e791eca9e8be53 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Mon, 1 Jul 2024 23:02:19 -0400 Subject: [PATCH 27/27] Update AtmosphereSystem.HighPressureDelta.cs --- .../Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index ac9b5c2b0a7..461435f0624 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -217,11 +217,11 @@ public void ExperiencePressureDifference( if (throwTarget != EntityCoordinates.Invalid) { var pos = throwTarget.ToMap(EntityManager, _transformSystem).Position - xform.WorldPosition + dirVec; - _throwing.TryThrow(uid, pos.Normalized() * moveForce, moveForce); + _throwing.TryThrow(uid, pos.Normalized() * MathF.Min(moveForce, SpaceWindMaxVelocity), moveForce); } else { - _throwing.TryThrow(uid, dirVec.Normalized() * moveForce, moveForce); + _throwing.TryThrow(uid, dirVec.Normalized() * MathF.Min(moveForce, SpaceWindMaxVelocity), moveForce); } component.LastHighPressureMovementAirCycle = cycle;