dfhack/scripts/devel/nuke-items.lua

23 lines
575 B
Lua

-- Delete ALL items not held by units, buildings or jobs
2015-11-04 05:14:10 -07:00
--[[=begin
devel/nuke-items
================
Deletes ALL items not held by units, buildings or jobs.
Intended solely for lag investigation.
=end]]
2012-06-13 00:54:28 -06:00
local count = 0
for _,v in ipairs(df.global.world.items.all) do
if not (v.flags.in_building or v.flags.construction or v.flags.in_job
or dfhack.items.getGeneralRef(v,df.general_ref_type.UNIT_HOLDER)) then
count = count + 1
v.flags.forbid = true
v.flags.garbage_collect = true
end
end
print('Deletion requested: '..count)