Optimise immovable rod mapinit (#27149)

Redundant getworldpos.
This commit is contained in:
metalgearsloth
2024-04-20 13:07:25 +10:00
committed by GitHub
parent 6be204e3f4
commit ef7f0b8322

View File

@@ -61,7 +61,7 @@ public sealed class ImmovableRodSystem : EntitySystem
_physics.SetBodyStatus(uid, phys, BodyStatus.InAir); _physics.SetBodyStatus(uid, phys, BodyStatus.InAir);
var xform = Transform(uid); var xform = Transform(uid);
var worldRot = _transform.GetWorldRotation(uid); var (worldPos, worldRot) = _transform.GetWorldPositionRotation(uid);
var vel = worldRot.ToWorldVec() * component.MaxSpeed; var vel = worldRot.ToWorldVec() * component.MaxSpeed;
if (component.RandomizeVelocity) if (component.RandomizeVelocity)
@@ -74,7 +74,7 @@ public sealed class ImmovableRodSystem : EntitySystem
} }
_physics.ApplyLinearImpulse(uid, vel, body: phys); _physics.ApplyLinearImpulse(uid, vel, body: phys);
xform.LocalRotation = (vel - _transform.GetWorldPosition(uid)).ToWorldAngle() + MathHelper.PiOver2; xform.LocalRotation = (vel - worldPos).ToWorldAngle() + MathHelper.PiOver2;
} }
} }