Ore.cs is dead. Long live ResourceLayer.cs.
This commit is contained in:
@@ -64,12 +64,14 @@ namespace OpenRA.Traits.Activities
|
||||
|
||||
void FindMoreOre(Actor self)
|
||||
{
|
||||
var res = self.World.WorldActor.traits.Get<ResourceLayer>();
|
||||
|
||||
self.QueueActivity(new Move(
|
||||
() =>
|
||||
{
|
||||
var search = new PathSearch
|
||||
{
|
||||
heuristic = loc => (self.World.Map.ContainsResource(loc) ? 0 : 1),
|
||||
heuristic = loc => (res.GetResource(loc) != null ? 0 : 1),
|
||||
umt = UnitMovementType.Wheel,
|
||||
checkForBlocked = true
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Traits
|
||||
&& underCursor.traits.Contains<IAcceptOre>() && !IsEmpty)
|
||||
return new Order("Deliver", self, underCursor);
|
||||
|
||||
if (underCursor == null && self.World.Map.ContainsResource(xy))
|
||||
if (underCursor == null && self.World.WorldActor.traits.Get<ResourceLayer>().GetResource(xy) != null)
|
||||
return new Order("Harvest", self, xy);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
||||
World w;
|
||||
|
||||
public ResourceTypeInfo[] resourceTypes;
|
||||
public CellContents[,] content = new CellContents[128, 128];
|
||||
CellContents[,] content = new CellContents[128, 128];
|
||||
|
||||
public ResourceLayer(Actor self)
|
||||
{
|
||||
@@ -185,6 +185,8 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceTypeInfo GetResource(int2 p) { return content[p.X, p.Y].type; }
|
||||
|
||||
public struct CellContents
|
||||
{
|
||||
public ResourceTypeInfo type;
|
||||
|
||||
Reference in New Issue
Block a user