From 7ed5a810b92f5d78762bbc53af0ce9b3e4209372 Mon Sep 17 00:00:00 2001 From: PeridexisErrant Date: Mon, 23 Nov 2015 17:51:26 +0930 Subject: [PATCH] Improve fix/dry-buckets checks --- scripts/fix/dry-buckets.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/fix/dry-buckets.lua b/scripts/fix/dry-buckets.lua index 6e5ca24cf..4be4bc3cd 100644 --- a/scripts/fix/dry-buckets.lua +++ b/scripts/fix/dry-buckets.lua @@ -13,9 +13,12 @@ local emptied = 0 local water_type = dfhack.matinfo.find('WATER').type for _,item in ipairs(df.global.world.items.all) do - if item:getMaterial() == water_type - and item:getType() == df.item_types.LIQUID_MISC - and dfhack.items.getContainer ~= nil + container = dfhack.items.getContainer(item) + if container ~= nil + and container:getType() == dfhack.item_type.BUCKET + and not (container.flags.in_job or container.flags.in_building) + and item:getMaterial() == water_type + and item:getType() == dfhack.item_type.LIQUID_MISC and not (item.flags.in_job or item.flags.in_building) then dfhack.items.remove(item) emptied = emptied + 1