Merge pull request #3463 from pchote/harv-force-move

Allow force-move to disable the harvest activity.
This commit is contained in:
Matthias Mailänder
2013-06-23 02:26:25 -07:00

View File

@@ -426,14 +426,19 @@ namespace OpenRA.Mods.RA
public bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor) public bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor)
{ {
if (modifiers.HasModifier(TargetModifiers.ForceMove))
return false;
// Don't leak info about resources under the shroud // Don't leak info about resources under the shroud
if (!self.Owner.Shroud.IsExplored(location)) return false; if (!self.Owner.Shroud.IsExplored(location))
return false;
var res = self.World.WorldActor.Trait<ResourceLayer>().GetResource(location); var res = self.World.WorldActor.Trait<ResourceLayer>().GetResource(location);
var info = self.Info.Traits.Get<HarvesterInfo>(); var info = self.Info.Traits.Get<HarvesterInfo>();
if (res == null) return false; if (res == null || !info.Resources.Contains(res.info.Name))
if (!info.Resources.Contains(res.info.Name)) return false; return false;
cursor = "harvest"; cursor = "harvest";
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue); IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);