23 lines
575 B
Lua
23 lines
575 B
Lua
-- Delete ALL items not held by units, buildings or jobs
|
|
--[[=begin
|
|
|
|
devel/nuke-items
|
|
================
|
|
Deletes ALL items not held by units, buildings or jobs.
|
|
Intended solely for lag investigation.
|
|
|
|
=end]]
|
|
|
|
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)
|