Remove SharedEye (but content) (#19481)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Mobs;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,11 +4,11 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Server.Visible;
|
||||
using Content.Server.Warps;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
@@ -37,6 +37,7 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedEyeSystem _eye = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly JobSystem _jobs = default!;
|
||||
@@ -106,7 +107,7 @@ namespace Content.Server.Ghost
|
||||
private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
|
||||
{
|
||||
// Allow this entity to be seen by other ghosts.
|
||||
var visibility = EntityManager.EnsureComponent<VisibilityComponent>(component.Owner);
|
||||
var visibility = EntityManager.EnsureComponent<VisibilityComponent>(uid);
|
||||
|
||||
if (_ticker.RunLevel != GameRunLevel.PostRound)
|
||||
{
|
||||
@@ -115,9 +116,9 @@ namespace Content.Server.Ghost
|
||||
_visibilitySystem.RefreshVisibility(visibility);
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(component.Owner, out EyeComponent? eye))
|
||||
if (EntityManager.TryGetComponent(uid, out EyeComponent? eye))
|
||||
{
|
||||
eye.VisibilityMask |= (uint) VisibilityFlags.Ghost;
|
||||
_eye.SetVisibilityMask(uid, eye.VisibilityMask | (int) VisibilityFlags.Ghost, eye);
|
||||
}
|
||||
|
||||
var time = _gameTiming.CurTime;
|
||||
@@ -142,7 +143,7 @@ namespace Content.Server.Ghost
|
||||
if (!Terminating(uid))
|
||||
{
|
||||
// Entity can't be seen by ghosts anymore.
|
||||
if (EntityManager.TryGetComponent(component.Owner, out VisibilityComponent? visibility))
|
||||
if (EntityManager.TryGetComponent(uid, out VisibilityComponent? visibility))
|
||||
{
|
||||
_visibilitySystem.RemoveLayer(visibility, (int) VisibilityFlags.Ghost, false);
|
||||
_visibilitySystem.AddLayer(visibility, (int) VisibilityFlags.Normal, false);
|
||||
@@ -150,9 +151,9 @@ namespace Content.Server.Ghost
|
||||
}
|
||||
|
||||
// Entity can't see ghosts anymore.
|
||||
if (EntityManager.TryGetComponent(component.Owner, out EyeComponent? eye))
|
||||
if (EntityManager.TryGetComponent(uid, out EyeComponent? eye))
|
||||
{
|
||||
eye.VisibilityMask &= ~(uint) VisibilityFlags.Ghost;
|
||||
_eye.SetVisibilityMask(uid, eye.VisibilityMask & ~(int) VisibilityFlags.Ghost, eye);
|
||||
}
|
||||
|
||||
_actions.RemoveAction(uid, component.ActionEntity);
|
||||
@@ -334,9 +335,11 @@ namespace Content.Server.Ghost
|
||||
if (uid == null
|
||||
|| !entityManager.HasComponent<GhostComponent>(uid)
|
||||
|| !entityManager.TryGetComponent<EyeComponent>(uid, out var eyeComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
eyeComponent.VisibilityMask ^= (uint) VisibilityFlags.Ghost;
|
||||
entityManager.System<EyeSystem>().SetVisibilityMask(uid.Value, eyeComponent.VisibilityMask ^ (int) VisibilityFlags.Ghost, eyeComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Pointing.Components;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.Revenant.Components;
|
||||
using Content.Shared.Revenant.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -3,11 +3,11 @@ using Content.Server.Actions;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Store.Components;
|
||||
using Content.Server.Store.Systems;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
@@ -31,18 +31,19 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
[Dependency] private readonly ActionsSystem _action = default!;
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly DamageableSystem _damage = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedEyeSystem _eye = default!;
|
||||
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interact = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly StoreSystem _store = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibility = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string RevenantShopId = "ActionRevenantShop";
|
||||
@@ -83,7 +84,9 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
|
||||
//ghost vision
|
||||
if (TryComp(uid, out EyeComponent? eye))
|
||||
eye.VisibilityMask |= (uint) (VisibilityFlags.Ghost);
|
||||
{
|
||||
_eye.SetVisibilityMask(uid, eye.VisibilityMask | (int) (VisibilityFlags.Ghost), eye);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, RevenantComponent component, MapInitEvent args)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Numerics;
|
||||
using Content.Server.Tabletop.Components;
|
||||
using Content.Shared.Tabletop.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -141,8 +140,8 @@ namespace Content.Server.Tabletop
|
||||
|
||||
// Add an eye component and disable FOV
|
||||
var eyeComponent = camera.EnsureComponent<EyeComponent>();
|
||||
eyeComponent.DrawFov = false;
|
||||
eyeComponent.Zoom = tabletop.CameraZoom;
|
||||
_eye.SetDrawFov(camera, false, eyeComponent);
|
||||
_eye.SetZoom(camera, tabletop.CameraZoom, eyeComponent);
|
||||
|
||||
// Add the user to the view subscribers. If there is no player session, just skip this step
|
||||
_viewSubscriberSystem.AddViewSubscriber(camera, player);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.Tabletop
|
||||
public sealed partial class TabletopSystem : SharedTabletopSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly EyeSystem _eye = default!;
|
||||
[Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Content.Server.Tabletop
|
||||
// Find the entity, remove it from the session and set it's position to the tabletop
|
||||
session.Entities.TryGetValue(entity, out var result);
|
||||
session.Entities.Remove(result);
|
||||
_entityManager.QueueDeleteEntity(result);
|
||||
QueueDel(result);
|
||||
}
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, TabletopGameComponent component, InteractUsingEvent args)
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.Tabletop
|
||||
var meta = MetaData(handEnt);
|
||||
var protoId = meta.EntityPrototype?.ID;
|
||||
|
||||
var hologram = _entityManager.SpawnEntity(protoId, session.Position.Offset(-1, 0));
|
||||
var hologram = Spawn(protoId, session.Position.Offset(-1, 0));
|
||||
|
||||
// Make sure the entity can be dragged and can be removed, move it into the board game world and add it to the Entities hashmap
|
||||
EnsureComp<TabletopDraggableComponent>(hologram);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Content.Server.Visible
|
||||
{
|
||||
[Flags]
|
||||
public enum VisibilityFlags : uint
|
||||
{
|
||||
None = 0,
|
||||
Normal = 1 << 0,
|
||||
Ghost = 1 << 1,
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Content.Shared.Examine
|
||||
/// </summary>
|
||||
public bool IsOccluded(EntityUid uid)
|
||||
{
|
||||
return TryComp<SharedEyeComponent>(uid, out var eye) && eye.DrawFov;
|
||||
return TryComp<EyeComponent>(uid, out var eye) && eye.DrawFov;
|
||||
}
|
||||
|
||||
public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null)
|
||||
|
||||
13
Content.Shared/Eye/VisibilityFlags.cs
Normal file
13
Content.Shared/Eye/VisibilityFlags.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Eye
|
||||
{
|
||||
[Flags]
|
||||
[FlagsFor(typeof(VisibilityMaskLayer))]
|
||||
public enum VisibilityFlags : int
|
||||
{
|
||||
None = 0,
|
||||
Normal = 1 << 0,
|
||||
Ghost = 1 << 1,
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ public abstract class SharedContentEyeSystem : EntitySystem
|
||||
public static readonly Vector2 DefaultZoom = Vector2.One;
|
||||
public static readonly Vector2 MinZoom = DefaultZoom * (float)Math.Pow(ZoomMod, -3);
|
||||
|
||||
[Dependency] private readonly SharedEyeSystem _eye = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -82,7 +84,7 @@ public abstract class SharedContentEyeSystem : EntitySystem
|
||||
private void OnContentZoomRequest(RequestTargetZoomEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var ignoreLimit = msg.IgnoreLimit && _admin.HasAdminFlag(args.SenderSession, AdminFlags.Debug);
|
||||
|
||||
|
||||
if (TryComp<ContentEyeComponent>(args.SenderSession.AttachedEntity, out var content))
|
||||
SetZoom(args.SenderSession.AttachedEntity.Value, msg.TargetZoom, ignoreLimit, eye: content);
|
||||
}
|
||||
@@ -95,16 +97,15 @@ public abstract class SharedContentEyeSystem : EntitySystem
|
||||
if (!HasComp<GhostComponent>(player) && !_admin.IsAdmin(player))
|
||||
return;
|
||||
|
||||
if (TryComp<SharedEyeComponent>(player, out var eyeComp))
|
||||
if (TryComp<EyeComponent>(player, out var eyeComp))
|
||||
{
|
||||
eyeComp.DrawFov = msg.Fov;
|
||||
Dirty(player, eyeComp);
|
||||
_eye.SetDrawFov(player, msg.Fov, eyeComp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnContentEyeStartup(EntityUid uid, ContentEyeComponent component, ComponentStartup args)
|
||||
{
|
||||
if (!TryComp<SharedEyeComponent>(uid, out var eyeComp))
|
||||
if (!TryComp<EyeComponent>(uid, out var eyeComp))
|
||||
return;
|
||||
|
||||
component.TargetZoom = eyeComp.Zoom;
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
- type: Actions
|
||||
- type: Eye
|
||||
drawFov: false
|
||||
visMask:
|
||||
- Normal
|
||||
- Ghost
|
||||
- type: ContentEye
|
||||
maxZoom: 1.2, 1.2
|
||||
- type: DoAfter
|
||||
|
||||
Reference in New Issue
Block a user