@@ -113,13 +113,30 @@ local function is_valid_corpse(item)
113
113
return not is_entombed (item )
114
114
end
115
115
116
+ local usable_types = {
117
+ ' plant' ,
118
+ ' silk' ,
119
+ ' leather' ,
120
+ ' bone' ,
121
+ ' shell' ,
122
+ ' wood' ,
123
+ ' soap' ,
124
+ ' tooth' ,
125
+ ' horn' ,
126
+ ' pearl' ,
127
+ ' skull' ,
128
+ ' hair_wool' ,
129
+ ' yarn' ,
130
+ }
131
+
116
132
local function is_usable_corpse_piece (item )
117
- return item .corpse_flags .hair_wool or
118
- item .corpse_flags .pearl or
119
- item .corpse_flags .plant or
120
- item .corpse_flags .shell or
121
- item .corpse_flags .silk or
122
- item .corpse_flags .yarn
133
+ if item .flags .dead_dwarf or item .corpse_flags .unbutchered then
134
+ return false
135
+ end
136
+ for _ ,flag in ipairs (usable_types ) do
137
+ if item .corpse_flags [flag ] then return true end
138
+ end
139
+ return false
123
140
end
124
141
125
142
local function is_valid_usable_corpse_piece (item )
@@ -256,7 +273,9 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
256
273
state = get_default_state ()
257
274
utils .assign (state , dfhack .persistent .getSiteData (GLOBAL_KEY , state ))
258
275
259
- event_loop ()
276
+ for _ ,category in ipairs (categories ) do
277
+ event_loop (category )
278
+ end
260
279
end
261
280
262
281
---- -----------------
@@ -297,7 +316,7 @@ local function status()
297
316
local running_str = state .enabled and ' Running' or ' Would run'
298
317
print ((' deteriorate is %s' ):format (state .enabled and ' enabled' or ' disabled' ))
299
318
print ()
300
- for _ ,category in pairs (categories ) do
319
+ for _ ,category in ipairs (categories ) do
301
320
local status_str = ' Stopped'
302
321
local category_data = state .categories [category ]
303
322
if category_data .enabled then
0 commit comments