@@ -149,7 +149,7 @@ function select_order(stockpile)
149149 screen :show ()
150150end
151151
152- function reaction_entry (job_type , values , name )
152+ function reaction_entry (reactions , job_type , values , name )
153153 local order = df .manager_order :new ()
154154 -- These defaults differ from the newly created order's.
155155 order :assign {
@@ -165,10 +165,10 @@ function reaction_entry(job_type, values, name)
165165 order :assign (values )
166166 end
167167
168- return {
168+ table.insert ( reactions , {
169169 name = name or df .job_type .attrs [job_type ].caption ,
170170 order = order ,
171- }
171+ })
172172end
173173
174174function resource_reactions (reactions , job_type , mat_info , keys , items , options )
@@ -191,7 +191,7 @@ function resource_reactions(reactions, job_type, mat_info, keys, items, options)
191191 end
192192
193193 values .item_subtype = itemid
194- table.insert (reactions , reaction_entry ( job_type , values , start .. " " .. mat_info .adjective .. item_name ) )
194+ reaction_entry (reactions , job_type , values , start .. " " .. mat_info .adjective .. item_name )
195195 end
196196 end
197197end
@@ -204,7 +204,7 @@ function material_reactions(reactions, itemtypes, mat_info)
204204 line = line .. " " .. row [3 ]
205205 end
206206
207- table.insert (reactions , reaction_entry ( row [1 ], mat_info .management , line ) )
207+ reaction_entry (reactions , row [1 ], mat_info .management , line )
208208 end
209209end
210210
@@ -252,48 +252,48 @@ function collect_reactions()
252252 materials .leather .clothing_flag = " LEATHER"
253253
254254 -- Collection and Entrapment
255- table.insert (result , reaction_entry ( job_types .CollectWebs ) )
256- table.insert (result , reaction_entry ( job_types .CollectSand ) )
257- table.insert (result , reaction_entry ( job_types .CollectClay ) )
258- table.insert (result , reaction_entry ( job_types .CatchLiveLandAnimal ) )
259- table.insert (result , reaction_entry ( job_types .CatchLiveFish ) )
255+ reaction_entry (result , job_types .CollectWebs )
256+ reaction_entry (result , job_types .CollectSand )
257+ reaction_entry (result , job_types .CollectClay )
258+ reaction_entry (result , job_types .CatchLiveLandAnimal )
259+ reaction_entry (result , job_types .CatchLiveFish )
260260
261261 -- Cutting, encrusting, and metal extraction.
262262 local rock_types = df .global .world .raws .inorganics
263263 for rock_id = # rock_types - 1 , 0 , - 1 do
264264 local material = rock_types [rock_id ].material
265265 local rock_name = material .state_adj .Solid
266266 if material .flags .IS_STONE or material .flags .IS_GEM then
267- table.insert (result , reaction_entry ( job_types .CutGems , {
267+ reaction_entry (result , job_types .CutGems , {
268268 mat_type = 0 ,
269269 mat_index = rock_id ,
270- }, " Cut " .. rock_name ))
270+ }, " Cut " .. rock_name )
271271
272- table.insert (result , reaction_entry ( job_types .EncrustWithGems , {
272+ reaction_entry (result , job_types .EncrustWithGems , {
273273 mat_type = 0 ,
274274 mat_index = rock_id ,
275275 item_category = {finished_goods = true },
276- }, " Encrust Finished Goods With " .. rock_name ))
276+ }, " Encrust Finished Goods With " .. rock_name )
277277
278- table.insert (result , reaction_entry ( job_types .EncrustWithGems , {
278+ reaction_entry (result , job_types .EncrustWithGems , {
279279 mat_type = 0 ,
280280 mat_index = rock_id ,
281281 item_category = {furniture = true },
282- }, " Encrust Furniture With " .. rock_name ))
282+ }, " Encrust Furniture With " .. rock_name )
283283
284- table.insert (result , reaction_entry ( job_types .EncrustWithGems , {
284+ reaction_entry (result , job_types .EncrustWithGems , {
285285 mat_type = 0 ,
286286 mat_index = rock_id ,
287287 item_category = {ammo = true },
288- }, " Encrust Ammo With " .. rock_name ))
288+ }, " Encrust Ammo With " .. rock_name )
289289 end
290290
291291 if # rock_types [rock_id ].metal_ore .mat_index > 0 then
292- table.insert (result , reaction_entry ( job_types .SmeltOre , {mat_type = 0 , mat_index = rock_id }, " Smelt " .. rock_name .. " Ore" ) )
292+ reaction_entry (result , job_types .SmeltOre , {mat_type = 0 , mat_index = rock_id }, " Smelt " .. rock_name .. " Ore" )
293293 end
294294
295295 if # rock_types [rock_id ].thread_metal .mat_index > 0 then
296- table.insert (result , reaction_entry ( job_types .ExtractMetalStrands , {mat_type = 0 , mat_index = rock_id }) )
296+ reaction_entry (result , job_types .ExtractMetalStrands , {mat_type = 0 , mat_index = rock_id })
297297 end
298298 end
299299
@@ -311,28 +311,28 @@ function collect_reactions()
311311 management = {mat_type = glass_id },
312312 })
313313
314- table.insert (result , reaction_entry ( job_types .CutGlass , {mat_type = glass_id }, " Cut " .. glass_name ) )
314+ reaction_entry (result , job_types .CutGlass , {mat_type = glass_id }, " Cut " .. glass_name )
315315
316- table.insert (result , reaction_entry ( job_types .EncrustWithGlass , {
316+ reaction_entry (result , job_types .EncrustWithGlass , {
317317 mat_type = glass_id ,
318318 item_category = {finished_goods = true },
319- }, " Encrust Finished Goods With " .. glass_name ))
319+ }, " Encrust Finished Goods With " .. glass_name )
320320
321- table.insert (result , reaction_entry ( job_types .EncrustWithGlass , {
321+ reaction_entry (result , job_types .EncrustWithGlass , {
322322 mat_type = glass_id ,
323323 item_category = {furniture = true },
324- }, " Encrust Furniture With " .. glass_name ))
324+ }, " Encrust Furniture With " .. glass_name )
325325
326- table.insert (result , reaction_entry ( job_types .EncrustWithGlass , {
326+ reaction_entry (result , job_types .EncrustWithGlass , {
327327 mat_type = glass_id ,
328328 item_category = {ammo = true },
329- }, " Encrust Ammo With " .. glass_name ))
329+ }, " Encrust Ammo With " .. glass_name )
330330 end
331331 end
332332
333333 -- Dyeing
334- table.insert (result , reaction_entry ( job_types .DyeThread ) )
335- table.insert (result , reaction_entry ( job_types .DyeCloth ) )
334+ reaction_entry (result , job_types .DyeThread )
335+ reaction_entry (result , job_types .DyeCloth )
336336
337337 -- Sew Image
338338 local cloth_mats = {materials .cloth , materials .silk , materials .yarn , materials .leather }
@@ -344,45 +344,45 @@ function collect_reactions()
344344 material_reactions (result , {{job_types .DecorateWith , " Decorate With" }}, spec )
345345 end
346346
347- table.insert (result , reaction_entry ( job_types .MakeTotem ) )
348- table.insert (result , reaction_entry ( job_types .ButcherAnimal ) )
349- table.insert (result , reaction_entry ( job_types .MillPlants ) )
350- table.insert (result , reaction_entry ( job_types .MakePotashFromLye ) )
351- table.insert (result , reaction_entry ( job_types .MakePotashFromAsh ) )
347+ reaction_entry (result , job_types .MakeTotem )
348+ reaction_entry (result , job_types .ButcherAnimal )
349+ reaction_entry (result , job_types .MillPlants )
350+ reaction_entry (result , job_types .MakePotashFromLye )
351+ reaction_entry (result , job_types .MakePotashFromAsh )
352352
353353 -- Kitchen
354- table.insert (result , reaction_entry ( job_types .PrepareMeal , {mat_type = 2 }, " Prepare Easy Meal" ) )
355- table.insert (result , reaction_entry ( job_types .PrepareMeal , {mat_type = 3 }, " Prepare Fine Meal" ) )
356- table.insert (result , reaction_entry ( job_types .PrepareMeal , {mat_type = 4 }, " Prepare Lavish Meal" ) )
354+ reaction_entry (result , job_types .PrepareMeal , {mat_type = 2 }, " Prepare Easy Meal" )
355+ reaction_entry (result , job_types .PrepareMeal , {mat_type = 3 }, " Prepare Fine Meal" )
356+ reaction_entry (result , job_types .PrepareMeal , {mat_type = 4 }, " Prepare Lavish Meal" )
357357
358358 if v34 then
359359 -- Brew Drink
360- table.insert (result , reaction_entry ( job_types .BrewDrink ) )
360+ reaction_entry (result , job_types .BrewDrink )
361361 end
362362
363363 -- Weaving
364- table.insert (result , reaction_entry ( job_types .WeaveCloth , {material_category = {plant = true }}, " Weave Thread into Cloth" ) )
365- table.insert (result , reaction_entry ( job_types .WeaveCloth , {material_category = {silk = true }}, " Weave Thread into Silk" ) )
366- table.insert (result , reaction_entry ( job_types .WeaveCloth , {material_category = {yarn = true }}, " Weave Yarn into Cloth" ) )
364+ reaction_entry (result , job_types .WeaveCloth , {material_category = {plant = true }}, " Weave Thread into Cloth" )
365+ reaction_entry (result , job_types .WeaveCloth , {material_category = {silk = true }}, " Weave Thread into Silk" )
366+ reaction_entry (result , job_types .WeaveCloth , {material_category = {yarn = true }}, " Weave Yarn into Cloth" )
367367
368368 -- Extracts, farmer's workshop, and wood burning
369- table.insert (result , reaction_entry ( job_types .ExtractFromPlants ) )
370- table.insert (result , reaction_entry ( job_types .ExtractFromRawFish ) )
371- table.insert (result , reaction_entry ( job_types .ExtractFromLandAnimal ) )
372- table.insert (result , reaction_entry ( job_types .PrepareRawFish ) )
373- table.insert (result , reaction_entry ( job_types .MakeCheese ) )
374- table.insert (result , reaction_entry ( job_types .MilkCreature ) )
375- table.insert (result , reaction_entry ( job_types .ShearCreature ) )
376- table.insert (result , reaction_entry ( job_types .SpinThread ) )
377- table.insert (result , reaction_entry ( job_types .MakeLye ) )
378- table.insert (result , reaction_entry ( job_types .ProcessPlants ) )
369+ reaction_entry (result , job_types .ExtractFromPlants )
370+ reaction_entry (result , job_types .ExtractFromRawFish )
371+ reaction_entry (result , job_types .ExtractFromLandAnimal )
372+ reaction_entry (result , job_types .PrepareRawFish )
373+ reaction_entry (result , job_types .MakeCheese )
374+ reaction_entry (result , job_types .MilkCreature )
375+ reaction_entry (result , job_types .ShearCreature )
376+ reaction_entry (result , job_types .SpinThread )
377+ reaction_entry (result , job_types .MakeLye )
378+ reaction_entry (result , job_types .ProcessPlants )
379379 if v34 then
380- table.insert (result , reaction_entry ( job_types .ProcessPlantsBag ) )
380+ reaction_entry (result , job_types .ProcessPlantsBag )
381381 end
382- table.insert (result , reaction_entry ( job_types .ProcessPlantsVial ) )
383- table.insert (result , reaction_entry ( job_types .ProcessPlantsBarrel ) )
384- table.insert (result , reaction_entry ( job_types .MakeCharcoal ) )
385- table.insert (result , reaction_entry ( job_types .MakeAsh ) )
382+ reaction_entry (result , job_types .ProcessPlantsVial )
383+ reaction_entry (result , job_types .ProcessPlantsBarrel )
384+ reaction_entry (result , job_types .MakeCharcoal )
385+ reaction_entry (result , job_types .MakeAsh )
386386
387387 -- Reactions defined in the raws.
388388 -- Not all reactions are allowed to the civilization.
@@ -397,7 +397,7 @@ function collect_reactions()
397397 for _ , reaction_id in ipairs (entity .entity_raw .workshops .permitted_reaction_id ) do
398398 local reaction = df .global .world .raws .reactions [reaction_id ]
399399 local name = string.gsub (reaction .name , " ^." , string.upper )
400- table.insert (result , reaction_entry ( job_types .CustomReaction , {reaction_name = reaction .code }, name ) )
400+ reaction_entry (result , job_types .CustomReaction , {reaction_name = reaction .code }, name )
401401 end
402402
403403 -- Metal forging
@@ -412,7 +412,7 @@ function collect_reactions()
412412 }
413413
414414 if material .flags .IS_METAL then
415- table.insert (result , reaction_entry ( job_types .StudWith , mat_flags .management , " Stud With " .. rock_name ) )
415+ reaction_entry (result , job_types .StudWith , mat_flags .management , " Stud With " .. rock_name )
416416
417417 if material .flags .ITEMS_WEAPON then
418418 -- Todo: Are these really the right flags to check?
@@ -525,7 +525,7 @@ function collect_reactions()
525525 end
526526
527527 -- Traction Bench
528- table.insert (result , reaction_entry ( job_types .ConstructTractionBench ) )
528+ reaction_entry (result , job_types .ConstructTractionBench )
529529
530530 -- Non-metal weapons
531531 resource_reactions (result , job_types .MakeWeapon , materials .wood , entity .resources .weapon_type , itemdefs .weapons , {
@@ -649,7 +649,7 @@ function collect_reactions()
649649 end
650650
651651 -- Bed, specified as wooden.
652- table.insert (result , reaction_entry ( job_types .ConstructBed , materials .wood .management ) )
652+ reaction_entry (result , job_types .ConstructBed , materials .wood .management )
653653
654654 -- Windows
655655 for _ , mat_info in ipairs (glasses ) do
@@ -659,7 +659,7 @@ function collect_reactions()
659659 end
660660
661661 -- Rock Mechanisms
662- table.insert (result , reaction_entry ( job_types .ConstructMechanisms , materials .rock .management ) )
662+ reaction_entry (result , job_types .ConstructMechanisms , materials .rock .management )
663663
664664 resource_reactions (result , job_types .AssembleSiegeAmmo , materials .wood , entity .resources .siegeammo_type , itemdefs .siege_ammo , {
665665 verb = " Assemble" ,
@@ -718,8 +718,8 @@ function collect_reactions()
718718 end
719719
720720 -- Siege engine parts
721- table.insert (result , reaction_entry ( job_types .ConstructCatapultParts , materials .wood .management ) )
722- table.insert (result , reaction_entry ( job_types .ConstructBallistaParts , materials .wood .management ) )
721+ reaction_entry (result , job_types .ConstructCatapultParts , materials .wood .management )
722+ reaction_entry (result , job_types .ConstructBallistaParts , materials .wood .management )
723723
724724 for _ , mat in ipairs {materials .wood , materials .bone } do
725725 resource_reactions (result , job_types .MakeAmmo , mat , entity .resources .ammo_type , itemdefs .ammo , {
@@ -736,7 +736,7 @@ function collect_reactions()
736736 end
737737
738738 -- Melt a Metal Object
739- table.insert (result , reaction_entry ( job_types .MeltMetalObject ) )
739+ reaction_entry (result , job_types .MeltMetalObject )
740740
741741 return result
742742end
0 commit comments