Allow queued structure rallypoints.

This commit is contained in:
tovl
2019-08-31 19:55:11 +02:00
committed by abcdefg30
parent 3236499fb7
commit 203fff0ab7
9 changed files with 65 additions and 40 deletions

View File

@@ -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)