]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Merge `ActorSystem` and `IPlayerManager` (#21314)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sat, 11 Nov 2023 02:08:10 +0000 (13:08 +1100)
committerGitHub <noreply@github.com>
Sat, 11 Nov 2023 02:08:10 +0000 (13:08 +1100)
25 files changed:
Content.Client/Actions/ActionsSystem.cs
Content.Client/Alerts/ClientAlertsSystem.cs
Content.Client/Construction/ConstructionSystem.cs
Content.Client/Drugs/DrugOverlaySystem.cs
Content.Client/Drunk/DrunkSystem.cs
Content.Client/Eye/Blinding/BlindingSystem.cs
Content.Client/Eye/Blinding/BlurryVisionSystem.cs
Content.Client/Eye/EyeLerpingSystem.cs
Content.Client/Ghost/GhostSystem.cs
Content.Client/Hands/Systems/HandsSystem.cs
Content.Client/Inventory/ClientInventorySystem.cs
Content.Client/Overlays/EquipmentHudSystem.cs
Content.Client/Physics/Controllers/MoverController.cs
Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs
Content.Client/Replay/Spectator/ReplaySpectatorSystem.cs
Content.Client/Traits/ParacusiaSystem.cs
Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs
Content.IntegrationTests/Tests/Interaction/InteractionTest.cs
Content.Server/Alert/ServerAlertsSystem.cs
Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs
Content.Server/GameTicking/GameTicker.Player.cs
Content.Server/Mind/MindSystem.cs
Content.Server/Physics/Controllers/MoverController.cs
Content.Server/Placement/PlacementLoggerSystem.cs
Content.Shared/Alert/AlertsSystem.cs

index d9fc20d78ce72b9a4a53cc0a36df7473d12afb03..b67c1bd5b97454a75ca1b1192cdf08ad0dfcf084 100644 (file)
@@ -6,6 +6,7 @@ using Robust.Client.Player;
 using Robust.Shared.ContentPack;
 using Robust.Shared.GameStates;
 using Robust.Shared.Input.Binding;
+using Robust.Shared.Player;
 using Robust.Shared.Serialization.Manager;
 using Robust.Shared.Serialization.Markdown;
 using Robust.Shared.Serialization.Markdown.Mapping;
index 5089022415331a112fa0ee14f510dc41f19036a3..83327ad77b5af1e69709900bb22a70d803295c25 100644 (file)
@@ -2,6 +2,7 @@ using System.Linq;
 using Content.Shared.Alert;
 using JetBrains.Annotations;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Alerts;
index 9fc638cea22b094d6b54030a8cfb07ef10321f73..2ca0f3d706d0d3f053a9697815b4d9356c4474fe 100644 (file)
@@ -12,6 +12,7 @@ using Robust.Client.Player;
 using Robust.Shared.Input;
 using Robust.Shared.Input.Binding;
 using Robust.Shared.Map;
+using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Construction
index ec0d0140720d4336e71fbc13886cd0236214daa1..3c42033be6c8f8fa76771fae17c44785f49ae583 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Drugs;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 
 namespace Content.Client.Drugs;
 
index 4f2ec70b56b92ec7c02b32a9715191de9b57e2f5..dcd2758623e2ae461e00e6c4dfde0f320e03e0fe 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Drunk;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 
 namespace Content.Client.Drunk;
 
index f255f7ef016a17cecdd843a6383f4002097b9381..2bff5db4d61a396a25449a94f0b2bd25b3df3913 100644 (file)
@@ -2,6 +2,7 @@ using Robust.Client.Graphics;
 using Robust.Client.Player;
 using Content.Shared.Eye.Blinding.Components;
 using Content.Shared.GameTicking;
+using Robust.Shared.Player;
 
 namespace Content.Client.Eye.Blinding;
 
index 8be5b4ed930028d69e91a566110edef753e7a871..91090fc4607570b70b8c5ff2617d62489bf3a473 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Eye.Blinding.Components;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 
 namespace Content.Client.Eye.Blinding;
 
index b46921a9b48e6e1d2adf4fb38fa7e61aa296c0ef..8889b97100242948474c8b63356306a727cc7598 100644 (file)
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
 using Robust.Client.GameObjects;
 using Robust.Client.Physics;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Eye;
index a89d0858d9dd411173063e22bae339d6ec428c66..1a82be3da4ede46bb09024c020159a5475010c35 100644 (file)
@@ -5,6 +5,7 @@ using Robust.Client.Console;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 
 namespace Content.Client.Ghost
 {
index 31de7ec14334ee6935183ad529f9e95d02666479..b403c66dd73350ede1b9d537579e0e9780615d1b 100644 (file)
@@ -13,6 +13,7 @@ using Robust.Client.Player;
 using Robust.Client.UserInterface;
 using Robust.Shared.Containers;
 using Robust.Shared.GameStates;
+using Robust.Shared.Player;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Hands.Systems
index f0a12b3b1f6d09ffc0ed7a2fee1b8f8e1f0dcb38..6976a8b5bc92c46e77f7178c87b63d5ac94f577e 100644 (file)
@@ -14,6 +14,7 @@ using Robust.Client.Player;
 using Robust.Client.UserInterface;
 using Robust.Shared.Containers;
 using Robust.Shared.Input.Binding;
+using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Inventory
index ac618691d8b6da9da9477a1f2e06569956811a5e..3ac2a36d53f5de65644c32390cbe1bd988fb09a8 100644 (file)
@@ -2,6 +2,7 @@ using Content.Shared.GameTicking;
 using Content.Shared.Inventory;
 using Content.Shared.Inventory.Events;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 
 namespace Content.Client.Overlays;
 
index 52340b33918033136e7b59a873941c888089a1df..763f7b01145b823ee387d6f217a6be06a63ff7e1 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.Pulling.Components;
 using Robust.Client.Physics;
 using Robust.Client.Player;
 using Robust.Shared.Physics.Components;
+using Robust.Shared.Player;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Physics.Controllers
index 479e2eff976fb6550d24ff46ee6b72ca3419a7e9..6041d87317ce952f46ae097431e67b341630d14f 100644 (file)
@@ -1,8 +1,8 @@
 using Content.Shared.Movement.Components;
-using Robust.Client.Player;
 using Robust.Shared.Map;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Network;
+using Robust.Shared.Player;
 
 namespace Content.Client.Replay.Spectator;
 
index 3b9662ed8c674a1aa2318fa33e90249b2f2f5879..c238f5456d25857c878973d8f265fd7d8bf11015 100644 (file)
@@ -6,6 +6,7 @@ using Robust.Client.Player;
 using Robust.Client.Replays.Playback;
 using Robust.Client.State;
 using Robust.Shared.Console;
+using Robust.Shared.Player;
 using Robust.Shared.Serialization.Markdown.Mapping;
 
 namespace Content.Client.Replay.Spectator;
index 87abec80bb9e94a876e6058663fadcee543645e1..dad274bf9689196820ec8fd6ec6fcb87076f105f 100644 (file)
@@ -2,6 +2,7 @@ using System.Numerics;
 using Content.Shared.Traits.Assorted;
 using Robust.Shared.Random;
 using Robust.Client.Player;
+using Robust.Shared.Player;
 using Robust.Shared.Timing;
 
 namespace Content.Client.Traits;
index ba4a871199ddd108fb97b0544f795f39dccb3aca..0485ea5dff88d45387b94f6e228241d0ce80c462 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Client.Graphics;
 using Robust.Client.Player;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controllers;
+using Robust.Shared.Player;
 
 namespace Content.Client.UserInterface.Systems.DamageOverlays;
 
index df77410e540c8e274b4fbfb5bc069ff95d3510be..d4aa8d58c9cafe2403a22a15ae173360135fdc63 100644 (file)
@@ -5,7 +5,6 @@ using Content.Client.Construction;
 using Content.Client.Examine;
 using Content.IntegrationTests.Pair;
 using Content.Server.Body.Systems;
-using Content.Server.Players;
 using Content.Server.Stack;
 using Content.Server.Tools;
 using Content.Shared.Body.Part;
@@ -17,8 +16,6 @@ using Content.Shared.Mind;
 using Content.Shared.Players;
 using Robust.Client.Input;
 using Robust.Client.UserInterface;
-using Robust.Server.GameObjects;
-using Robust.Server.Player;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Log;
 using Robust.Shared.Map;
@@ -102,7 +99,6 @@ public abstract partial class InteractionTest
     protected ToolSystem ToolSys = default!;
     protected InteractionTestSystem STestSystem = default!;
     protected SharedTransformSystem Transform = default!;
-    protected ActorSystem Actor = default!;
     protected ISawmill SLogger = default!;
 
     // CLIENT dependencies
@@ -161,7 +157,6 @@ public abstract partial class InteractionTest
         SConstruction = SEntMan.System<Server.Construction.ConstructionSystem>();
         STestSystem = SEntMan.System<InteractionTestSystem>();
         Stack = SEntMan.System<StackSystem>();
-        Actor = SEntMan.System<ActorSystem>();
         SLogger = Server.ResolveDependency<ILogManager>().RootSawmill;
 
         // client dependencies
@@ -197,17 +192,17 @@ public abstract partial class InteractionTest
             // Mind system is a time vampire
             SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
 
-            old = cPlayerMan.LocalPlayer.ControlledEntity;
+            old = cPlayerMan.LocalEntity;
             Player = SEntMan.GetNetEntity(SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords)));
             var serverPlayerEnt = SEntMan.GetEntity(Player);
