make it actually sortof work
This commit is contained in:
@@ -35,7 +35,7 @@ namespace OpenRA.Orders
|
||||
.Where(o => o != null)
|
||||
.ToArray();
|
||||
|
||||
var actorsInvolved = orders.Select(o => o.TargetActor).Distinct();
|
||||
var actorsInvolved = orders.Select(o => o.Subject).Distinct();
|
||||
if (actorsInvolved.Any())
|
||||
yield return new Order("CreateGroup", actorsInvolved.First().Owner.PlayerActor,
|
||||
string.Join(",", actorsInvolved.Select(a => a.ActorID.ToString()).ToArray()));
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA
|
||||
List<CachedPath> CachedPaths = new List<CachedPath>();
|
||||
const int MaxPathAge = 50; /* x 40ms ticks */
|
||||
|
||||
public List<int2> FindUnitPath(int2 from, int2 target, UnitMovementType umt)
|
||||
public List<int2> FindUnitPath(int2 from, int2 target, UnitMovementType umt, Actor self)
|
||||
{
|
||||
using (new PerfSample("find_unit_path"))
|
||||
{
|
||||
@@ -73,9 +73,9 @@ namespace OpenRA
|
||||
|
||||
var pb = FindBidiPath(
|
||||
PathSearch.FromPoint(world, target, from, umt, true)
|
||||
.WithCustomBlocker(AvoidUnitsNear(from, 4)),
|
||||
.WithCustomBlocker(AvoidUnitsNear(from, 4, self)),
|
||||
PathSearch.FromPoint(world, from, target, umt, true)
|
||||
.WithCustomBlocker(AvoidUnitsNear(from, 4))
|
||||
.WithCustomBlocker(AvoidUnitsNear(from, 4, self))
|
||||
.InReverse());
|
||||
|
||||
CheckSanePath2(pb, from, target);
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
public List<int2> FindUnitPathToRange( int2 src, int2 target, UnitMovementType umt, int range )
|
||||
public List<int2> FindUnitPathToRange( int2 src, int2 target, UnitMovementType umt, int range, Actor self )
|
||||
{
|
||||
using( new PerfSample( "find_unit_path_multiple_src" ) )
|
||||
{
|
||||
@@ -94,19 +94,19 @@ namespace OpenRA
|
||||
.Where( t => world.IsPathableCell( t, umt ) );
|
||||
|
||||
var path = FindPath( PathSearch.FromPoints( world, tilesInRange, src, umt, false )
|
||||
.WithCustomBlocker(AvoidUnitsNear(src, 4))
|
||||
.WithCustomBlocker(AvoidUnitsNear(src, 4, self))
|
||||
.InReverse());
|
||||
path.Reverse();
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
public Func<int2, bool> AvoidUnitsNear(int2 p, int dist)
|
||||
public Func<int2, bool> AvoidUnitsNear(int2 p, int dist, Actor self)
|
||||
{
|
||||
return q =>
|
||||
p != q &&
|
||||
((p - q).LengthSquared < dist * dist) &&
|
||||
(world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(q).Any());
|
||||
(world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(q).Any(a => a.Group != self.Group));
|
||||
}
|
||||
|
||||
public List<int2> FindPath( PathSearch search )
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits.Activities
|
||||
{
|
||||
this.getPath = ( self, mobile ) => self.World.PathFinder.FindUnitPath(
|
||||
self.Location, destination,
|
||||
mobile.GetMovementType() );
|
||||
mobile.GetMovementType(), self );
|
||||
this.destination = destination;
|
||||
this.nearEnough = nearEnough;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Traits.Activities
|
||||
this.getPath = (self, mobile) =>
|
||||
self.World.PathFinder.FindPath(
|
||||
PathSearch.FromPoint( self.World, self.Location, destination, mobile.GetMovementType(), false )
|
||||
.WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4 ))
|
||||
.WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4, self ))
|
||||
.WithIgnoredBuilding( ignoreBuilding ));
|
||||
|
||||
this.destination = destination;
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Traits.Activities
|
||||
{
|
||||
this.getPath = ( self, mobile ) => self.World.PathFinder.FindUnitPathToRange(
|
||||
self.Location, target.Location,
|
||||
mobile.GetMovementType(), range );
|
||||
mobile.GetMovementType(), range, self );
|
||||
this.destination = null;
|
||||
this.nearEnough = range;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Player:
|
||||
ProductionQueue:
|
||||
BuildSpeed: .4
|
||||
BuildSpeed: .04
|
||||
LowPowerSlowdown: 3
|
||||
PlaceBuilding:
|
||||
GpsPower:
|
||||
|
||||
Reference in New Issue
Block a user