Fix line build for multi-cell neighbours.
This commit is contained in:
@@ -71,12 +71,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
continue; // Cell is empty; continue search
|
continue; // Cell is empty; continue search
|
||||||
|
|
||||||
// Cell contains an actor. Is it the type we want?
|
// Cell contains an actor. Is it the type we want?
|
||||||
if (world.ActorsHavingTrait<LineBuildNode>()
|
var hasConnector = world.ActorMap.GetActorsAt(cell)
|
||||||
.Any(a => a.Location == cell
|
.Any(a => a.Info.TraitInfos<LineBuildNodeInfo>()
|
||||||
&& a.Info.TraitInfo<LineBuildNodeInfo>().Types.Overlaps(lbi.NodeTypes)))
|
.Any(info => info.Types.Overlaps(lbi.NodeTypes) && info.Connections.Contains(vecs[d])));
|
||||||
dirs[d] = i; // Cell contains actor of correct type
|
|
||||||
else
|
dirs[d] = hasConnector ? i : -1;
|
||||||
dirs[d] = -1; // Cell is blocked by another actor type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place intermediate-line sections
|
// Place intermediate-line sections
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
[Desc("This actor is of LineBuild 'NodeType'...")]
|
[Desc("This actor is of LineBuild 'NodeType'...")]
|
||||||
public readonly HashSet<string> Types = new HashSet<string> { "wall" };
|
public readonly HashSet<string> Types = new HashSet<string> { "wall" };
|
||||||
|
|
||||||
|
[Desc("Cells (outside the footprint) that contain cells that can connect to this actor.")]
|
||||||
|
public readonly CVec[] Connections = new[] { new CVec(1, 0), new CVec(0, 1), new CVec(-1, 0), new CVec(0, -1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LineBuildNode { }
|
public class LineBuildNode { }
|
||||||
|
|||||||
Reference in New Issue
Block a user