From c1287b81de7d87d35955c1a08f47a34685b2ea89 Mon Sep 17 00:00:00 2001 From: Lincoln McQueen Date: Mon, 29 Apr 2024 18:25:14 -0500 Subject: [PATCH] Fixed some announcements, centcom name change, atmosia fake --- .../AtmosphereSystem.HighPressureDelta.cs | 54 ++++++------------- Resources/Locale/en-US/shuttles/emergency.ftl | 2 +- Resources/Maps/centcomm.yml | 2 +- 3 files changed, 17 insertions(+), 41 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 53035e1ed3..05175ca1aa 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); } @@ -72,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; @@ -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), @@ -183,12 +179,13 @@ 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, float pressureDifference, AtmosDirection direction, - float pressureResistanceProbDelta, EntityCoordinates throwTarget, Angle gridWorldRotation, TransformComponent? xform = null, @@ -201,50 +198,29 @@ 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) + && physics.Mass != 0) { - 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); - + 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 { - moveForce = MathF.Min(moveForce, SpaceWindMaxPushForce); - _physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics); + _physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics); } component.LastHighPressureMovementAirCycle = cycle; @@ -252,4 +228,4 @@ public void ExperiencePressureDifference( } } } -} +} \ No newline at end of file diff --git a/Resources/Locale/en-US/shuttles/emergency.ftl b/Resources/Locale/en-US/shuttles/emergency.ftl index 57d4d09eff..d4e7d2a730 100644 --- a/Resources/Locale/en-US/shuttles/emergency.ftl +++ b/Resources/Locale/en-US/shuttles/emergency.ftl @@ -11,7 +11,7 @@ emergency-shuttle-command-dock-desc = Calls the emergency shuttle and docks it t emergency-shuttle-command-launch-desc = Early launches the emergency shuttle if possible. # Emergency shuttle -emergency-shuttle-left = The Emergency Shuttle has left the station. Estimate {$transitTime} seconds until the shuttle arrives at CentCom. +emergency-shuttle-left = The Emergency Shuttle has left the station. Estimate {$transitTime} seconds until the shuttle arrives at High Command. emergency-shuttle-launch-time = The emergency shuttle will launch in {$consoleAccumulator} seconds. emergency-shuttle-docked = The Emergency Shuttle has docked with the station on the {$direction} side. It will leave in {$time} seconds. emergency-shuttle-good-luck = The Emergency Shuttle is unable to find a station. Good luck. diff --git a/Resources/Maps/centcomm.yml b/Resources/Maps/centcomm.yml index 3631c32dea..7d69bb1fdd 100644 --- a/Resources/Maps/centcomm.yml +++ b/Resources/Maps/centcomm.yml @@ -43,7 +43,7 @@ entities: - uid: 1668 components: - type: MetaData - name: Central Command + name: High Command - type: Transform parent: 434 - type: MapGrid