PBOG: remove the resource check and let IsCellBuildable() extension method handle it

This commit is contained in:
michaeldgg2
2025-06-14 17:37:11 +02:00
committed by Gustas Kažukauskas
parent d657a72107
commit 8833e95f21

View File

@@ -88,7 +88,6 @@ namespace OpenRA.Mods.Common.Orders
readonly World world;
protected readonly ProductionQueue Queue;
readonly PlaceBuildingInfo placeBuildingInfo;
readonly IResourceLayer resourceLayer;
readonly Viewport viewport;
readonly VariantWrapper[] variants;
int variant;
@@ -98,7 +97,6 @@ namespace OpenRA.Mods.Common.Orders
Queue = queue;
world = queue.Actor.World;
placeBuildingInfo = queue.Actor.Owner.PlayerActor.Info.TraitInfo<PlaceBuildingInfo>();
resourceLayer = world.WorldActor.TraitOrDefault<IResourceLayer>();
viewport = worldRenderer.Viewport;
// Clear selection if using Left-Click Orders
@@ -294,12 +292,7 @@ namespace OpenRA.Mods.Common.Orders
{
var isCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, topLeft);
foreach (var t in buildingInfo.Tiles(topLeft))
footprint.Add(
t,
MakeCellType(
isCloseEnough &&
world.IsCellBuildable(t, actorInfo, buildingInfo) &&
(resourceLayer == null || resourceLayer.GetResource(t).Type == null)));
footprint.Add(t, MakeCellType(isCloseEnough && world.IsCellBuildable(t, actorInfo, buildingInfo)));
}
return preview?.Render(wr, topLeft, footprint) ?? [];