Un-revert IPlayerManager refactor (#21244)

This commit is contained in:
Leon Friedrich
2023-10-28 09:59:53 +11:00
committed by GitHub
parent c55e1dcafd
commit e685cb626b
245 changed files with 781 additions and 943 deletions

View File

@@ -1,5 +1,5 @@
using Content.Shared.Movement.Components;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Network;
@@ -79,7 +79,7 @@ public sealed partial class ReplaySpectatorSystem
public void SetSpectatorPosition(SpectatorData data)
{
if (_player.LocalPlayer == null)
if (_player.LocalSession == null)
return;
if (data.Controller != null
@@ -87,13 +87,13 @@ public sealed partial class ReplaySpectatorSystem
&& Exists(session.AttachedEntity)
&& Transform(session.AttachedEntity.Value).MapID != MapId.Nullspace)
{
_player.LocalPlayer.AttachEntity(session.AttachedEntity.Value, EntityManager, _client);
_player.SetAttachedEntity(_player.LocalSession, session.AttachedEntity);
return;
}
if (Exists(data.Entity) && Transform(data.Entity).MapID != MapId.Nullspace)
{
_player.LocalPlayer.AttachEntity(data.Entity, EntityManager, _client);
_player.SetAttachedEntity(_player.LocalSession, data.Entity);
return;
}
@@ -118,7 +118,7 @@ public sealed partial class ReplaySpectatorSystem
return;
}
if (data.Eye != null && TryComp(_player.LocalPlayer.ControlledEntity, out InputMoverComponent? newMover))
if (data.Eye != null && TryComp(_player.LocalSession.AttachedEntity, out InputMoverComponent? newMover))
{
newMover.RelativeEntity = data.Eye.Value.Ent;
newMover.TargetRelativeRotation = newMover.RelativeRotation = data.Eye.Value.Rot;
@@ -177,7 +177,7 @@ public sealed partial class ReplaySpectatorSystem
SetSpectatorPosition(default);
}
private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args)
private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, LocalPlayerDetachedEvent args)
{
if (IsClientSide(uid))
QueueDel(uid);