Refinery spawned harvesters should prioritize lower ore #14827
This commit is contained in:
committed by
reaperrr
parent
227cf35d5f
commit
311cd521e3
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return self.Location;
|
return self.Location;
|
||||||
|
|
||||||
// Determine where to search from and how far to search:
|
// Determine where to search from and how far to search:
|
||||||
var searchFromLoc = harv.LastOrderLocation ?? (harv.LastLinkedProc ?? harv.LinkedProc ?? self).Location;
|
var searchFromLoc = GetSearchFromLocation(self);
|
||||||
var searchRadius = harv.LastOrderLocation.HasValue ? harvInfo.SearchFromOrderRadius : harvInfo.SearchFromProcRadius;
|
var searchRadius = harv.LastOrderLocation.HasValue ? harvInfo.SearchFromOrderRadius : harvInfo.SearchFromProcRadius;
|
||||||
var searchRadiusSquared = searchRadius * searchRadius;
|
var searchRadiusSquared = searchRadius * searchRadius;
|
||||||
|
|
||||||
@@ -152,5 +152,16 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
yield return Target.FromCell(self.World, self.Location);
|
yield return Target.FromCell(self.World, self.Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPos GetSearchFromLocation(Actor self)
|
||||||
|
{
|
||||||
|
if (harv.LastOrderLocation.HasValue)
|
||||||
|
return harv.LastOrderLocation.Value;
|
||||||
|
else if (harv.LastLinkedProc != null)
|
||||||
|
return harv.LastLinkedProc.Location + harv.LastLinkedProc.Trait<IAcceptResources>().DeliveryOffset;
|
||||||
|
else if (harv.LinkedProc != null)
|
||||||
|
return harv.LinkedProc.Location + harv.LinkedProc.Trait<IAcceptResources>().DeliveryOffset;
|
||||||
|
return self.Location;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user