File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,15 +12,26 @@ Empties the contents of the selected bin onto the floor.
1212
1313]====]
1414
15- local bin = dfhack .gui .getSelectedItem (true ) or qerror (" No item selected" )
16- local items = dfhack .items .getContainedItems (bin )
17-
18- if # items > 0 then
19- print (' Emptying ' .. dfhack .items .getDescription (bin , 0 ))
20- for _ , item in pairs (items ) do
21- print (' ' .. dfhack .items .getDescription (item , 0 ))
22- dfhack .items .moveToGround (item , xyz2pos (dfhack .items .getPosition (bin )))
15+ local function emptyContainer (container )
16+ local items = dfhack .items .getContainedItems (container )
17+
18+ if # items > 0 then
19+ print (' Emptying ' .. dfhack .items .getDescription (container , 0 ))
20+ for _ , item in pairs (items ) do
21+ print (' ' .. dfhack .items .getDescription (item , 0 ))
22+ dfhack .items .moveToGround (item , xyz2pos (dfhack .items .getPosition (container )))
23+ end
24+ end
25+ end
26+
27+
28+ local stockpile = dfhack .gui .getSelectedStockpile (true )
29+ if stockpile then
30+ local contents = dfhack .buildings .getStockpileContents (stockpile )
31+ for _ , container in ipairs (contents ) do
32+ emptyContainer (container )
2333 end
2434else
25- print (' No contained items' )
35+ local bin = dfhack .gui .getSelectedItem (true ) or qerror (" No item selected" )
36+ emptyContainer (bin )
2637end
You can’t perform that action at this time.
0 commit comments