@@ -2,7 +2,7 @@ using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Client.Replay.Spectator;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.GameObjects;
|
||||
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.LocalSession == null)
|
||||
if (_player.LocalPlayer == 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.SetAttachedEntity(_player.LocalSession, session.AttachedEntity);
|
||||
_player.LocalPlayer.AttachEntity(session.AttachedEntity.Value, EntityManager, _client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Exists(data.Entity) && Transform(data.Entity).MapID != MapId.Nullspace)
|
||||
{
|
||||
_player.SetAttachedEntity(_player.LocalSession, data.Entity);
|
||||
_player.LocalPlayer.AttachEntity(data.Entity, EntityManager, _client);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.Eye != null && TryComp(_player.LocalSession.AttachedEntity, out InputMoverComponent? newMover))
|
||||
if (data.Eye != null && TryComp(_player.LocalPlayer.ControlledEntity, 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, LocalPlayerDetachedEvent args)
|
||||
private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
if (IsClientSide(uid))
|
||||
QueueDel(uid);
|
||||
|
||||
@@ -32,10 +32,10 @@ public sealed partial class ReplaySpectatorSystem
|
||||
|
||||
public void SpectateEntity(EntityUid target)
|
||||
{
|
||||
if (_player.LocalSession == null)
|
||||
if (_player.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
var old = _player.LocalSession.AttachedEntity;
|
||||
var old = _player.LocalPlayer.ControlledEntity;
|
||||
|
||||
if (old == target)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
return;
|
||||
}
|
||||
|
||||
_player.SetAttachedEntity(_player.LocalSession, target);
|
||||
_player.LocalPlayer.AttachEntity(target, EntityManager, _client);
|
||||
EnsureComp<ReplaySpectatorComponent>(target);
|
||||
|
||||
_stateMan.RequestStateChange<ReplaySpectateEntityState>();
|
||||
@@ -59,10 +59,10 @@ public sealed partial class ReplaySpectatorSystem
|
||||
|
||||
public TransformComponent SpawnSpectatorGhost(EntityCoordinates coords, bool gridAttach)
|
||||
{
|
||||
if (_player.LocalSession == null)
|
||||
if (_player.LocalPlayer == null)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
var old = _player.LocalSession.AttachedEntity;
|
||||
var old = _player.LocalPlayer.ControlledEntity;
|
||||
|
||||
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.SetAttachedEntity(_player.LocalSession, ent);
|
||||
_player.LocalPlayer.AttachEntity(ent, EntityManager, _client);
|
||||
|
||||
if (old != null)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
if (_player.LocalSession?.AttachedEntity is { } current)
|
||||
if (_player.LocalPlayer?.ControlledEntity is { } current)
|
||||
SpawnSpectatorGhost(new EntityCoordinates(current, default), true);
|
||||
else
|
||||
SpawnSpectatorGhost(default, true);
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Client.Player;
|
||||
using Robust.Client.Replays.Playback;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization.Markdown.Mapping;
|
||||
|
||||
namespace Content.Client.Replay.Spectator;
|
||||
@@ -39,7 +40,7 @@ public sealed partial class ReplaySpectatorSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<GetVerbsEvent<AlternativeVerb>>(OnGetAlternativeVerbs);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, EntityTerminatingEvent>(OnTerminating);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, LocalPlayerDetachedEvent>(OnDetached);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, PlayerDetachedEvent>(OnDetached);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, EntParentChangedMessage>(OnParentChanged);
|
||||
|
||||
InitializeBlockers();
|
||||
|
||||
Reference in New Issue
Block a user