@@ -29,7 +29,7 @@ if gadgetHandler:IsSyncedCode() then
29
29
30
30
local CMD_WAIT = CMD .WAIT
31
31
local EMPTY = {}
32
- local DEQUEUE_OPTS = CMD . OPT_RIGHT -- right: dequeue, ctrl+shift: 100
32
+ local DEQUEUE_OPTS = { " right " , " ctrl " , " shift " } -- right: dequeue, ctrl+shift: 100
33
33
34
34
local stopProductionCmdDesc = {
35
35
id = CMD_STOP_PRODUCTION ,
@@ -50,21 +50,21 @@ if gadgetHandler:IsSyncedCode() then
50
50
51
51
local function orderDequeue (unitID , buildDefID , count )
52
52
while count > 0 do
53
- local opts = DEQUEUE_OPTS
54
- if count >= 100 then
55
- count = count - 100
56
- opts = opts + CMD . OPT_SHIFT + CMD . OPT_CTRL
57
- elseif count >= 20 then
58
- count = count - 20
59
- opts = opts + CMD . OPT_CTRL
60
- elseif count >= 5 then
61
- count = count - 5
62
- opts = opts + CMD . OPT_SHIFT
63
- else
64
- count = count - 1
65
- end
53
+ -- The commented code below might still be useful in some circumstance we need 'perfect' dequeue
54
+ --
55
+ -- if count >= 100 then
56
+ count = count - 100
57
+ -- elseif count >= 20 then
58
+ -- opts = { "ctrl" }
59
+ -- count = count - 20
60
+ -- elseif count >= 5 then
61
+ -- opts = { "shift" }
62
+ -- count = count - 5
63
+ -- else
64
+ -- count = count - 1
65
+ -- end
66
66
67
- spGiveOrderToUnit (unitID , - buildDefID , EMPTY , opts )
67
+ spGiveOrderToUnit (unitID , - buildDefID , EMPTY , DEQUEUE_OPTS )
68
68
end
69
69
end
70
70
@@ -77,24 +77,8 @@ if gadgetHandler:IsSyncedCode() then
77
77
-- As opposed to removing each build command individually
78
78
local queue = spGetRealBuildQueue (unitID )
79
79
if queue ~= nil then
80
- local total = 0
81
- for _ , buildPair in ipairs (queue ) do
82
- local _ , count = next (buildPair , nil )
83
- total = total + count
84
- end
85
- local keepDefID
86
- if total > 1 then
87
- local firstCommand = Spring .GetFactoryCommands (unitID , 1 )
88
- local firstID = firstCommand [1 ][' id' ]
89
- if firstID < 0 then
90
- keepDefID = - firstID
91
- end
92
- end
93
80
for _ , buildPair in ipairs (queue ) do
94
81
local buildUnitDefID , count = next (buildPair , nil )
95
- if keepDefID == buildUnitDefID then
96
- count = count - 1
97
- end
98
82
orderDequeue (unitID , buildUnitDefID , count )
99
83
end
100
84
end
0 commit comments