Allow queueing up scatter and move Nudge to an activity

This commit is contained in:
Gustas
2022-12-02 00:31:07 +02:00
committed by Matthias Mailänder
parent 54dac39e83
commit 3ab421cbe3
8 changed files with 86 additions and 41 deletions

View File

@@ -367,16 +367,6 @@ namespace OpenRA.Mods.Common.Traits
#region Local misc stuff
public void Nudge(Actor nudger)
{
if (IsTraitDisabled || IsTraitPaused || IsImmovable)
return;
var cell = GetAdjacentCell(nudger.Location);
if (cell != null)
self.QueueActivity(false, MoveTo(cell.Value, 0));
}
public CPos? GetAdjacentCell(CPos nextCell, Func<CPos, bool> preferToAvoid = null)
{
var availCells = new List<CPos>();
@@ -873,7 +863,7 @@ namespace OpenRA.Mods.Common.Traits
if (self.IsIdle)
{
Nudge(blocking);
self.QueueActivity(false, new Nudge(blocking));
return;
}
@@ -942,7 +932,10 @@ namespace OpenRA.Mods.Common.Traits
else if (order.OrderString == "Stop")
self.CancelActivity();
else if (order.OrderString == "Scatter")
Nudge(self);
{
self.QueueActivity(order.Queued, new Nudge(self));
self.ShowTargetLines();
}
}
string IOrderVoice.VoicePhraseForOrder(Actor self, Order order)