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

@@ -10,6 +10,7 @@
#endregion
using System;
using System.Collections.Generic;
using OpenRA.Mods.Common.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -42,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
public virtual void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string productionType, TypeDictionary inits)
{
var exit = CPos.Zero;
var exitLocation = CPos.Zero;
var exitLocations = new List<CPos>();
// Clone the initializer dictionary for the new actor
var td = new TypeDictionary();
@@ -68,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
initialFacing = delta.Yaw.Facing;
}
exitLocation = rp.Value != null ? rp.Value.Location : exit;
exitLocations = rp.Value != null ? rp.Value.Path : new List<CPos> { exit };
td.Add(new LocationInit(exit));
td.Add(new CenterPositionInit(spawn));
@@ -83,7 +84,8 @@ namespace OpenRA.Mods.Common.Traits
var move = newUnit.TraitOrDefault<IMove>();
if (exitinfo != null && move != null)
newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(exitLocation, 1, targetLineColor: Color.OrangeRed)));
foreach (var cell in exitLocations)
newUnit.QueueActivity(new AttackMoveActivity(newUnit, () => move.MoveTo(cell, 1, evaluateNearestMovableCell: true, targetLineColor: Color.OrangeRed)));
if (!self.IsDead)
foreach (var t in self.TraitsImplementing<INotifyProduction>())