Remove SharedEye (but content) (#19481)

This commit is contained in:
metalgearsloth
2023-09-11 16:15:23 +10:00
committed by GitHub
parent c477e5b0c2
commit 28bf3a6240
29 changed files with 86 additions and 75 deletions

View File

@@ -13,6 +13,7 @@ public sealed class EyeLerpingSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedEyeSystem _eye = default!;
[Dependency] private readonly SharedMoverController _mover = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
@@ -26,14 +27,14 @@ public sealed class EyeLerpingSystem : EntitySystem
SubscribeLocalEvent<EyeComponent, ComponentStartup>(OnEyeStartup);
SubscribeLocalEvent<EyeComponent, ComponentShutdown>(OnEyeShutdown);
SubscribeLocalEvent<EyeComponent, PlayerAttachedEvent>(OnAttached);
SubscribeLocalEvent<EyeAttachedEvent>(OnAttached);
SubscribeLocalEvent<LerpingEyeComponent, EntParentChangedMessage>(HandleMapChange);
SubscribeLocalEvent<LerpingEyeComponent, PlayerDetachedEvent>(OnDetached);
UpdatesAfter.Add(typeof(TransformSystem));
UpdatesAfter.Add(typeof(PhysicsSystem));
UpdatesBefore.Add(typeof(EyeUpdateSystem));
UpdatesBefore.Add(typeof(SharedEyeSystem));
UpdatesOutsidePrediction = true;
}
@@ -64,8 +65,8 @@ public sealed class EyeLerpingSystem : EntitySystem
if (component.Eye != null)
{
component.Eye.Rotation = lerpInfo.TargetRotation;
component.Eye.Zoom = lerpInfo.TargetZoom;
_eye.SetRotation(uid, lerpInfo.TargetRotation, component);
_eye.SetZoom(uid, lerpInfo.TargetZoom, component);
}
}
@@ -88,9 +89,9 @@ public sealed class EyeLerpingSystem : EntitySystem
component.LastRotation = GetRotation(uid, args.Transform);
}
private void OnAttached(EntityUid uid, EyeComponent component, PlayerAttachedEvent args)
private void OnAttached(ref EyeAttachedEvent ev)
{
AddEye(uid, component, true);
AddEye(ev.Entity, ev.Component, true);
}
private void OnDetached(EntityUid uid, LerpingEyeComponent component, PlayerDetachedEvent args)
@@ -182,11 +183,11 @@ public sealed class EyeLerpingSystem : EntitySystem
if ((zoomDiff - lerpInfo.TargetZoom).Length() < lerpMinimum)
{
eye.Zoom = lerpInfo.TargetZoom;
_eye.SetZoom(entity, lerpInfo.TargetZoom, eye);
}
else
{
eye.Zoom = zoomDiff;
_eye.SetZoom(entity, zoomDiff, eye);
}
// Handle Rotation
@@ -197,7 +198,7 @@ public sealed class EyeLerpingSystem : EntitySystem
if (!NeedsLerp(mover))
{
eye.Rotation = lerpInfo.TargetRotation;
_eye.SetRotation(entity, lerpInfo.TargetRotation, eye);
continue;
}
@@ -205,11 +206,11 @@ public sealed class EyeLerpingSystem : EntitySystem
if (Math.Abs(shortest.Theta) < lerpMinimum)
{
eye.Rotation = lerpInfo.TargetRotation;
_eye.SetRotation(entity, lerpInfo.TargetRotation, eye);
continue;
}
eye.Rotation = shortest * tickFraction + lerpInfo.LastRotation;
_eye.SetRotation(entity, shortest * tickFraction + lerpInfo.LastRotation, eye);
}
}
}