Check for placeablilty of LineBuild Segment instead of the Post.
This commit is contained in:
committed by
abcdefg30
parent
153bd14f9e
commit
a7004b2db7
@@ -263,10 +263,18 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
|
|
||||||
if (!Game.GetModifierKeys().HasModifier(Modifiers.Shift))
|
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))
|
foreach (var t in BuildingUtils.GetLineBuildCells(world, topLeft, actorInfo, buildingInfo, owner))
|
||||||
{
|
{
|
||||||
var lineBuildable = world.IsCellBuildable(t.Cell, actorInfo, buildingInfo);
|
var lineBuildable = world.IsCellBuildable(t.Cell, segmentInfo, segmentBuildingInfo);
|
||||||
var lineCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, t.Cell);
|
var lineCloseEnough = segmentBuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, segmentInfo, t.Cell);
|
||||||
footprint.Add(t.Cell, MakeCellType(lineBuildable && lineCloseEnough, true));
|
footprint.Add(t.Cell, MakeCellType(lineBuildable && lineCloseEnough, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,9 +112,17 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (dirs[d] != 0)
|
if (dirs[d] != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
var segmentInfo = ai;
|
||||||
|
var segmentBuildingInfo = bi;
|
||||||
|
if (!string.IsNullOrEmpty(lbi.SegmentType))
|
||||||
|
{
|
||||||
|
segmentInfo = world.Map.Rules.Actors[lbi.SegmentType];
|
||||||
|
segmentBuildingInfo = segmentInfo.TraitInfo<BuildingInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
// Continue the search if the cell is empty or not visible
|
// Continue the search if the cell is empty or not visible
|
||||||
var c = topLeft + i * vecs[d];
|
var c = topLeft + i * vecs[d];
|
||||||
if (world.IsCellBuildable(c, ai, bi) || !owner.Shroud.IsExplored(c))
|
if (world.IsCellBuildable(c, segmentInfo, segmentBuildingInfo) || !owner.Shroud.IsExplored(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Cell contains an actor. Is it the type we want?
|
// Cell contains an actor. Is it the type we want?
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ NAFNCE:
|
|||||||
EnergyWall:
|
EnergyWall:
|
||||||
ActiveCondition: active-posts == 2
|
ActiveCondition: active-posts == 2
|
||||||
Weapon: LaserFence
|
Weapon: LaserFence
|
||||||
|
TerrainTypes: Clear, Rough, Road, DirtRoad, Green, Sand, Pavement
|
||||||
|
RequiresBuildableArea:
|
||||||
|
Adjacent: 4
|
||||||
GrantConditionOnLineBuildDirection@X:
|
GrantConditionOnLineBuildDirection@X:
|
||||||
Direction: X
|
Direction: X
|
||||||
Condition: laserfence-direction-x
|
Condition: laserfence-direction-x
|
||||||
|
|||||||
Reference in New Issue
Block a user