Crawling Part 1: The Knockdownening (#36881)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
Princess Cheeseballs
2025-07-19 16:54:42 -07:00
committed by GitHub
parent cfb0a95035
commit dec2d42a1d
60 changed files with 1595 additions and 220 deletions

View File

@@ -222,17 +222,21 @@ public sealed class ThrowingSystem : EntitySystem
_recoil.KickCamera(user.Value, -direction * 0.04f);
// Give thrower an impulse in the other direction
if (pushbackRatio != 0.0f &&
physics.Mass > 0f &&
TryComp(user.Value, out PhysicsComponent? userPhysics) &&
_gravity.IsWeightless(user.Value, userPhysics))
{
var msg = new ThrowPushbackAttemptEvent();
RaiseLocalEvent(uid, msg);
const float massLimit = 5f;
if (pushbackRatio == 0.0f ||
physics.Mass == 0f ||
!TryComp(user.Value, out PhysicsComponent? userPhysics))
return;
var msg = new ThrowPushbackAttemptEvent();
RaiseLocalEvent(uid, msg);
if (!msg.Cancelled)
_physics.ApplyLinearImpulse(user.Value, -impulseVector / physics.Mass * pushbackRatio * MathF.Min(massLimit, physics.Mass), body: userPhysics);
}
if (msg.Cancelled)
return;
var pushEv = new ThrowerImpulseEvent();
RaiseLocalEvent(user.Value, ref pushEv);
const float massLimit = 5f;
if (pushEv.Push || _gravity.IsWeightless(user.Value))
_physics.ApplyLinearImpulse(user.Value, -impulseVector / physics.Mass * pushbackRatio * MathF.Min(massLimit, physics.Mass), body: userPhysics);
}
}