2015-11-16 21:25:43 -07:00
|
|
|
-- Removes water from buckets (for lye-making).
|
|
|
|
--[[=begin
|
|
|
|
|
|
|
|
fix/dry-buckets
|
|
|
|
===============
|
|
|
|
Removes water from all buckets in your fortress, allowing them
|
|
|
|
to be used for making lye. Skips buckets in buildings (eg a well),
|
|
|
|
being carried, or currently used by a job.
|
|
|
|
|
|
|
|
=end]]
|
|
|
|
|
|
|
|
local emptied = 0
|
|
|
|
local water_type = dfhack.matinfo.find('WATER').type
|
|
|
|
|
|
|
|
for _,item in ipairs(df.global.world.items.all) do
|
2015-11-17 00:22:06 -07:00
|
|
|
if item:getMaterial() == water_type
|
|
|
|
and item:getType() == df.item_types.LIQUID_MISC
|
|
|
|
and dfhack.items.getContainer ~= nil
|
|
|
|
and not (item.flags.in_job or item.flags.in_building) then
|
2015-11-16 21:25:43 -07:00
|
|
|
dfhack.items.remove(item)
|
|
|
|
emptied = emptied + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
print('Emptied '..emptied..' buckets.')
|