Allow queued structure rallypoints.
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var aircraftInfo = producee.TraitInfoOrDefault<AircraftInfo>();
|
||||
var mobileInfo = producee.TraitInfoOrDefault<MobileInfo>();
|
||||
|
||||
var destination = rp != null ? rp.Location : self.Location;
|
||||
var destinations = rp != null ? rp.Path : new List<CPos> { self.Location };
|
||||
|
||||
var location = spawnLocation;
|
||||
if (!location.HasValue)
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var locomotorInfo = mobileInfo.LocomotorInfo;
|
||||
location = self.World.Map.ChooseClosestMatchingEdgeCell(self.Location,
|
||||
c => mobileInfo.CanEnterCell(self.World, null, c) && domainIndex.IsPassable(c, destination, locomotorInfo));
|
||||
c => mobileInfo.CanEnterCell(self.World, null, c) && domainIndex.IsPassable(c, destinations[0], locomotorInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (aircraftInfo != null)
|
||||
pos += new WVec(0, 0, aircraftInfo.CruiseAltitude.Length);
|
||||
|
||||
var initialFacing = self.World.Map.FacingBetween(location.Value, destination, 0);
|
||||
var initialFacing = self.World.Map.FacingBetween(location.Value, destinations[0], 0);
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
@@ -91,11 +91,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var move = newUnit.TraitOrDefault<IMove>();
|
||||
if (move != null)
|
||||
newUnit.QueueActivity(move.MoveTo(destination, 2));
|
||||
foreach (var cell in destinations)
|
||||
newUnit.QueueActivity(move.MoveTo(cell, 2, evaluateNearestMovableCell: true));
|
||||
|
||||
if (!self.IsDead)
|
||||
foreach (var t in self.TraitsImplementing<INotifyProduction>())
|
||||
t.UnitProduced(self, newUnit, destination);
|
||||
t.UnitProduced(self, newUnit, destinations[0]);
|
||||
|
||||
var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>();
|
||||
foreach (var notify in notifyOthers)
|
||||
|
||||
Reference in New Issue
Block a user