Change NextTube in DisposalTubeComponent to consider multiple tube (#1851)
Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
@@ -69,21 +69,11 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
var nextDirection = NextDirection(holder);
|
var nextDirection = NextDirection(holder);
|
||||||
var snapGrid = Owner.GetComponent<SnapGridComponent>();
|
var snapGrid = Owner.GetComponent<SnapGridComponent>();
|
||||||
|
var oppositeDirection = new Angle(nextDirection.ToAngle().Theta + Math.PI).GetDir();
|
||||||
var tube = snapGrid
|
var tube = snapGrid
|
||||||
.GetInDir(nextDirection)
|
.GetInDir(nextDirection)
|
||||||
.Select(x => x.TryGetComponent(out IDisposalTubeComponent? c) ? c : null)
|
.Select(x => x.TryGetComponent(out IDisposalTubeComponent? c) ? c : null)
|
||||||
.FirstOrDefault(x => x != null && x != this);
|
.FirstOrDefault(x => x != null && x != this && x.CanConnect(oppositeDirection, this));
|
||||||
|
|
||||||
if (tube == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var oppositeDirection = new Angle(nextDirection.ToAngle().Theta + Math.PI).GetDir();
|
|
||||||
if (!tube.CanConnect(oppositeDirection, this))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tube;
|
return tube;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user