Allow player to add a "priority unit" to production queue

* If production is ordered by `Ctrl + Left Click` the item is added to the top of the stack after the currently produced item
* Works with `Shift` for priority queueing of 5 items
* This modifier is not taken into account for `ParallelProductionQueue` as it doesn't make sense in that context
This commit is contained in:
Ivaylo Draganov
2018-11-03 17:51:19 +02:00
committed by abcdefg30
parent 81d53a4f1a
commit a7279415dc
4 changed files with 18 additions and 8 deletions

View File

@@ -406,7 +406,7 @@ namespace OpenRA.Mods.Common.Traits
else if (!hasPlayedSound && time > 0)
hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName);
}
})));
})), !order.Queued);
}
break;
@@ -470,9 +470,12 @@ namespace OpenRA.Mods.Common.Traits
Queue.Remove(item);
}
protected void BeginProduction(ProductionItem item)
protected virtual void BeginProduction(ProductionItem item, bool hasPriority)
{
Queue.Add(item);
if (hasPriority && Queue.Count > 1)
Queue.Insert(1, item);
else
Queue.Add(item);
}
public virtual int RemainingTimeActual(ProductionItem item)