forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdry-buckets.lua
28 lines (23 loc) · 865 Bytes
/
dry-buckets.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- Removes water from buckets (for lye-making).
--[====[
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.
]====]
local emptied = 0
local water_type = dfhack.matinfo.find('WATER').type
for _,item in ipairs(df.global.world.items.all) do
local container = dfhack.items.getContainer(item)
if container ~= nil
and container:getType() == df.item_type.BUCKET
and not (container.flags.in_job or container.flags.in_building)
and item:getMaterial() == water_type
and item:getType() == df.item_type.LIQUID_MISC
and not (item.flags.in_job or item.flags.in_building) then
dfhack.items.remove(item)
emptied = emptied + 1
end
end
print('Emptied '..emptied..' buckets.')