Fix some comp dirty / appearance warnings (#13193)

* Fix some comp dirty / appearance warnings

* also dis
This commit is contained in:
metalgearsloth
2022-12-28 03:58:53 +11:00
committed by GitHub
parent d3d8dde42c
commit 007b079330
12 changed files with 43 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Movement.Components;
using Content.Shared.Tag;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
namespace Content.Shared.Throwing;
@@ -20,6 +21,7 @@ public sealed class ThrowingSystem : EntitySystem
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly ThrownItemSystem _thrownSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
@@ -58,7 +60,7 @@ public sealed class ThrowingSystem : EntitySystem
comp.Thrower = user;
// Give it a l'il spin.
if (!_tagSystem.HasTag(uid, "NoSpinOnThrow"))
physics.ApplyAngularImpulse(ThrowAngularImpulse);
_physics.ApplyAngularImpulse(physics, ThrowAngularImpulse);
else
{
if (transform == null)
@@ -73,24 +75,26 @@ public sealed class ThrowingSystem : EntitySystem
_interactionSystem.ThrownInteraction(user.Value, uid);
var impulseVector = direction.Normalized * strength * physics.Mass;
physics.ApplyLinearImpulse(impulseVector);
_physics.ApplyLinearImpulse(physics, impulseVector);
// Estimate time to arrival so we can apply OnGround status and slow it much faster.
var time = (direction / strength).Length;
if (time < FlyTime)
{
physics.BodyStatus = BodyStatus.OnGround;
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
_thrownSystem.LandComponent(comp);
}
else
{
physics.BodyStatus = BodyStatus.InAir;
_physics.SetBodyStatus(physics, BodyStatus.InAir);
Timer.Spawn(TimeSpan.FromSeconds(time - FlyTime), () =>
{
if (physics.Deleted) return;
physics.BodyStatus = BodyStatus.OnGround;
if (physics.Deleted)
return;
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
_thrownSystem.LandComponent(comp);
});
}
@@ -105,7 +109,7 @@ public sealed class ThrowingSystem : EntitySystem
RaiseLocalEvent(physics.Owner, msg);
if (!msg.Cancelled)
userPhysics.ApplyLinearImpulse(-impulseVector * pushbackRatio);
_physics.ApplyLinearImpulse(userPhysics, -impulseVector * pushbackRatio);
}
}
}