@@ -8,7 +8,7 @@ Merge stacks of plants or plant growths in the selected container or stockpile.
88]====]
99local utils = require ' utils'
1010
11- validArgs = utils .invert ({ ' max' , ' stockpile' , ' container' })
11+ local validArgs = utils .invert ({ ' max' , ' stockpile' , ' container' })
1212local args = utils .processArgs ({... }, validArgs )
1313
1414local max = 12
@@ -22,8 +22,8 @@ if args.container then container = df.item.find(tonumber(args.container)) end
2222
2323function itemsCompatible (item0 , item1 )
2424 return item0 :getType () == item1 :getType ()
25- and item0 .mat_type == item1 .mat_type
26- and item0 .mat_index == item1 .mat_index
25+ and item0 .mat_type == item1 .mat_type -- hint:df.item_plantst
26+ and item0 .mat_index == item1 .mat_index -- hint:df.item_plantst
2727end
2828
2929function getPlants (items , plants , index )
@@ -32,7 +32,7 @@ function getPlants(items, plants, index)
3232 for _ ,v in pairs (items ) do
3333 -- Skip items currently tasked
3434 if # v .specific_refs == 0 then
35- if v :getType () == 53 or v :getType () == 55 or v :getType () == 70 then
35+ if v :getType () == df . item_type . PLANT or v :getType () == df . item_type . PLANT_GROWTH or v :getType () == df . item_type . CHEESE then
3636 plants [index ] = v
3737 index = index + 1
3838
7070 error (" Select a non-empty container" )
7171
7272 else
73- local plants = { }
73+ local plants = { } -- as:df.item_actual[]
7474 local plantCount = getPlants (rootItems , plants , 0 )
7575 print (" found " .. plantCount .. " plants" )
7676
77- local removedPlants = { }
77+ local removedPlants = { } -- as:bool[]
7878
7979 for i = 0 ,(plantCount - 2 ) do
80- local currentPlant = plants [i ]
80+ local currentPlant = plants [i ] -- as:df.item_plantst
8181 local itemsNeeded = max - currentPlant .stack_size
8282
8383 if removedPlants [currentPlant .id ] == nil and itemsNeeded > 0 then
0 commit comments