Stop caching connected tubes and discover them on each step (#1554)

This commit is contained in:
DrSmugleaf
2020-08-01 03:45:40 +02:00
committed by GitHub
parent bf30a68a5e
commit 9277ed5248
7 changed files with 50 additions and 151 deletions

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
@@ -25,14 +24,14 @@ namespace Content.Server.GameObjects.Components.Disposal
var directions = ConnectableDirections();
var previousTube = holder.PreviousTube;
var forward = directions[0];
if (previousTube == null || !Connected.ContainsValue(previousTube))
if (previousTube == null)
{
return forward;
}
var forwardTube = Connected.GetValueOrDefault(forward);
var backward = directions[1];
return previousTube == forwardTube ? backward : forward;
return DirectionTo(previousTube) == forward ? backward : forward;
}
}
}