Skip to content

Instantly share code, notes, and snippets.

@warmist
Last active December 15, 2016 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warmist/29138763a9387c9540fc1d443c4a247c to your computer and use it in GitHub Desktop.
Save warmist/29138763a9387c9540fc1d443c4a247c to your computer and use it in GitHub Desktop.
imbue
function set_histfig_material(item,base_material,figure_id)
local figure_base=219
local creature_base=19
item:setMaterial(figure_base+base_material-creature_base)
item:setMaterialIndex(figure_id)
end
function reaction_imbue(reaction,reaction_product,unit,input_items,input_reagents,output_items,call_native)
--printall(input_items[1])
local mat_source=input_items[1]
local mat=mat_source:getActualMaterial()
local mat_idx=mat_source:getActualMaterialIndex()
if df.item_body_component:is_instance(mat_source) then
set_histfig_material(input_items[0],mat,mat_source.hist_figure_id)
elseif input_items[1]:getMaterial()>=figure_base then
input_items[0]:setMaterial(input_items[1]:getMaterial())
input_items[0]:setMaterialIndex(input_items[1]:getMaterialIndex())
else
input_items[0]:setMaterial(mat)
input_items[0]:setMaterialIndex(mat_idx)
end
call_native.value=false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment