_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(physics, 0f);
- _throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: 50f);
+ _throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f);
var distance = (target.Position - vaporXform.WorldPosition).Length;
var time = (distance / physics.LinearVelocity.Length);
public sealed class ThrowingSystem : EntitySystem
{
- public const float ThrowAngularImpulse = 1.5f;
+ public const float ThrowAngularImpulse = 5f;
+
+ public const float PushbackDefault = 1f;
/// <summary>
/// The minimum amount of time an entity needs to be thrown before the timer can be run.
Vector2 direction,
float strength = 1.0f,
EntityUid? user = null,
- float pushbackRatio = 5.0f)
+ float pushbackRatio = PushbackDefault)
{
var physicsQuery = GetEntityQuery<PhysicsComponent>();
if (!physicsQuery.TryGetComponent(uid, out var physics))
EntityQuery<TagComponent> tagQuery,
float strength = 1.0f,
EntityUid? user = null,
- float pushbackRatio = 5.0f)
+ float pushbackRatio = PushbackDefault)
{
if (strength <= 0 || direction == Vector2.Infinity || direction == Vector2.NaN || direction == Vector2.Zero)
return;
// Give it a l'il spin.
if (!tagQuery.TryGetComponent(uid, out var tag) || !_tagSystem.HasTag(tag, "NoSpinOnThrow"))
- _physics.ApplyAngularImpulse(uid, ThrowAngularImpulse, body: physics);
+ _physics.ApplyAngularImpulse(uid, ThrowAngularImpulse / physics.InvI, body: physics);
else
transform.LocalRotation = direction.ToWorldAngle() - Math.PI;
// Give thrower an impulse in the other direction
if (user != null &&
- pushbackRatio > 0.0f &&
+ pushbackRatio != 0.0f &&
+ physics.Mass > 0f &&
TryComp(user.Value, out PhysicsComponent? userPhysics) &&
_gravity.IsWeightless(user.Value, userPhysics))
{
RaiseLocalEvent(uid, msg);
if (!msg.Cancelled)
- _physics.ApplyLinearImpulse(user.Value, -impulseVector * pushbackRatio, body: userPhysics);
+ _physics.ApplyLinearImpulse(user.Value, -impulseVector * pushbackRatio * physics.Mass, body: userPhysics);
}
}
}