|
150 | 150 | if has_flag('WOOD') and is_raw then |
151 | 151 | add_use("Carpenter's workshop", 'Make wooden items/furniture') |
152 | 152 | add_use('Wood furnace', 'Make charcoal/ash') |
| 153 | + add_use("Bowyer's workshop", 'Make crossbow') |
153 | 154 | end |
154 | 155 | if has_flag('IS_METAL') then |
155 | 156 | if is_raw then add_use("Metalsmith's forge", 'Forge metal items') end |
@@ -225,47 +226,24 @@ end |
225 | 226 | --------------------------------------------------------------------------- |
226 | 227 | -- 3. ITEM TYPE USES |
227 | 228 | --------------------------------------------------------------------------- |
228 | | -if item_type == df.item_type.PLANT then |
229 | | - add_use("Farmer's workshop", 'Process plant') |
230 | | -elseif item_type == df.item_type.SEEDS then |
| 229 | +if item_type == df.item_type.SEEDS then |
231 | 230 | add_use('Farm plot', 'Plant seeds') |
232 | | -elseif item_type == df.item_type.BOULDER then |
233 | | - add_use("Mason's workshop", 'Construct furniture') |
234 | | - add_use("Craftsdwarf's workshop", 'Make crafts') |
235 | 231 | elseif item_type == df.item_type.ROUGH then |
236 | 232 | add_use("Jeweler's workshop", 'Cut rough gem') |
237 | 233 | elseif item_type == df.item_type.SMALLGEM then |
238 | 234 | add_use("Jeweler's workshop", 'Encrust with gem') |
239 | | -elseif item_type == df.item_type.WOOD then |
240 | | - add_use("Carpenter's workshop", 'Make wooden furniture/items') |
241 | | - add_use('Wood furnace', 'Make charcoal/ash') |
242 | | - add_use("Bowyer's workshop", 'Make crossbow') |
243 | 235 | elseif item_type == df.item_type.CLOTH then |
244 | 236 | add_use("Clothier's shop", 'Make clothing') |
245 | 237 | add_use("Dyer's shop", 'Dye cloth') |
246 | 238 | elseif item_type == df.item_type.THREAD then |
247 | 239 | add_use('Loom', 'Weave into cloth') |
248 | 240 | add_use("Dyer's shop", 'Dye thread') |
249 | | -elseif item_type == df.item_type.SKIN_TANNED then |
250 | | - add_use('Leatherworks', 'Make leather items') |
251 | | -elseif item_type == df.item_type.MEAT then |
252 | | - add_use('Kitchen', 'Cook in meal') |
253 | 241 | elseif item_type == df.item_type.FISH_RAW then |
254 | 242 | add_use('Fishery', 'Prepare raw fish') |
255 | 243 | elseif item_type == df.item_type.EGG then |
256 | | - add_use('Kitchen', 'Cook in meal') |
257 | 244 | add_use('Nest box', 'Hatch (if fertile)') |
258 | | -elseif item_type == df.item_type.GLOB then |
259 | | - add_use('Kitchen', 'Render fat / Cook tallow') |
260 | | -elseif item_type == df.item_type.CHEESE then |
261 | | - add_use('Kitchen', 'Cook in meal') |
262 | 245 | elseif item_type == df.item_type.DRINK then |
263 | 246 | add_use('Tavern', 'Drink') |
264 | | -elseif item_type == df.item_type.BAR then |
265 | | - if has_flag('IS_METAL') then |
266 | | - add_use("Metalsmith's forge", 'Forge weapons/armor/items') |
267 | | - end |
268 | | - if has_flag('SOAP') then add_use('Hospital', 'Cleaning') end |
269 | 247 | elseif item_type == df.item_type.BLOCKS then |
270 | 248 | add_use('Construction', 'Build walls/floors/stairs') |
271 | 249 | end |
@@ -306,34 +284,16 @@ for _, r in ipairs(df.global.world.raws.reactions.reactions) do |
306 | 284 |
|
307 | 285 | -- If BOTH item_type and mat_type are -1 (accepts anything), |
308 | 286 | -- require at least has_material_reaction_product or reaction_class |
309 | | - local has_hmrp = false |
310 | | - local hmrp_val = nil |
311 | | - if ir.has_material_reaction_product and #ir.has_material_reaction_product > 0 then |
312 | | - has_hmrp = true |
313 | | - hmrp_val = ir.has_material_reaction_product |
314 | | - end |
315 | | - |
316 | | - local has_rc = false |
317 | | - local rc_val = nil |
318 | | - if ir.reaction_class and #ir.reaction_class > 0 then |
319 | | - has_rc = true |
320 | | - rc_val = ir.reaction_class |
321 | | - end |
| 287 | + local hmrp = ir.has_material_reaction_product ~= "" and ir.has_material_reaction_product or nil |
| 288 | + local rc = ir.reaction_class ~= "" and ir.reaction_class or nil |
322 | 289 |
|
323 | 290 | -- Skip overly generic reagents (both type and mat are wildcard, no extra filters) |
324 | | - if ir.item_type == -1 and ir.mat_type == -1 and not has_hmrp and not has_rc then |
| 291 | + if ir.item_type == -1 and ir.mat_type == -1 and not hmrp and not rc then |
325 | 292 | goto next_reaction |
326 | 293 | end |
327 | 294 |
|
328 | | - -- Verify has_material_reaction_product |
329 | | - if has_hmrp then |
330 | | - if not mat_has_product(material, hmrp_val) then goto next_reaction end |
331 | | - end |
332 | | - |
333 | | - -- Verify reaction_class |
334 | | - if has_rc then |
335 | | - if not mat_has_class(material, rc_val) then goto next_reaction end |
336 | | - end |
| 295 | + if hmrp and not mat_has_product(material, hmrp) then goto next_reaction end |
| 296 | + if rc and not mat_has_class(material, rc) then goto next_reaction end |
337 | 297 |
|
338 | 298 | -- Match! |
339 | 299 | add_use(get_workshop_name(r), r.name) |
|
0 commit comments