Anvilguide: Select proper ingot if change material

This commit is contained in:
Wuzzy 2020-04-01 05:24:59 +02:00
parent 8c57528369
commit 4bff4e99ed
1 changed files with 6 additions and 0 deletions

View File

@ -371,10 +371,12 @@ realtest.show_craft_guide_anvil = function( player, formname, fields)
end
local material
local mtypes = { "a", "m", "i" } -- anvil, metal, instrument
local material_button_pressed = false
for m=1, #metals.list do
for _,t in pairs(mtypes) do
if fields[t.."material_"..metals.list[m]] then
material = metals.list[m]
material_button_pressed = true
break
end
end
@ -392,6 +394,10 @@ realtest.show_craft_guide_anvil = function( player, formname, fields)
for i, v in ipairs(realtest.registered_anvil_recipes ) do
if( v and v.output and fields[ v.output ]) then
nr = i;
break
elseif( material_button_pressed and v and v.material and material == v.material) then
nr = i;
break
end
end
local plan = realtest.registered_anvil_recipes[ nr ];