]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove SharedEye (but content) (#19481)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 11 Sep 2023 06:15:23 +0000 (16:15 +1000)
committerGitHub <noreply@github.com>
Mon, 11 Sep 2023 06:15:23 +0000 (16:15 +1000)
29 files changed:
Content.Client/Clickable/ClickableComponent.cs
Content.Client/DragDrop/DragDropSystem.cs
Content.Client/Drugs/RainbowOverlay.cs
Content.Client/Drunk/DrunkOverlay.cs
Content.Client/Eye/Blinding/BlindOverlay.cs
Content.Client/Eye/Blinding/BlurryVisionOverlay.cs
Content.Client/Eye/EyeLerpingSystem.cs
Content.Client/Flash/FlashOverlay.cs
Content.Client/Movement/Systems/ContentEyeSystem.cs
Content.Client/Outline/InteractionOutlineSystem.cs
Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs
Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorWindow.xaml.cs
Content.Client/Tabletop/UI/TabletopWindow.xaml.cs
Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs
Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs
Content.Client/Vehicle/VehicleSystem.cs
Content.Client/Viewport/ScalingViewport.cs
Content.Server/Ghost/GhostSystem.cs
Content.Server/Pointing/EntitySystems/PointingSystem.cs
Content.Server/Revenant/EntitySystems/CorporealSystem.cs
Content.Server/Revenant/EntitySystems/RevenantSystem.cs
Content.Server/Tabletop/TabletopSystem.Session.cs
Content.Server/Tabletop/TabletopSystem.cs
Content.Server/Visible/VisibilityFlags.cs [deleted file]
Content.Shared/Camera/SharedCameraRecoilSystem.cs
Content.Shared/Examine/ExamineSystemShared.cs
Content.Shared/Eye/VisibilityFlags.cs [new file with mode: 0644]
Content.Shared/Movement/Systems/SharedContentEyeSystem.cs
Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml

index 86b7a0c9f64a95199e4dac1807abfc2dbdc4b51e..f436715d5e098f750e3ab4cfe908cf434fc5def2 100644 (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
index 23bd662d827cf5bebf647774c9fbbee2e2953874..a8c1a06686e437cc36aea1ed052f7090aac3c9f4 100644 (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);
 
index fbaab0dc5f1e9ff8247e14bfc0cf416414401288..8372f7ea600a7ded344cc6d4451139c44d67acaf 100644 (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;
index 846c86b3be36851f21f33d52d1f4e18e0d26693b..a2adb6ecc7f6fa55fad774af5fcce9c3aaf74990 100644 (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;
index 1ade23c14d5c147ce8296b9f0e959ab8e3c52f06..83c6cd23e64a90fb616cf5477721a8a81b70457f 100644 (file)
@@ -1,4 +1,3 @@
-using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
 using Robust.Shared.Enums;
index 34480544e94e8921386f0e76da011704de9aaed2..94590b54a50a249598e37b097309ac98db3af7ba 100644 (file)
@@ -1,4 +1,3 @@
-using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
 using Robust.Shared.Enums;
index 8495f01c81eebd913438124bb108d31676dd4d57..79af9e719b8e0c072f8f6d981ec8e024c0228902 100644 (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);
         }
     }
 }
index 8b80a8a6af14dbae2b395407c03906a3a2529097..f12ab3f5c92f1170c3b4173cf6fa4394076e9b0f 100644 (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;
index cb750ff234e30d1db90273f9b67632c83403618f..4056f5fd8594539076879824f4ef261b3a02d50d 100644 (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;
index d48b8763f4479057916ea3a77280e2242ba07a55..ce1945ed033c99365dea757501b94fffcc7b337e 100644 (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()
index d9b3ac48a478b95a8e44272915f2820799bf1522..b10025f56ffbbd85ababbba377ea3bfe97059f70 100644 (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;
index 1c6e18c7afea8698115f747ecd6e798a6ad83d97..59ac435acf10d694edb6801655c29249f9c49517 100644 (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;
index 2b6730958b6e84db0f1750718292ace056e701bc..11eb38708ca409d2d3c2f732d177e39257b24679 100644 (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
index 30608a986e5b6c3c3af56a7cfc625c1dab6d18dd..03d7a865f717832fea4ef34dd51f0380fbd789ac 100644 (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;
index d16b61317db3298c90e3a2fc3e78b5bbed5c2062..668c8f2d5988ef2d2bf83d7d94661da963302b2b 100644 (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;
index 4cc4b8732e98c8ae18e845fddc55ffe56f3fbf1a..e1bb7838721eb9e8bfa154188d962b4ee58d1b14 100644 (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;
     }
index 4237679958c0d16c65bb31859392f6e86a35bc24..9271e010f31d0e40cb5357ff8dfae29fe75bf634 100644 (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;
index 0201de79adda4725cc989ffe7a5a73a8b43db359..36262d1d1b613c124391abd48986a7fb852ae202 100644 (file)
@@ -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);
         }
     }
 }
index 9d1eb466fcfec4e0667cd05109a82bec93f91b2f..dc610ef4091dcc255bd34d61cfc5e81e58c001b8 100644 (file)
@@ -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;
index bad5eb6100114737c773fb33af940dbef83ca7f0..350d0827565769f7f7e0e46f63e993a20bcca0ad 100644 (file)
@@ -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;
index 4028f2dce2f13534ef9a6672715cea1e58201477..3ff247d6f8a7b9229d83d34557f573cf65901912 100644 (file)
@@ -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)
index 588c4f129d2229284d6e3a82da1fc9e8ced918eb..ef96733a121255d211c52d9a9c5ce76407a89b61 100644 (file)
@@ -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);
index 82a93f6d58ccd01da304b5cd33dbe68595573fa8..3b817c2c61baeaa5fa302c1778d1fb1b440e24d3 100644 (file)
@@ -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);
diff --git a/Content.Server/Visible/VisibilityFlags.cs b/Content.Server/Visible/VisibilityFlags.cs
deleted file mode 100644 (file)
index 03c2022..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Content.Server.Visible
-{
-    [Flags]
-    public enum VisibilityFlags : uint
-    {
-        None   = 0,
-        Normal = 1 << 0,
-        Ghost  = 1 << 1,
-    }
-}
index ec57524c050ab08703fd816342dc283f97f9d68a..3507bf1023341be05759498c787ffa37942e1cd5 100644 (file)
@@ -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);
             }
         }
     }
index cb4845498ff6739b84a20d7f4b48f4c2c78560e0..81fc016904191e796435b9ed119c7fd0e982c0ec 100644 (file)
@@ -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)
diff --git a/Content.Shared/Eye/VisibilityFlags.cs b/Content.Shared/Eye/VisibilityFlags.cs
new file mode 100644 (file)
index 0000000..a4037f2
--- /dev/null
@@ -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,
+    }
+}
index df327ae35e5034fbf7fac10d2168ec5ead9735b9..27e0080c87eeb762317506f75dae2c7853393759 100644 (file)
@@ -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;
index 923d5ea9540e486bed57394875c09d9cd85f7017..7ce409325c6eb86171d0b6f111dbbd41b52e9ab0 100644 (file)
@@ -43,6 +43,9 @@
   - type: Actions
   - type: Eye
     drawFov: false
+    visMask:
+      - Normal
+      - Ghost
   - type: ContentEye
     maxZoom: 1.2, 1.2
   - type: DoAfter