2013-04-24 11:22:19 -06:00
|
|
|
-- 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.
|
2013-05-05 16:48:12 -06:00
|
|
|
if df.building_actual:is_instance(building) then
|
2013-04-24 11:22:19 -06:00
|
|
|
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
|
2015-02-14 20:53:06 -07:00
|
|
|
|
2013-04-24 11:22:19 -06:00
|
|
|
if undumped > 0 then
|
|
|
|
local s = "s"
|
|
|
|
if undumped == 1 then s = "" end
|
|
|
|
print("Undumped "..undumped.." item"..s..".")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
undump_buildings()
|