diff --git a/Content.Server/Throw/ThrowHelper.cs b/Content.Server/Throw/ThrowHelper.cs index 8e7db8b7c1..dfc3bac5d7 100644 --- a/Content.Server/Throw/ThrowHelper.cs +++ b/Content.Server/Throw/ThrowHelper.cs @@ -1,5 +1,6 @@ using System; using Content.Server.GameObjects.Components.Projectiles; +using Content.Shared.GameObjects.Components.Movement; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Physics; using Robust.Shared.GameObjects.Components; @@ -87,9 +88,7 @@ namespace Content.Server.Throw throwSourceEnt.TryGetComponent(out var physics) && physics.TryGetController(out ThrownController mover)) { - var physicsMgr = IoCManager.Resolve(); - - if (physicsMgr.IsWeightless(throwSourceEnt.Transform.Coordinates)) + if (throwSourceEnt.IsWeightless()) { // We don't check for surrounding entities, // so you'll still get knocked around if you're hugging the station wall in zero g. @@ -97,7 +96,7 @@ namespace Content.Server.Throw // If somebody wants they can come along and make it so magboots completely hold you still. // Would be a cool incentive to use them. const float ThrowFactor = 5.0f; // Break Newton's Third Law for better gameplay - mover.Push(-angle.ToVec(), spd * ThrowFactor / physics.Mass); + mover.Push(-angle.ToVec(), spd * ThrowFactor * physics.InvMass); } } } @@ -138,15 +137,9 @@ namespace Content.Server.Throw } var throwDuration = ThrownItemComponent.DefaultThrowTime; - var mass = 1f; - if (thrownEnt.TryGetComponent(out IPhysicsComponent physics)) - { - mass = physics.Mass; - } - + // TODO: Mass isn't even used on the system side yet for controllers so do that someday var velocityNecessary = distance / throwDuration; - var impulseNecessary = velocityNecessary * mass; - var forceNecessary = impulseNecessary * (1f / timing.TickRate); + var forceNecessary = velocityNecessary / timing.TickRate; // Then clamp it to the max force allowed and call Throw(). thrownEnt.Throw(MathF.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);