@@ -33,6 +33,9 @@ public sealed class ModularBotInfo : TraitInfo, IBotInfo
3333 "Excess orders remain queued for subsequent ticks." ) ]
3434 public readonly int MinOrderQuotientPerTick = 5 ;
3535
36+ [ Desc ( "Those orders will be issued immediately." , "Used for orders that is very sensitive to delays." ) ]
37+ public readonly HashSet < string > HighPriorityOrders = [ ] ;
38+
3639 string IBotInfo . Type => Type ;
3740
3841 string IBotInfo . Name => Name ;
@@ -47,6 +50,7 @@ public sealed class ModularBot : ITick, IBot, INotifyDamage
4750 readonly ModularBotInfo info ;
4851 readonly World world ;
4952 readonly Queue < Order > orders = [ ] ;
53+ readonly List < Order > highPriorityOrders = [ ] ;
5054
5155 Player player ;
5256
@@ -80,7 +84,10 @@ public void Activate(Player p)
8084
8185 void IBot . QueueOrder ( Order order )
8286 {
83- orders . Enqueue ( order ) ;
87+ if ( info . HighPriorityOrders . Contains ( order . OrderString ) )
88+ highPriorityOrders . Add ( order ) ;
89+ else
90+ orders . Enqueue ( order ) ;
8491 }
8592
8693 void ITick . Tick ( Actor self )
@@ -98,6 +105,10 @@ void ITick.Tick(Actor self)
98105 } ) ;
99106 }
100107
108+ foreach ( var order in highPriorityOrders )
109+ world . IssueOrder ( order ) ;
110+ highPriorityOrders . Clear ( ) ;
111+
101112 var ordersToIssueThisTick = Math . Min ( ( orders . Count + info . MinOrderQuotientPerTick - 1 ) / info . MinOrderQuotientPerTick , orders . Count ) ;
102113 for ( var i = 0 ; i < ordersToIssueThisTick ; i ++ )
103114 world . IssueOrder ( orders . Dequeue ( ) ) ;
0 commit comments