v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
User:Fleeting Frames/wheelbarrow-stuckinside
Jump to navigation
Jump to search
Save aswheelbarrow-stuckinside.lua into /hack/scripts/fix folder.
If called with verbose parameter, prints out the wheelbarrows it looks at as well as the positions for each item it dumps out.
--empties wheelbarrows of stuck stones local args = ... local verbose = false if args == "verbose" then verbose = true end function printv(...) if verbose then print(...) end end for _, wb in ipairs(df.global.world.items.other.TOOL) do if wb.subtype.id == "ITEM_TOOL_WHEELBARROW" and wb.stockpile.id ~= -1 then printv(wb.id) local stuckpile = df.building.find(wb.stockpile.id) if ((wb.pos.x>=stuckpile.x1 and stuckpile.x2>=wb.pos.x) and (wb.pos.y>=stuckpile.y1 and stuckpile.y2>=wb.pos.y) and wb.pos.z == stuckpile.z) and not (wb.flags.in_inventory) then for i = (#wb.general_refs-1), 0, -1 do --for i,v in ipairs(wb.general_refs) do if wb.general_refs[i]._type == df.general_ref_contains_itemst then local stuckitem = df.item.find(wb.general_refs[i].item_id) if not stuckitem.flags.in_job then dfhack.items.moveToGround(stuckitem,wb.pos) printv("dumped item out", pos2xyz(wb.pos)) end end end end end end