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

@@ -2,6 +2,7 @@ using System.Numerics;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Utility;
using Robust.Shared.Graphics;
using static Robust.Client.GameObjects.SpriteComponent;
namespace Content.Client.Clickable

View File

@@ -112,7 +112,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
base.Initialize();
_sawmill = Logger.GetSawmill("drag_drop");
UpdatesOutsidePrediction = true;
UpdatesAfter.Add(typeof(EyeUpdateSystem));
UpdatesAfter.Add(typeof(SharedEyeSystem));
_cfgMan.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true);

View File

@@ -1,6 +1,5 @@
using Content.Shared.Drugs;
using Content.Shared.StatusEffect;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

View File

@@ -1,6 +1,5 @@
using Content.Shared.Drunk;
using Content.Shared.StatusEffect;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

View File

@@ -1,4 +1,3 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

View File

@@ -1,4 +1,3 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

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);
}
}
}

View File

@@ -1,6 +1,5 @@
using System.Numerics;
using Content.Client.Viewport;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.State;
using Robust.Client.Player;

View File

@@ -1,7 +1,6 @@
using System.Numerics;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Robust.Client.GameObjects;
using Robust.Client.Player;
namespace Content.Client.Movement.Systems;

View File

@@ -4,7 +4,6 @@ using Content.Client.Interactable.Components;
using Content.Client.Viewport;
using Content.Shared.CCVar;
using Content.Shared.Interaction;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Player;
@@ -42,7 +41,7 @@ public sealed class InteractionOutlineSystem : EntitySystem
base.Initialize();
_configManager.OnValueChanged(CCVars.OutlineEnabled, SetCvarEnabled);
UpdatesAfter.Add(typeof(EyeUpdateSystem));
UpdatesAfter.Add(typeof(SharedEyeSystem));
}
public override void Shutdown()

View File

@@ -3,6 +3,7 @@ using System.Numerics;
using Content.Shared.Radiation.Components;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

View File

@@ -9,6 +9,7 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Graphics;
using Robust.Shared.Prototypes;
namespace Content.Client.SurveillanceCamera.UI;

View File

@@ -3,6 +3,7 @@ using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Graphics;
using Robust.Shared.Maths;
namespace Content.Client.Tabletop.UI

View File

@@ -1,5 +1,4 @@
using Content.Shared.Mobs;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;

View File

@@ -1,7 +1,6 @@
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Gameplay;
using Content.Shared.CCVar;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controllers;

View File

@@ -7,6 +7,8 @@ namespace Content.Client.Vehicle;
public sealed class VehicleSystem : SharedVehicleSystem
{
[Dependency] private EyeSystem _eye = default!;
public override void Initialize()
{
base.Initialize();
@@ -21,14 +23,18 @@ public sealed class VehicleSystem : SharedVehicleSystem
{
// Center the player's eye on the vehicle
if (TryComp(uid, out EyeComponent? eyeComp))
eyeComp.Target ??= component.Vehicle;
{
_eye.SetTarget(uid, eyeComp.Target ?? component.Vehicle, eyeComp);
}
}
private void OnRiderShutdown(EntityUid uid, RiderComponent component, ComponentShutdown args)
{
// reset the riders eye centering.
if (TryComp(uid, out EyeComponent? eyeComp) && eyeComp.Target == component.Vehicle)
eyeComp.Target = null;
{
_eye.SetTarget(uid, eyeComp.Target, eyeComp);
}
}
private void OnRiderHandleState(EntityUid uid, RiderComponent component, ref ComponentHandleState args)
@@ -39,7 +45,9 @@ public sealed class VehicleSystem : SharedVehicleSystem
var entity = EnsureEntity<RiderComponent>(state.Entity, uid);
if (TryComp(uid, out EyeComponent? eyeComp) && eyeComp.Target == component.Vehicle)
eyeComp.Target = entity;
{
_eye.SetTarget(uid, entity, eyeComp);
}
component.Vehicle = entity;
}

View File

@@ -5,6 +5,7 @@ using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Graphics;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;