diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index d9fc20d78c..b67c1bd5b9 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -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; diff --git a/Content.Client/Alerts/ClientAlertsSystem.cs b/Content.Client/Alerts/ClientAlertsSystem.cs index 5089022415..83327ad77b 100644 --- a/Content.Client/Alerts/ClientAlertsSystem.cs +++ b/Content.Client/Alerts/ClientAlertsSystem.cs @@ -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; diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index 9fc638cea2..2ca0f3d706 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -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 diff --git a/Content.Client/Drugs/DrugOverlaySystem.cs b/Content.Client/Drugs/DrugOverlaySystem.cs index ec0d014072..3c42033be6 100644 --- a/Content.Client/Drugs/DrugOverlaySystem.cs +++ b/Content.Client/Drugs/DrugOverlaySystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Drugs; using Robust.Client.Graphics; using Robust.Client.Player; +using Robust.Shared.Player; namespace Content.Client.Drugs; diff --git a/Content.Client/Drunk/DrunkSystem.cs b/Content.Client/Drunk/DrunkSystem.cs index 4f2ec70b56..dcd2758623 100644 --- a/Content.Client/Drunk/DrunkSystem.cs +++ b/Content.Client/Drunk/DrunkSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Drunk; using Robust.Client.Graphics; using Robust.Client.Player; +using Robust.Shared.Player; namespace Content.Client.Drunk; diff --git a/Content.Client/Eye/Blinding/BlindingSystem.cs b/Content.Client/Eye/Blinding/BlindingSystem.cs index f255f7ef01..2bff5db4d6 100644 --- a/Content.Client/Eye/Blinding/BlindingSystem.cs +++ b/Content.Client/Eye/Blinding/BlindingSystem.cs @@ -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; diff --git a/Content.Client/Eye/Blinding/BlurryVisionSystem.cs b/Content.Client/Eye/Blinding/BlurryVisionSystem.cs index 8be5b4ed93..91090fc460 100644 --- a/Content.Client/Eye/Blinding/BlurryVisionSystem.cs +++ b/Content.Client/Eye/Blinding/BlurryVisionSystem.cs @@ -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; diff --git a/Content.Client/Eye/EyeLerpingSystem.cs b/Content.Client/Eye/EyeLerpingSystem.cs index b46921a9b4..8889b97100 100644 --- a/Content.Client/Eye/EyeLerpingSystem.cs +++ b/Content.Client/Eye/EyeLerpingSystem.cs @@ -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; diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index a89d0858d9..1a82be3da4 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -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 { diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 31de7ec143..b403c66dd7 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -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 diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index f0a12b3b1f..6976a8b5bc 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -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 diff --git a/Content.Client/Overlays/EquipmentHudSystem.cs b/Content.Client/Overlays/EquipmentHudSystem.cs index ac618691d8..3ac2a36d53 100644 --- a/Content.Client/Overlays/EquipmentHudSystem.cs +++ b/Content.Client/Overlays/EquipmentHudSystem.cs @@ -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; diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index 52340b3391..763f7b0114 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -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 diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs index 479e2eff97..6041d87317 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs @@ -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; diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.cs index 3b9662ed8c..c238f5456d 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.cs @@ -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; diff --git a/Content.Client/Traits/ParacusiaSystem.cs b/Content.Client/Traits/ParacusiaSystem.cs index 87abec80bb..dad274bf96 100644 --- a/Content.Client/Traits/ParacusiaSystem.cs +++ b/Content.Client/Traits/ParacusiaSystem.cs @@ -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; diff --git a/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs b/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs index ba4a871199..0485ea5dff 100644 --- a/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs +++ b/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs @@ -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; diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs index df77410e54..d4aa8d58c9 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs @@ -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(); STestSystem = SEntMan.System(); Stack = SEntMan.System(); - Actor = SEntMan.System(); SLogger = Server.ResolveDependency().RootSawmill; // client dependencies @@ -197,17 +192,17 @@ public abstract partial class InteractionTest // Mind system is a time vampire SEntMan.System().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(serverPlayerEnt); DoAfters = SEntMan.GetComponent(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))); }); } diff --git a/Content.Server/Alert/ServerAlertsSystem.cs b/Content.Server/Alert/ServerAlertsSystem.cs index 58e56c7566..b7b80f7321 100644 --- a/Content.Server/Alert/ServerAlertsSystem.cs +++ b/Content.Server/Alert/ServerAlertsSystem.cs @@ -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(OnPlayerAttached); - } - - private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args) - { - Dirty(component); - } } diff --git a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs index c48ba07c44..761e9456bc 100644 --- a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs +++ b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs @@ -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; diff --git a/Content.Server/GameTicking/GameTicker.Player.cs b/Content.Server/GameTicking/GameTicker.Player.cs index dfd2e98499..d994faec66 100644 --- a/Content.Server/GameTicking/GameTicker.Player.cs +++ b/Content.Server/GameTicking/GameTicker.Player.cs @@ -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); } diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index f23e9b6407..23ef89dd86 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -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. diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index f69b714477..08738b9abe 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -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 { diff --git a/Content.Server/Placement/PlacementLoggerSystem.cs b/Content.Server/Placement/PlacementLoggerSystem.cs index b548f2c13c..d590754423 100644 --- a/Content.Server/Placement/PlacementLoggerSystem.cs +++ b/Content.Server/Placement/PlacementLoggerSystem.cs @@ -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, diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index 1a2d8a05bf..83dc9382a3 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -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(HandleComponentStartup); SubscribeLocalEvent(HandleComponentShutdown); + SubscribeLocalEvent(OnPlayerAttached); SubscribeNetworkEvent(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); + } }