Also lerp paused eyes (#14545)

This commit is contained in:
metalgearsloth
2023-03-10 18:12:21 +11:00
committed by GitHub
parent 1d1059f5ea
commit db8ce5ea36

View File

@@ -99,10 +99,12 @@ public sealed class EyeLerpingSystem : EntitySystem
return; return;
// Set all of our eye rotations to the relevant values. // Set all of our eye rotations to the relevant values.
foreach (var (lerpInfo, xform) in EntityQuery<LerpingEyeComponent, TransformComponent>()) var query = AllEntityQuery<LerpingEyeComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var lerpInfo, out var xform))
{ {
lerpInfo.LastRotation = lerpInfo.TargetRotation; lerpInfo.LastRotation = lerpInfo.TargetRotation;
lerpInfo.TargetRotation = GetRotation(lerpInfo.Owner, xform); lerpInfo.TargetRotation = GetRotation(uid, xform);
} }
} }
@@ -143,11 +145,10 @@ public sealed class EyeLerpingSystem : EntitySystem
{ {
var tickFraction = (float) _gameTiming.TickFraction / ushort.MaxValue; var tickFraction = (float) _gameTiming.TickFraction / ushort.MaxValue;
const double lerpMinimum = 0.00001; const double lerpMinimum = 0.00001;
var query = AllEntityQuery<LerpingEyeComponent, EyeComponent, TransformComponent>();
foreach (var (lerpInfo, eye, xform) in EntityQuery<LerpingEyeComponent, EyeComponent, TransformComponent>()) while (query.MoveNext(out var entity, out var lerpInfo, out var eye, out var xform))
{ {
var entity = eye.Owner;
TryComp<InputMoverComponent>(entity, out var mover); TryComp<InputMoverComponent>(entity, out var mover);
// This needs to be recomputed every frame, as if this is simply the grid rotation, then we need to account for grid angle lerping. // This needs to be recomputed every frame, as if this is simply the grid rotation, then we need to account for grid angle lerping.