Remove SharedEye (but content) (#19481)
This commit is contained in:
@@ -28,19 +28,13 @@ public abstract class SharedCameraRecoilSystem : EntitySystem
|
||||
/// </summary>
|
||||
protected const float KickMagnitudeMax = 1f;
|
||||
|
||||
private ISawmill _log = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_log = Logger.GetSawmill($"ecs.systems.{nameof(SharedCameraRecoilSystem)}");
|
||||
}
|
||||
[Dependency] private readonly SharedEyeSystem _eye = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Applies explosion/recoil/etc kickback to the view of the entity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the entity is missing <see cref="CameraRecoilComponent" /> and/or <see cref="SharedEyeComponent" />,
|
||||
/// If the entity is missing <see cref="CameraRecoilComponent" /> and/or <see cref="EyeComponent" />,
|
||||
/// this call will have no effect. It is safe to call this function on any entity.
|
||||
/// </remarks>
|
||||
public abstract void KickCamera(EntityUid euid, Vector2 kickback, CameraRecoilComponent? component = null);
|
||||
@@ -49,15 +43,15 @@ public abstract class SharedCameraRecoilSystem : EntitySystem
|
||||
{
|
||||
base.FrameUpdate(frameTime);
|
||||
|
||||
foreach (var entity in EntityManager.EntityQuery<SharedEyeComponent, CameraRecoilComponent>(true))
|
||||
var query = AllEntityQuery<EyeComponent, CameraRecoilComponent>();
|
||||
|
||||
while (query.MoveNext(out var uid, out var eye, out var recoil))
|
||||
{
|
||||
var recoil = entity.Item2;
|
||||
var eye = entity.Item1;
|
||||
var magnitude = recoil.CurrentKick.Length();
|
||||
if (magnitude <= 0.005f)
|
||||
{
|
||||
recoil.CurrentKick = Vector2.Zero;
|
||||
eye.Offset = recoil.BaseOffset + recoil.CurrentKick;
|
||||
_eye.SetOffset(uid, recoil.BaseOffset + recoil.CurrentKick, eye);
|
||||
}
|
||||
else // Continually restore camera to 0.
|
||||
{
|
||||
@@ -72,7 +66,7 @@ public abstract class SharedCameraRecoilSystem : EntitySystem
|
||||
|
||||
recoil.CurrentKick = new Vector2(x, y);
|
||||
|
||||
eye.Offset = recoil.BaseOffset + recoil.CurrentKick;
|
||||
_eye.SetOffset(uid, recoil.BaseOffset + recoil.CurrentKick, eye);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user