Prevent relay recursion (#12597)
Fixes https://github.com/space-wizards/space-station-14/issues/12562
This commit is contained in:
@@ -54,7 +54,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
|||||||
foreach (var mover in mobMover)
|
foreach (var mover in mobMover)
|
||||||
{
|
{
|
||||||
//Set the movement relay for the box as the first mob
|
//Set the movement relay for the box as the first mob
|
||||||
if (component.Mover == null && args.Contents.Contains(mover))
|
if (component.Mover == null)
|
||||||
{
|
{
|
||||||
var relay = EnsureComp<RelayInputMoverComponent>(mover);
|
var relay = EnsureComp<RelayInputMoverComponent>(mover);
|
||||||
_mover.SetRelay(mover, uid, relay);
|
_mover.SetRelay(mover, uid, relay);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Shared.Input.Binding;
|
|||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.Movement.Systems
|
namespace Content.Shared.Movement.Systems
|
||||||
{
|
{
|
||||||
@@ -190,6 +191,7 @@ namespace Content.Shared.Movement.Systems
|
|||||||
|
|
||||||
if (relayMover.RelayEntity == null) return;
|
if (relayMover.RelayEntity == null) return;
|
||||||
|
|
||||||
|
DebugTools.Assert(relayMover.RelayEntity != entity);
|
||||||
HandleDirChange(relayMover.RelayEntity.Value, dir, subTick, state);
|
HandleDirChange(relayMover.RelayEntity.Value, dir, subTick, state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.Movement.Systems;
|
namespace Content.Shared.Movement.Systems;
|
||||||
|
|
||||||
@@ -22,6 +23,12 @@ public abstract partial class SharedMoverController
|
|||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (uid == relayEntity)
|
||||||
|
{
|
||||||
|
Logger.Error($"An entity attempted to relay movement to itself. Entity:{ToPrettyString(uid)}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
component.RelayEntity = relayEntity;
|
component.RelayEntity = relayEntity;
|
||||||
Dirty(component);
|
Dirty(component);
|
||||||
}
|
}
|
||||||
@@ -37,6 +44,7 @@ public abstract partial class SharedMoverController
|
|||||||
{
|
{
|
||||||
if (args.Current is not RelayInputMoverComponentState state) return;
|
if (args.Current is not RelayInputMoverComponentState state) return;
|
||||||
|
|
||||||
|
DebugTools.Assert(state.Entity != uid);
|
||||||
component.RelayEntity = state.Entity;
|
component.RelayEntity = state.Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user