Throwing triggers (#39650)

throw triggers
This commit is contained in:
slarticodefast
2025-08-15 07:33:37 +02:00
committed by GitHub
parent 7a31e3c1f8
commit 7a3026b4f8
8 changed files with 68 additions and 52 deletions

View File

@@ -192,8 +192,6 @@ public sealed class ThrowingSystem : EntitySystem
}
}
var throwEvent = new ThrownEvent(user, uid);
RaiseLocalEvent(uid, ref throwEvent, true);
if (user != null)
_adminLogger.Add(LogType.Throw, LogImpact.Low, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):entity}");
@@ -206,6 +204,14 @@ public sealed class ThrowingSystem : EntitySystem
var impulseVector = direction.Normalized() * throwSpeed * physics.Mass;
_physics.ApplyLinearImpulse(uid, impulseVector, body: physics);
var thrownEvent = new ThrownEvent(user, uid);
RaiseLocalEvent(uid, ref thrownEvent, true);
if (user != null)
{
var throwEvent = new ThrowEvent(user, uid);
RaiseLocalEvent(user.Value, ref throwEvent, true);
}
if (comp.LandTime == null || comp.LandTime <= TimeSpan.Zero)
{
_thrownSystem.LandComponent(uid, comp, physics, playSound);