Add plumbing to support ownership checks in MobileInfo.CanEnterCell.
This commit is contained in:
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var mobile = self.Trait<Mobile>();
|
||||
var mobileInfo = self.Info.Traits.Get<MobileInfo>();
|
||||
var res = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
var path = self.World.WorldActor.Trait<PathFinder>().FindPath(PathSearch.Search(self.World, mobileInfo, true)
|
||||
var path = self.World.WorldActor.Trait<PathFinder>().FindPath(PathSearch.Search(self.World, mobileInfo, self.Owner, true)
|
||||
.WithHeuristic(loc => (res.GetResource(loc) != null && harvInfo.Resources.Contains( res.GetResource(loc).info.Name )) ? 0 : 1)
|
||||
.FromPoint(self.Location));
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
cells = new OpenRA.FileFormats.Pair<int2, SubCell>[] {
|
||||
Pair.New(target.Location, SubCell.FullCell) };
|
||||
|
||||
var ps1 = new PathSearch( self.World, mobile.Info )
|
||||
var ps1 = new PathSearch( self.World, mobile.Info, self.Owner )
|
||||
{
|
||||
checkForBlocked = true,
|
||||
heuristic = location => 0,
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
}
|
||||
ps1.heuristic = PathSearch.DefaultEstimator( mobile.toCell );
|
||||
|
||||
var ps2 = PathSearch.FromPoint( self.World, mobile.Info, mobile.toCell, target.Location, true );
|
||||
var ps2 = PathSearch.FromPoint( self.World, mobile.Info, self.Owner, mobile.toCell, target.Location, true );
|
||||
var ret = self.World.WorldActor.Trait<PathFinder>().FindBidiPath( ps1, ps2 );
|
||||
if( ret.Count > 0 )
|
||||
ret.RemoveAt( 0 );
|
||||
|
||||
Reference in New Issue
Block a user