Check for placeablilty of LineBuild Segment instead of the Post.

This commit is contained in:
Mustafa Alperen Seki
2022-03-04 20:42:37 +03:00
committed by abcdefg30
parent 153bd14f9e
commit a7004b2db7
3 changed files with 22 additions and 3 deletions

View File

@@ -263,10 +263,18 @@ namespace OpenRA.Mods.Common.Orders
if (!Game.GetModifierKeys().HasModifier(Modifiers.Shift))
{
var segmentInfo = actorInfo;
var segmentBuildingInfo = buildingInfo;
if (!string.IsNullOrEmpty(lineBuildInfo.SegmentType))
{
segmentInfo = world.Map.Rules.Actors[lineBuildInfo.SegmentType];
segmentBuildingInfo = segmentInfo.TraitInfo<BuildingInfo>();
}
foreach (var t in BuildingUtils.GetLineBuildCells(world, topLeft, actorInfo, buildingInfo, owner))
{
var lineBuildable = world.IsCellBuildable(t.Cell, actorInfo, buildingInfo);
var lineCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, t.Cell);
var lineBuildable = world.IsCellBuildable(t.Cell, segmentInfo, segmentBuildingInfo);
var lineCloseEnough = segmentBuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, segmentInfo, t.Cell);
footprint.Add(t.Cell, MakeCellType(lineBuildable && lineCloseEnough, true));
}
}