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

@@ -32,10 +32,10 @@ public sealed partial class ReplaySpectatorSystem
public void SpectateEntity(EntityUid target)
{
if (_player.LocalPlayer == null)
if (_player.LocalSession == null)
return;
var old = _player.LocalPlayer.ControlledEntity;
var old = _player.LocalSession.AttachedEntity;
if (old == target)
{
@@ -44,7 +44,7 @@ public sealed partial class ReplaySpectatorSystem
return;
}
_player.LocalPlayer.AttachEntity(target, EntityManager, _client);
_player.SetAttachedEntity(_player.LocalSession, target);
EnsureComp<ReplaySpectatorComponent>(target);
_stateMan.RequestStateChange<ReplaySpectateEntityState>();
@@ -59,10 +59,10 @@ public sealed partial class ReplaySpectatorSystem
public TransformComponent SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
{
if (_player.LocalPlayer == null)
if (_player.LocalSession == null)
throw new InvalidOperationException();
var old = _player.LocalPlayer.ControlledEntity;
var old = _player.LocalSession.AttachedEntity;
var ent = Spawn("ReplayObserver", coords);
_eye.SetMaxZoom(ent, Vector2.One * 5);
@@ -73,7 +73,7 @@ public sealed partial class ReplaySpectatorSystem
if (gridAttach)
_transform.AttachToGridOrMap(ent);
_player.LocalPlayer.AttachEntity(ent, EntityManager, _client);
_player.SetAttachedEntity(_player.LocalSession, ent);
if (old != null)
{
@@ -93,7 +93,7 @@ public sealed partial class ReplaySpectatorSystem
{
if (args.Length == 0)
{
if (_player.LocalPlayer?.ControlledEntity is { } current)
if (_player.LocalSession?.AttachedEntity is { } current)
SpawnSpectatorGhost(new EntityCoordinates(current, default), true);
else
SpawnSpectatorGhost(default, true);