@@ -137,30 +137,29 @@ funcs.seeds = function()
137
137
if p .material_defs .type .seed == - 1 or p .material_defs .idx .seed == - 1 or p .flags .TREE then goto continue end
138
138
ban_cooking (p .name .. ' seeds' , p .material_defs .type .seed , p .material_defs .idx .seed , df .item_type .SEEDS , - 1 )
139
139
for _ , m in ipairs (p .material ) do
140
- if m .id == " STRUCTURAL" and m . flags . EDIBLE_COOKED then
141
- local has_drink = false
142
- local has_seed = false
143
- for _ , s in ipairs (m .reaction_product .id ) do
144
- has_seed = has_seed or s .value == " SEED_MAT"
145
- has_drink = has_drink or s . value == " DRINK_MAT "
146
- end
147
- if has_seed and has_drink then
148
- local matinfo = dfhack . matinfo . find (p .id , m .id )
149
- ban_cooking ( p . name .. ' ' .. m . id , matinfo . type , matinfo . index , df . item_type . PLANT , - 1 )
140
+ if m .id == " STRUCTURAL" then
141
+ if m . flags . EDIBLE_COOKED then
142
+ local has_seed = false
143
+ for _ , s in ipairs (m .reaction_product .id ) do
144
+ has_seed = has_seed or s .value == " SEED_MAT"
145
+ end
146
+ if has_seed then
147
+ local matinfo = dfhack . matinfo . find ( p . id , m . id )
148
+ ban_cooking (p .name .. ' ' .. m .id , matinfo . type , matinfo . index , df . item_type . PLANT , - 1 )
149
+ end
150
150
end
151
+ break
151
152
end
152
153
end
153
154
for k , g in ipairs (p .growths ) do
154
155
local matinfo = dfhack .matinfo .decode (g )
155
156
local m = matinfo .material
156
157
if m .flags .EDIBLE_COOKED then
157
- local has_drink = false
158
158
local has_seed = false
159
159
for _ , s in ipairs (m .reaction_product .id ) do
160
160
has_seed = has_seed or s .value == " SEED_MAT"
161
- has_drink = has_drink or s .value == " DRINK_MAT"
162
161
end
163
- if has_seed and has_drink then
162
+ if has_seed then
164
163
ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT_GROWTH , k )
165
164
end
166
165
end
@@ -174,14 +173,18 @@ funcs.brew = function()
174
173
for _ , p in ipairs (df .global .world .raws .plants .all ) do
175
174
if p .material_defs .type .drink == - 1 or p .material_defs .idx .drink == - 1 then goto continue end
176
175
for _ , m in ipairs (p .material ) do
177
- if m .id == " STRUCTURAL" and m .flags .EDIBLE_COOKED then
178
- for _ , s in ipairs (m .reaction_product .id ) do
179
- if s .value == " DRINK_MAT" then
180
- local matinfo = dfhack .matinfo .find (p .id , m .id )
181
- ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
182
- break
176
+ if m .id == " STRUCTURAL" then
177
+ if m .flags .EDIBLE_COOKED then
178
+ for _ , s in ipairs (m .reaction_product .id ) do
179
+ if s .value == " DRINK_MAT" then
180
+ local matinfo = dfhack .matinfo .find (p .id , m .id )
181
+ ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
182
+ break
183
+ end
183
184
end
184
185
end
186
+ -- Stop iterating materials since there is only one STRUCTURAL
187
+ break
185
188
end
186
189
end
187
190
for k , g in ipairs (p .growths ) do
@@ -205,9 +208,12 @@ funcs.mill = function()
205
208
for _ , p in ipairs (df .global .world .raws .plants .all ) do
206
209
if p .material_defs .idx .mill ~= - 1 then
207
210
for _ , m in ipairs (p .material ) do
208
- if m .id == " STRUCTURAL" and m .flags .EDIBLE_COOKED then
209
- local matinfo = dfhack .matinfo .find (p .id , m .id )
210
- ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
211
+ if m .id == " STRUCTURAL" then
212
+ if m .flags .EDIBLE_COOKED then
213
+ local matinfo = dfhack .matinfo .find (p .id , m .id )
214
+ ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
215
+ end
216
+ break
211
217
end
212
218
end
213
219
end
@@ -218,14 +224,17 @@ funcs.thread = function()
218
224
for _ , p in ipairs (df .global .world .raws .plants .all ) do
219
225
if p .material_defs .idx .thread == - 1 then goto continue end
220
226
for _ , m in ipairs (p .material ) do
221
- if m .id == " STRUCTURAL" and m .flags .EDIBLE_COOKED then
222
- for _ , s in ipairs (m .reaction_product .id ) do
223
- if s .value == " THREAD" then
224
- local matinfo = dfhack .matinfo .find (p .id , m .id )
225
- ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
226
- break
227
+ if m .id == " STRUCTURAL" then
228
+ if m .flags .EDIBLE_COOKED then
229
+ for _ , s in ipairs (m .reaction_product .id ) do
230
+ if s .value == " THREAD" then
231
+ local matinfo = dfhack .matinfo .find (p .id , m .id )
232
+ ban_cooking (p .name .. ' ' .. m .id , matinfo .type , matinfo .index , df .item_type .PLANT , - 1 )
233
+ break
234
+ end
227
235
end
228
236
end
237
+ break
229
238
end
230
239
end
231
240
for k , g in ipairs (p .growths ) do
0 commit comments