Prevent relay recursion (#12597)
Fixes https://github.com/space-wizards/space-station-14/issues/12562
This commit is contained in:
parent
c9563e6c38
commit
0986bfa7be
3 changed files with 11 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
|||
foreach (var mover in mobMover)
|
||||
{
|
||||
//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);
|
||||
_mover.SetRelay(mover, uid, relay);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Robust.Shared.Input.Binding;
|
|||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Movement.Systems
|
||||
{
|
||||
|
|
@ -190,6 +191,7 @@ namespace Content.Shared.Movement.Systems
|
|||
|
||||
if (relayMover.RelayEntity == null) return;
|
||||
|
||||
DebugTools.Assert(relayMover.RelayEntity != entity);
|
||||
HandleDirChange(relayMover.RelayEntity.Value, dir, subTick, state);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Movement.Systems;
|
||||
|
||||
|
|
@ -22,6 +23,12 @@ public abstract partial class SharedMoverController
|
|||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
if (uid == relayEntity)
|
||||
{
|
||||
Logger.Error($"An entity attempted to relay movement to itself. Entity:{ToPrettyString(uid)}");
|
||||
return;
|
||||
}
|
||||
|
||||
component.RelayEntity = relayEntity;
|
||||
Dirty(component);
|
||||
}
|
||||
|
|
@ -37,6 +44,7 @@ public abstract partial class SharedMoverController
|
|||
{
|
||||
if (args.Current is not RelayInputMoverComponentState state) return;
|
||||
|
||||
DebugTools.Assert(state.Entity != uid);
|
||||
component.RelayEntity = state.Entity;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue