bdebug=true will show appropriate influence for current building
This commit is contained in:
@@ -41,11 +41,7 @@ namespace OpenRa.Game.Traits.Activities
|
||||
void PlanReturnToBase(Actor self, Mobile mobile)
|
||||
{
|
||||
/* find a proc */
|
||||
var proc = Game.world.Actors.Where(
|
||||
a => a.Owner == self.Owner &&
|
||||
a.traits.Contains<AcceptsOre>())
|
||||
.FirstOrDefault(); /* todo: *closest* proc, maybe? */
|
||||
|
||||
var proc = ChooseReturnLocation(self);
|
||||
if (proc == null)
|
||||
{
|
||||
Cancel(self, mobile); /* is this a sane way to cancel? */
|
||||
@@ -59,6 +55,18 @@ namespace OpenRa.Game.Traits.Activities
|
||||
mobile.InternalSetActivity(NextActivity);
|
||||
}
|
||||
|
||||
static Actor ChooseReturnLocation(Actor self)
|
||||
{
|
||||
/* todo: compute paths to possible procs, taking into account enemy presence */
|
||||
/* currently, we're good at choosing close, inaccessible procs */
|
||||
|
||||
return Game.world.Actors.Where(
|
||||
a => a.Owner == self.Owner &&
|
||||
a.traits.Contains<AcceptsOre>())
|
||||
.OrderBy(p => (p.Location - self.Location).LengthSquared)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
void PlanMoreHarvesting(Actor self, Mobile mobile)
|
||||
{
|
||||
/* find a nearby patch */
|
||||
|
||||
Reference in New Issue
Block a user