Improve fix/dry-buckets checks

develop
PeridexisErrant 2015-11-23 17:51:26 +09:30
parent 1067eeb6d3
commit 7ed5a810b9
1 changed files with 6 additions and 3 deletions

@ -13,9 +13,12 @@ local emptied = 0
local water_type = dfhack.matinfo.find('WATER').type local water_type = dfhack.matinfo.find('WATER').type
for _,item in ipairs(df.global.world.items.all) do for _,item in ipairs(df.global.world.items.all) do
if item:getMaterial() == water_type container = dfhack.items.getContainer(item)
and item:getType() == df.item_types.LIQUID_MISC if container ~= nil
and dfhack.items.getContainer ~= 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 and not (item.flags.in_job or item.flags.in_building) then
dfhack.items.remove(item) dfhack.items.remove(item)
emptied = emptied + 1 emptied = emptied + 1