using Robust.Shared.Random;
using Robust.Shared.Timing;
using System.Numerics;
+using Content.Shared.Movement.Systems;
using Robust.Shared.Audio.Systems;
namespace Content.Server.Body.Systems;
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, ref MoveInputEvent args)
{
+ // If they haven't actually moved then ignore it.
+ if ((args.Component.HeldMoveButtons &
+ (MoveButtons.Down | MoveButtons.Left | MoveButtons.Up | MoveButtons.Right)) == 0x0)
+ {
+ return;
+ }
+
if (_mobState.IsDead(uid) && _mindSystem.TryGetMind(uid, out var mindId, out var mind))
{
mind.TimeOfDeath ??= _gameTiming.RealTime;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
+using Content.Shared.Movement.Systems;
using Content.Shared.Storage.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, ref MoveInputEvent args)
{
+ // If they haven't actually moved then ignore it.
+ if ((args.Component.HeldMoveButtons &
+ (MoveButtons.Down | MoveButtons.Left | MoveButtons.Up | MoveButtons.Right)) == 0x0)
+ {
+ return;
+ }
+
// Let's not ghost if our mind is visiting...
if (HasComp<VisitingMindComponent>(uid))
return;
return;
}
- if (GetSession(mind) is { } session)
- _players.SetAttachedEntity(session, entity);
-
mind.VisitingEntity = entity;
// EnsureComp instead of AddComp to deal with deferred deletions.
var comp = EnsureComp<VisitingMindComponent>(entity);
comp.MindId = mindId;
+
+ // Do this AFTER the entity changes above as this will fire off a player-detached event
+ // which will run ghosting twice.
+ if (GetSession(mind) is { } session)
+ _players.SetAttachedEntity(session, entity);
+
Log.Info($"Session {mind.Session?.Name} visiting entity {entity}.");
}