Added shift+right click on build menu cancels 5 orders. Added ctrl+shift+right click on build menu cancels all orders
This commit is contained in:
@@ -187,9 +187,9 @@ namespace OpenRA
|
|||||||
return new Order("PauseProduction", subject, new int2( pause ? 1 : 0, 0 ), item);
|
return new Order("PauseProduction", subject, new int2( pause ? 1 : 0, 0 ), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Order CancelProduction(Actor subject, string item)
|
public static Order CancelProduction(Actor subject, string item, int count)
|
||||||
{
|
{
|
||||||
return new Order("CancelProduction", subject, item);
|
return new Order("CancelProduction", subject, new int2( count, 0 ), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (location == null)
|
if (location == null)
|
||||||
{
|
{
|
||||||
Game.Debug("AI: Nowhere to place {0}".F(currentBuilding.Item));
|
Game.Debug("AI: Nowhere to place {0}".F(currentBuilding.Item));
|
||||||
Game.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item));
|
Game.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
if (producers.Count() == 0)
|
if (producers.Count() == 0)
|
||||||
{
|
{
|
||||||
CancelProduction(name);
|
CancelProduction(name,1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
case "CancelProduction":
|
case "CancelProduction":
|
||||||
{
|
{
|
||||||
CancelProduction(order.TargetString);
|
CancelProduction(order.TargetString,order.TargetLocation.X);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,15 +194,26 @@ namespace OpenRA.Mods.RA
|
|||||||
return (int) time;
|
return (int) time;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CancelProduction( string itemName )
|
protected void CancelProduction(string itemName, int numberToCancel)
|
||||||
{
|
{
|
||||||
if (Queue.Count == 0)
|
if (Queue.Count == 0)
|
||||||
return; // Nothing to do here
|
return; // Nothing to do here
|
||||||
|
|
||||||
var lastIndex = Queue.FindLastIndex( a => a.Item == itemName );
|
var lastIndex = Queue.FindLastIndex(a => a.Item == itemName);
|
||||||
if (lastIndex > 0)
|
|
||||||
|
while (lastIndex > 0)
|
||||||
|
{
|
||||||
|
|
||||||
Queue.RemoveAt(lastIndex);
|
Queue.RemoveAt(lastIndex);
|
||||||
else if( lastIndex == 0 )
|
lastIndex = Queue.FindLastIndex(a => a.Item == itemName);
|
||||||
|
if (numberToCancel > 0)
|
||||||
|
--numberToCancel;
|
||||||
|
if (numberToCancel == 0)
|
||||||
|
break;
|
||||||
|
//else negative, continue deleting all orders
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastIndex == 0)
|
||||||
{
|
{
|
||||||
var item = Queue[0];
|
var item = Queue[0];
|
||||||
self.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(item.TotalCost - item.RemainingCost); // refund what's been paid so far.
|
self.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(item.TotalCost - item.RemainingCost); // refund what's been paid so far.
|
||||||
|
|||||||
@@ -357,7 +357,13 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (producing.Paused || producing.Done || producing.TotalCost == producing.RemainingCost)
|
if (producing.Paused || producing.Done || producing.TotalCost == producing.RemainingCost)
|
||||||
{
|
{
|
||||||
Sound.Play(eva.CancelledAudio);
|
Sound.Play(eva.CancelledAudio);
|
||||||
Game.IssueOrder(Order.CancelProduction(CurrentQueue.self, item));
|
int numberToCancel = Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1;
|
||||||
|
if (Game.GetModifierKeys().HasModifier(Modifiers.Shift) &&
|
||||||
|
Game.GetModifierKeys().HasModifier(Modifiers.Ctrl))
|
||||||
|
{
|
||||||
|
numberToCancel = -1; //cancel all
|
||||||
|
}
|
||||||
|
Game.IssueOrder(Order.CancelProduction(CurrentQueue.self, item, numberToCancel));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user