Building base material undump script.

Based on an idea in https://github.com/peterix/dfhack/issues/119
develop
Eric Wald 2013-04-24 11:22:19 -06:00
parent 18a91ef221
commit ab4a38415a
1 changed files with 29 additions and 0 deletions

@ -0,0 +1,29 @@
-- Undesignates building base materials for dumping.
function undump_buildings()
local buildings = df.global.world.buildings.all
local undumped = 0
for i = 0, #buildings - 1 do
local building = buildings[i]
-- Zones and stockpiles don't have the contained_items field.
if not (df.building_civzonest:is_instance(building) or
df.building_stockpilest:is_instance(building)) then
local items = building.contained_items
for j = 0, #items - 1 do
local contained = items[j]
if contained.use_mode == 2 and contained.item.flags.dump then
-- print(building, contained.item)
undumped = undumped + 1
contained.item.flags.dump = false
end
end
end
end
if undumped > 0 then
local s = "s"
if undumped == 1 then s = "" end
print("Undumped "..undumped.." item"..s..".")
end
end
undump_buildings()