Harvesters - made search radius configurable for both initial search from proc and search from harvest location.
This commit is contained in:
@@ -46,6 +46,11 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var resLayer = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
var territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>();
|
||||
|
||||
// Determine where to search from and how far to search:
|
||||
var searchFromLoc = harv.LastOrderLocation ?? harv.LinkedProc.Location;
|
||||
int searchRadius = harv.LastOrderLocation.HasValue ? harvInfo.SearchFromOrderRadius : harvInfo.SearchFromProcRadius;
|
||||
int searchRadiusSquared = searchRadius * searchRadius;
|
||||
|
||||
// Find harvestable resources nearby:
|
||||
var path = self.World.WorldActor.Trait<PathFinder>().FindPath(
|
||||
PathSearch.Search(self.World, mobileInfo, self.Owner, true)
|
||||
@@ -68,8 +73,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (avoidCell.HasValue && loc == avoidCell.Value) return 1;
|
||||
|
||||
// Don't harvest out of range:
|
||||
int distSquared = (loc - (harv.LastOrderLocation ?? harv.LinkedProc.Location)).LengthSquared;
|
||||
if (distSquared > (12 * 12))
|
||||
int distSquared = (loc - searchFromLoc).LengthSquared;
|
||||
if (distSquared > searchRadiusSquared)
|
||||
return int.MaxValue;
|
||||
|
||||
// Get the resource at this location:
|
||||
|
||||
@@ -25,6 +25,14 @@ namespace OpenRA.Mods.RA
|
||||
public readonly int PipCount = 7;
|
||||
public readonly string[] Resources = { };
|
||||
public readonly decimal FullyLoadedSpeed = .85m;
|
||||
/// <summary>
|
||||
/// Initial search radius (in cells) from the refinery (proc) that created us.
|
||||
/// </summary>
|
||||
public readonly int SearchFromProcRadius = 24;
|
||||
/// <summary>
|
||||
/// Search radius (in cells) from the last harvest order location to find more resources.
|
||||
/// </summary>
|
||||
public readonly int SearchFromOrderRadius = 12;
|
||||
|
||||
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@ HARV:
|
||||
Resources: Tiberium, Blue Tiberium
|
||||
PipCount: 5
|
||||
Capacity: 15
|
||||
# How far away from our linked proc (refinery) to find resources (in cells):
|
||||
SearchFromProcRadius: 24
|
||||
# How far away from last harvest order location to find more resources (in cells):
|
||||
SearchFromOrderRadius: 12
|
||||
Mobile:
|
||||
Speed: 6
|
||||
Health:
|
||||
|
||||
@@ -46,6 +46,10 @@ HARVESTER:
|
||||
Capacity: 20
|
||||
Resources: Spice
|
||||
UnloadTicksPerBale: 1
|
||||
# How far away from our linked proc (refinery) to find resources (in cells):
|
||||
SearchFromProcRadius: 24
|
||||
# How far away from last harvest order location to find more resources (in cells):
|
||||
SearchFromOrderRadius: 12
|
||||
Health:
|
||||
HP: 600
|
||||
Armor:
|
||||
|
||||
@@ -228,6 +228,10 @@ HARV:
|
||||
Capacity: 20
|
||||
Resources: Ore,Gems
|
||||
UnloadTicksPerBale: 1
|
||||
# How far away from our linked proc (refinery) to find resources (in cells):
|
||||
SearchFromProcRadius: 24
|
||||
# How far away from last harvest order location to find more resources (in cells):
|
||||
SearchFromOrderRadius: 12
|
||||
Health:
|
||||
HP: 600
|
||||
Armor:
|
||||
|
||||
Reference in New Issue
Block a user