Code cleanup: Purge obsoleted SharedPhysicsSystem methods (#26287)
Updated calls to SharedPhysicsSystem methods
This commit is contained in:
@@ -358,7 +358,7 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
if (TryComp<PhysicsComponent>(buckleUid, out var physics))
|
||||
{
|
||||
_physics.ResetDynamics(physics);
|
||||
_physics.ResetDynamics(buckleUid, physics);
|
||||
}
|
||||
|
||||
if (!buckleComp.PullStrap && TryComp<PullableComponent>(strapUid, out var toPullable))
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class SharedJetpackSystem : EntitySystem
|
||||
_mover.SetRelay(user, jetpackUid);
|
||||
|
||||
if (TryComp<PhysicsComponent>(user, out var physics))
|
||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
_physics.SetBodyStatus(user, physics, BodyStatus.InAir);
|
||||
|
||||
userComp.Jetpack = jetpackUid;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public abstract class SharedJetpackSystem : EntitySystem
|
||||
return;
|
||||
|
||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
|
||||
_physics.SetBodyStatus(uid, physics, BodyStatus.OnGround);
|
||||
|
||||
RemComp<RelayInputMoverComponent>(uid);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
}
|
||||
else
|
||||
{
|
||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
_physics.SetBodyStatus(uid, physics, BodyStatus.InAir);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
@@ -191,10 +191,10 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
{
|
||||
var msg = new ThrowPushbackAttemptEvent();
|
||||
RaiseLocalEvent(uid, msg);
|
||||
const float MassLimit = 5f;
|
||||
const float massLimit = 5f;
|
||||
|
||||
if (!msg.Cancelled)
|
||||
_physics.ApplyLinearImpulse(user.Value, -impulseVector / physics.Mass * pushbackRatio * MathF.Min(MassLimit, physics.Mass), body: userPhysics);
|
||||
_physics.ApplyLinearImpulse(user.Value, -impulseVector / physics.Mass * pushbackRatio * MathF.Min(massLimit, physics.Mass), body: userPhysics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Content.Shared.Throwing
|
||||
{
|
||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||
{
|
||||
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
|
||||
_physics.SetBodyStatus(uid, physics, BodyStatus.OnGround);
|
||||
|
||||
if (physics.Awake)
|
||||
_broadphase.RegenerateContacts(uid, physics);
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem
|
||||
comp.PreviousStatus = body.BodyStatus;
|
||||
comp.ThrownEndTime = _timing.CurTime + TimeSpan.FromSeconds(comp.Lifetime);
|
||||
comp.MinLifetimeTime = _timing.CurTime + TimeSpan.FromSeconds(comp.MinLifetime);
|
||||
_physics.SetBodyStatus(body, BodyStatus.InAir);
|
||||
_physics.SetBodyStatus(ent, body, BodyStatus.InAir);
|
||||
_physics.SetLinearVelocity(ent, Vector2.Zero, body: body);
|
||||
_physics.ApplyLinearImpulse(ent, comp.Velocity * body.Mass, body: body);
|
||||
Dirty(ent, ent.Comp);
|
||||
@@ -83,7 +83,7 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem
|
||||
private void OnThrownShutdown(Entity<MeleeThrownComponent> ent, ref ComponentShutdown args)
|
||||
{
|
||||
if (TryComp<PhysicsComponent>(ent, out var body))
|
||||
_physics.SetBodyStatus(body,ent.Comp.PreviousStatus);
|
||||
_physics.SetBodyStatus(ent, body, ent.Comp.PreviousStatus);
|
||||
var ev = new MeleeThrowOnHitEndEvent();
|
||||
RaiseLocalEvent(ent, ref ev);
|
||||
}
|
||||
|
||||
@@ -207,12 +207,12 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
||||
TransformSystem.Unanchor(target, targetXform);
|
||||
component.Tethered = target;
|
||||
var tethered = EnsureComp<TetheredComponent>(target);
|
||||
_physics.SetBodyStatus(targetPhysics, BodyStatus.InAir, false);
|
||||
_physics.SetBodyStatus(target, targetPhysics, BodyStatus.InAir, false);
|
||||
_physics.SetSleepingAllowed(target, targetPhysics, false);
|
||||
tethered.Tetherer = gunUid;
|
||||
tethered.OriginalAngularDamping = targetPhysics.AngularDamping;
|
||||
_physics.SetAngularDamping(targetPhysics, 0f);
|
||||
_physics.SetLinearDamping(targetPhysics, 0f);
|
||||
_physics.SetAngularDamping(target, targetPhysics, 0f);
|
||||
_physics.SetLinearDamping(target, targetPhysics, 0f);
|
||||
_physics.SetAngularVelocity(target, SpinVelocity, body: targetPhysics);
|
||||
_physics.WakeBody(target, body: targetPhysics);
|
||||
var thrown = EnsureComp<ThrownItemComponent>(component.Tethered.Value);
|
||||
@@ -264,9 +264,9 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
||||
_thrown.StopThrow(component.Tethered.Value, thrown);
|
||||
}
|
||||
|
||||
_physics.SetBodyStatus(targetPhysics, BodyStatus.OnGround);
|
||||
_physics.SetBodyStatus(component.Tethered.Value, targetPhysics, BodyStatus.OnGround);
|
||||
_physics.SetSleepingAllowed(component.Tethered.Value, targetPhysics, true);
|
||||
_physics.SetAngularDamping(targetPhysics, Comp<TetheredComponent>(component.Tethered.Value).OriginalAngularDamping);
|
||||
_physics.SetAngularDamping(component.Tethered.Value, targetPhysics, Comp<TetheredComponent>(component.Tethered.Value).OriginalAngularDamping);
|
||||
}
|
||||
|
||||
if (!transfer)
|
||||
|
||||
@@ -386,7 +386,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid gunUid, EntityUid? user = null, float speed = 20f)
|
||||
{
|
||||
var physics = EnsureComp<PhysicsComponent>(uid);
|
||||
Physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
Physics.SetBodyStatus(uid, physics, BodyStatus.InAir);
|
||||
|
||||
var targetMapVelocity = gunVelocity + direction.Normalized() * speed;
|
||||
var currentMapVelocity = Physics.GetMapLinearVelocity(uid, physics);
|
||||
|
||||
Reference in New Issue
Block a user