Make second function do what the first won't

Dummy out the DRINK_MAT lookup in the first one to stop the overlap, make the second one look up all the stuff that the first one expects to find with material reaction product tokens.
develop
scamtank 2015-06-12 00:10:50 +03:00
parent 435178807f
commit d049f79d08
1 changed files with 17 additions and 6 deletions

@ -249,7 +249,7 @@ end
function get_plant_reaction_products (mat) function get_plant_reaction_products (mat)
local list = {} local list = {}
add_react_prod (list, mat, "DRINK_MAT", "Used to brew ") -- add_react_prod (list, mat, "DRINK_MAT", "Used to brew ") -- redundant with the jury-rig in the next function
add_react_prod (list, mat, "GROWTH_JUICE_PROD", "Pressed into ") add_react_prod (list, mat, "GROWTH_JUICE_PROD", "Pressed into ")
add_react_prod (list, mat, "PRESS_LIQUID_MAT", "Pressed into ") add_react_prod (list, mat, "PRESS_LIQUID_MAT", "Pressed into ")
add_react_prod (list, mat, "LIQUID_EXTRACTABLE", "Extractable product: ") add_react_prod (list, mat, "LIQUID_EXTRACTABLE", "Extractable product: ")
@ -290,15 +290,26 @@ function GetFoodPropertiesStringList (item)
if item._type == df.item_plantst and GetMatPlant (item) then if item._type == df.item_plantst and GetMatPlant (item) then
local plant = GetMatPlant (item) local plant = GetMatPlant (item)
for k,v in pairs (plant.material_defs) do for k,v in pairs (plant.material_defs) do
if v ~= -1 and string.find (k,"type_") and not string.find (k,"type_basic") if v ~= -1 and string.find (k,"type_") and not (string.find (k,"type_basic")
or string.find (k,"type_seed") or string.find (k,"type_tree") then or string.find (k,"type_seed") or string.find (k,"type_tree")) then
local targetmat = dfhack.matinfo.decode (v, local targetmat = dfhack.matinfo.decode (v,
plant.material_defs["idx_"..string.match (k,"type_(.+)")]) plant.material_defs["idx_"..string.match (k,"type_(.+)")])
local state = "Liquid" local state = "Liquid"
if string.find (k,"type_mill") then state = "Powder" local describe = "Made into "
elseif string.find (k,"type_thread") then state = "Solid" end if string.find (k,"type_mill")
then state = "Powder" describe = "Ground into "
elseif string.find (k,"type_thread")
then state = "Solid" describe = "Woven into "
elseif string.find (k,"type_drink")
then describe = "Brewed into "
elseif string.find (k,"type_extract_barrel")
then describe = "Cask-aged into "
elseif string.find (k,"type_extract_vial")
then describe = "Refined into vials of "
elseif string.find (k,"type_extract_still_vial")
then describe = "Distilled into vials of " end
local st_name = targetmat.material.state_name[state] local st_name = targetmat.material.state_name[state]
append(list,"Used to make "..targetmat.material.prefix..''..st_name) append(list,describe..targetmat.material.prefix..''..st_name)
end end
end end
end end