Make AI skip harvester orders if map has no resources
This commit is contained in:
@@ -36,7 +36,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected readonly CellLayer<CellContents> Content;
|
||||
protected readonly CellLayer<CellContents> RenderContent;
|
||||
|
||||
public bool IsResourceLayerEmpty { get { return resCells < 1; } }
|
||||
|
||||
bool disposed;
|
||||
int resCells;
|
||||
|
||||
public ResourceLayer(Actor self)
|
||||
{
|
||||
@@ -217,6 +220,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
CellContents CreateResourceCell(ResourceType t, CPos cell)
|
||||
{
|
||||
world.Map.CustomTerrain[cell] = world.Map.Rules.TileSet.GetTerrainIndex(t.Info.TerrainType);
|
||||
++resCells;
|
||||
|
||||
return new CellContents
|
||||
{
|
||||
@@ -255,6 +259,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
Content[cell] = EmptyCell;
|
||||
world.Map.CustomTerrain[cell] = byte.MaxValue;
|
||||
--resCells;
|
||||
}
|
||||
else
|
||||
Content[cell] = c;
|
||||
@@ -270,6 +275,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Content[cell].Type == null)
|
||||
return;
|
||||
|
||||
--resCells;
|
||||
|
||||
// Clear cell
|
||||
Content[cell] = EmptyCell;
|
||||
world.Map.CustomTerrain[cell] = byte.MaxValue;
|
||||
|
||||
Reference in New Issue
Block a user