Landing velocity threshold (#4606)

* landing threshold

* on bodystatus change

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
mirrorcult
2021-09-15 03:58:45 -07:00
committed by GitHub
parent 03260c2de7
commit 7cee263955
3 changed files with 16 additions and 32 deletions

View File

@@ -52,9 +52,10 @@ namespace Content.Server.Throwing
return;
}
var comp = entity.EnsureComponent<ThrownItemComponent>();
if (entity.HasComponent<ItemComponent>())
{
entity.EnsureComponent<ThrownItemComponent>().Thrower = user;
comp.Thrower = user;
// Give it a l'il spin.
if (!entity.HasTag("NoSpinOnThrow"))
{
@@ -71,7 +72,7 @@ namespace Content.Server.Throwing
var impulseVector = direction.Normalized * strength * physicsComponent.Mass;
physicsComponent.ApplyLinearImpulse(impulseVector);
// Estimate time to arrival so we can apply OnGround status and slow it much faster.
var time = (direction / strength).Length;
@@ -87,6 +88,7 @@ namespace Content.Server.Throwing
{
if (physicsComponent.Deleted) return;
physicsComponent.BodyStatus = BodyStatus.OnGround;
EntitySystem.Get<ThrownItemSystem>().LandComponent(comp);
});
}