From d049f79d08c7c4b5b39ef806d0dda098127d825d Mon Sep 17 00:00:00 2001 From: scamtank Date: Fri, 12 Jun 2015 00:10:50 +0300 Subject: [PATCH] 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. --- scripts/view-item-info.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/view-item-info.lua b/scripts/view-item-info.lua index 9ea539ca2..db5e1b441 100644 --- a/scripts/view-item-info.lua +++ b/scripts/view-item-info.lua @@ -249,7 +249,7 @@ end function get_plant_reaction_products (mat) 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, "PRESS_LIQUID_MAT", "Pressed into ") 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 local plant = GetMatPlant (item) for k,v in pairs (plant.material_defs) do - 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 + 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 local targetmat = dfhack.matinfo.decode (v, plant.material_defs["idx_"..string.match (k,"type_(.+)")]) local state = "Liquid" - if string.find (k,"type_mill") then state = "Powder" - elseif string.find (k,"type_thread") then state = "Solid" end + local describe = "Made into " + 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] - append(list,"Used to make "..targetmat.material.prefix..''..st_name) + append(list,describe..targetmat.material.prefix..''..st_name) end end end