Fix the pathfinding leak (#1647)

Off-grid entities were continually expanding the graph indefinitely which is... bad.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-08-12 01:36:40 +10:00
committed by GitHub
parent 89fff7dab2
commit 452a67032f
5 changed files with 92 additions and 71 deletions

View File

@@ -1,15 +1,17 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects.Components.Access
{
public sealed class AccessReaderChangeMessage : EntitySystemMessage
{
public EntityUid Uid { get; }
public IEntity Sender { get; }
public bool Enabled { get; }
public AccessReaderChangeMessage(EntityUid uid, bool enabled)
public AccessReaderChangeMessage(IEntity entity, bool enabled)
{
Uid = uid;
Sender = entity;
Enabled = enabled;
}
}

View File

@@ -188,7 +188,7 @@ namespace Content.Server.GameObjects
SetAppearance(DoorVisualState.Open);
}, _cancellationTokenSource.Token);
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner.Uid, false));
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
}
public virtual bool CanClose()
@@ -284,7 +284,7 @@ namespace Content.Server.GameObjects
State = DoorState.Closed;
SetAppearance(DoorVisualState.Closed);
}, _cancellationTokenSource.Token);
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner.Uid, true));
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
return true;
}