-            Actor.Attach(serverPlayerEnt, ServerSession);
+            Server.PlayerMan.SetAttachedEntity(ServerSession, serverPlayerEnt);
             Hands = SEntMan.GetComponent<HandsComponent>(serverPlayerEnt);
             DoAfters = SEntMan.GetComponent<DoAfterComponent>(serverPlayerEnt);
         });
 
         // Check player got attached.
         await RunTicks(5);
-        Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
+        Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalEntity), Is.EqualTo(Player));
 
         // Delete old player entity.
         await Server.WaitPost(() =>
@@ -234,7 +229,7 @@ public abstract partial class InteractionTest
         await Pair.ReallyBeIdle(5);
         Assert.Multiple(() =>
         {
-            Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
+            Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalEntity), Is.EqualTo(Player));
             Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player)));
         });
     }
index 58e56c7566d2c3d224da9186afc45dac12e28b89..b7b80f732105b1561ec2638b83655251eb831831 100644 (file)
@@ -1,19 +1,7 @@
 using Content.Shared.Alert;
-using Robust.Server.GameObjects;
 
 namespace Content.Server.Alert;
 
 internal sealed class ServerAlertsSystem : AlertsSystem
 {
-    public override void Initialize()
-    {
-        base.Initialize();
-
-        SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
-    }
-
-    private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
-    {
-        Dirty(component);
-    }
 }
index c48ba07c4476d458521c5344e490020b862ba601..761e9456bcdc60cfea623afe307cfcc256ee7bd4 100644 (file)
@@ -1,6 +1,6 @@
 using Content.Shared.ActionBlocker;
 using Content.Shared.Chat.TypingIndicator;
-using Robust.Server.GameObjects;
+using Robust.Shared.Player;
 
 namespace Content.Server.Chat.TypingIndicator;
 
index dfd2e98499c25fc27c1387d18dede76f78a7d68e..d994faec66245b33e165ca67406d8781f21fa253 100644 (file)
@@ -4,7 +4,6 @@ using Content.Shared.GameWindow;
 using Content.Shared.Players;
 using Content.Shared.Preferences;
 using JetBrains.Annotations;
-using Robust.Server.GameObjects;
 using Robust.Server.Player;
 using Robust.Shared.Enums;
 using Robust.Shared.Player;
@@ -18,7 +17,6 @@ namespace Content.Server.GameTicking
     {
         [Dependency] private readonly IPlayerManager _playerManager = default!;
         [Dependency] private readonly IServerDbManager _dbManager = default!;
-        [Dependency] private readonly ActorSystem _actor = default!;
 
         private void InitializePlayer()
         {
@@ -102,7 +100,7 @@ namespace Content.Server.GameTicking
                     }
                     else
                     {
-                        if (_actor.Attach(mind.CurrentEntity, session))
+                        if (_playerManager.SetAttachedEntity(session, mind.CurrentEntity))
                         {
                             PlayerJoinGame(session);
                         }
index f23e9b640735dca05e963dcb23ed16be3874e65c..23ef89dd86e858353a66375cf7198917d727c464 100644 (file)
@@ -7,10 +7,8 @@ using Content.Shared.Ghost;
 using Content.Shared.Mind;
 using Content.Shared.Mind.Components;
 using Content.Shared.Players;
-using Robust.Server.GameObjects;
 using Robust.Server.GameStates;
 using Robust.Server.Player;
-using Robust.Shared.Map;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Network;
 using Robust.Shared.Player;
@@ -21,10 +19,8 @@ namespace Content.Server.Mind;
 
 public sealed class MindSystem : SharedMindSystem
 {
-    [Dependency] private readonly ActorSystem _actor = default!;
     [Dependency] private readonly GameTicker _gameTicker = default!;
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
-    [Dependency] private readonly IMapManager _maps = default!;
     [Dependency] private readonly IPlayerManager _players = default!;
     [Dependency] private readonly MetaDataSystem _metaData = default!;
     [Dependency] private readonly SharedGhostSystem _ghosts = default!;
@@ -176,7 +172,7 @@ public sealed class MindSystem : SharedMindSystem
         }
 
         if (GetSession(mind) is { } session)
-            _actor.Attach(entity, session);
+            _players.SetAttachedEntity(session, entity);
 
         mind.VisitingEntity = entity;
 
@@ -203,7 +199,7 @@ public sealed class MindSystem : SharedMindSystem
 
         var owned = mind.OwnedEntity;
         if (GetSession(mind) is { } session)
-            _actor.Attach(owned, session);
+            _players.SetAttachedEntity(session, owned);
 
         if (owned.HasValue)
         {
@@ -292,7 +288,7 @@ public sealed class MindSystem : SharedMindSystem
         var session = GetSession(mind);
         if (session != null && !alreadyAttached && mind.VisitingEntity == null)
         {
-            _actor.Attach(entity, session, true);
+            _players.SetAttachedEntity(session, entity, true);
             DebugTools.Assert(session.AttachedEntity == entity, $"Failed to attach entity.");
             Log.Info($"Session {session.Name} transferred to entity {entity}.");
         }
@@ -333,7 +329,7 @@ public sealed class MindSystem : SharedMindSystem
 
         if (mind.Session != null)
         {
-            _actor.Attach(null, GetSession(mind)!);
+            _players.SetAttachedEntity(GetSession(mind), null);
             mind.Session = null;
         }
 
@@ -367,7 +363,7 @@ public sealed class MindSystem : SharedMindSystem
         {
             mind.Session = ret;
             _pvsOverride.AddSessionOverride(mindId, ret);
-            _actor.Attach(mind.CurrentEntity, ret);
+            _players.SetAttachedEntity(ret, mind.CurrentEntity);
         }
 
         // session may be null, but user data may still exist for disconnected players.
index f69b71447752fb25f8d294b423b033ed2f5d5b54..08738b9abed0e0d22b1b976d2a424d2161b86952 100644 (file)
@@ -1,16 +1,14 @@
 using System.Numerics;
-using Content.Server.Cargo.Components;
 using Content.Server.Shuttle.Components;
 using Content.Server.Shuttles.Components;
 using Content.Server.Shuttles.Systems;
 using Content.Shared.Movement.Components;
 using Content.Shared.Movement.Systems;
-using Content.Shared.Pulling.Components;
 using Content.Shared.Shuttles.Components;
 using Content.Shared.Shuttles.Systems;
-using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Components;
+using Robust.Shared.Player;
 
 namespace Content.Server.Physics.Controllers
 {
index b548f2c13c608ba5f707b9ce9cf1f957fb89c52e..d590754423dd108f6876bd7688138f099d99fc34 100644 (file)
@@ -1,8 +1,8 @@
 using Content.Server.Administration.Logs;
 using Content.Shared.Database;
-using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 using Robust.Shared.Placement;
+using Robust.Shared.Player;
 
 namespace Content.Server.Placement;
 
@@ -10,7 +10,7 @@ public sealed class PlacementLoggerSystem : EntitySystem
 {
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
     [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
-    [Dependency] private readonly ActorSystem _actorSystem = default!;
+    [Dependency] private readonly ISharedPlayerManager _player = default!;
 
     public override void Initialize()
     {
@@ -21,7 +21,8 @@ public sealed class PlacementLoggerSystem : EntitySystem
 
     private void OnEntityPlacement(PlacementEntityEvent ev)
     {
-        _actorSystem.TryGetActorFromUserId(ev.PlacerNetUserId, out var actor, out var actorEntity);
+        _player.TryGetSessionById(ev.PlacerNetUserId, out var actor);
+        var actorEntity = actor?.AttachedEntity;
 
         var logType = ev.PlacementEventAction switch
         {
@@ -43,7 +44,8 @@ public sealed class PlacementLoggerSystem : EntitySystem
 
     private void OnTilePlacement(PlacementTileEvent ev)
     {
-        _actorSystem.TryGetActorFromUserId(ev.PlacerNetUserId, out var actor, out var actorEntity);
+        _player.TryGetSessionById(ev.PlacerNetUserId, out var actor);
+        var actorEntity = actor?.AttachedEntity;
 
         if (actorEntity != null)
             _adminLogger.Add(LogType.Tile, LogImpact.High,
index 1a2d8a05bf2f234f48a03f9913ba586f15e737b6..83dc9382a33aff580f6001a06da2a710d9694c27 100644 (file)
@@ -1,4 +1,5 @@
 using System.Diagnostics.CodeAnalysis;
+using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 
 namespace Content.Shared.Alert;
@@ -166,6 +167,7 @@ public abstract class AlertsSystem : EntitySystem
 
         SubscribeLocalEvent<AlertsComponent, ComponentStartup>(HandleComponentStartup);
         SubscribeLocalEvent<AlertsComponent, ComponentShutdown>(HandleComponentShutdown);
+        SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
 
         SubscribeNetworkEvent<ClickAlertEvent>(HandleClickAlert);
 
@@ -239,4 +241,9 @@ public abstract class AlertsSystem : EntitySystem
 
         alert.OnClick?.AlertClicked(player.Value);
     }
+
+    private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
+    {
+        Dirty(uid, component);
+    }
 }