added a mini craft guide to anvil, joiner table and scribing table

master
Sokomine 2015-07-27 05:08:45 +02:00 committed by Vanessa Ezekowitz
parent 12bd16e60e
commit 7d873233ad
3 changed files with 394 additions and 20 deletions

View File

@ -10,7 +10,8 @@ function realtest.register_anvil_recipe(RecipeDef)
rmitem2 = RecipeDef.rmitem2,
output = RecipeDef.output or "",
level = RecipeDef.level or 0,
instrument = RecipeDef.instrument or "hammer"
instrument = RecipeDef.instrument or "hammer",
material = RecipeDef.material, -- just to make the craft guide more manageable
}
if recipe.rmitem1 == nil then
recipe.rmitem1 = true
@ -31,6 +32,7 @@ for i, metal in ipairs(metals.list) do
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_unshaped",
output = "metals:"..metal.."_ingot",
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_sheet",
@ -38,23 +40,27 @@ for i, metal in ipairs(metals.list) do
rmitem2 = false,
output = "instruments:bucket_"..metal,
level = metals.levels[i],
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doubleingot",
output = "metals:"..metal.."_sheet",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doubleingot",
output = "metals:"..metal.."_ingot 2",
level = metals.levels[i] - 1,
instrument = "chisel"
instrument = "chisel",
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_doublesheet",
output = "metals:"..metal.."_sheet 2",
level = metals.levels[i] - 1,
instrument = "chisel"
instrument = "chisel",
material = metal,
})
realtest.register_anvil_recipe({
type = "weld",
@ -62,6 +68,7 @@ for i, metal in ipairs(metals.list) do
item2 = "metals:"..metal.."_ingot",
output = "metals:"..metal.."_doubleingot",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
type = "weld",
@ -69,44 +76,51 @@ for i, metal in ipairs(metals.list) do
item2 = "metals:"..metal.."_sheet",
output = "metals:"..metal.."_doublesheet",
level = metals.levels[i] - 1,
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_ingot",
item2 = "scribing_table:plan_lock",
rmitem2 = false,
output = "metals:"..metal.."_lock",
level = metals.levels[i]
level = metals.levels[i],
material = metal,
})
realtest.register_anvil_recipe({
item1 = "metals:"..metal.."_ingot",
item2 = "scribing_table:plan_hatch",
rmitem2 = false,
output = "hatches:"..metal.."_hatch_closed",
level = metals.levels[i]
})
realtest.register_anvil_recipe({
item1 = "minerals:borax",
output = "minerals:flux 8"
})
realtest.register_anvil_recipe({
item1 = "minerals:sylvite",
output = "minerals:flux 4"
})
realtest.register_anvil_recipe({
item1 = "metals:gold_sheet",
output = "money:coin 15",
level = metals.levels[i],
instrument = "chisel"
material = metal,
})
end
-- general receipes (for flux production; used for welding)
realtest.register_anvil_recipe({
item1 = "minerals:borax",
output = "minerals:flux 8"
})
realtest.register_anvil_recipe({
item1 = "minerals:sylvite",
output = "minerals:flux 4"
})
-- receipe for coin production
realtest.register_anvil_recipe({
item1 = "metals:gold_sheet",
output = "money:coin 15",
level = metals.levels[i],
instrument = "chisel",
material = "gold",
})
--Pig iron --> Wrought iron
realtest.register_anvil_recipe({
item1 = "metals:pig_iron_ingot",
output = "metals:wrought_iron_ingot",
level = 2,
material = "wrought_iron",
})
--Instruments
local instruments =
local anvil_instruments =
{{"axe", "_ingot"},
{"pick", "_ingot"},
{"shovel", "_ingot"},
@ -116,7 +130,7 @@ local instruments =
{"hammer", "_doubleingot"},
{"saw", "_sheet"}
}
for _, instrument in ipairs(instruments) do
for _, instrument in ipairs(anvil_instruments) do
for i, metal in ipairs(metals.list) do
-- the proper way to do that is to check whether we have metal in instruments.metals list or not
-- but who cares?
@ -128,6 +142,7 @@ for _, instrument in ipairs(instruments) do
rmitem2 = false,
output = output_name,
level = metals.levels[i],
material = metal,
})
end
end
@ -216,6 +231,15 @@ for _, anvil in ipairs(anvils) do
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[8,7]"..
-- some (hopefully) helpful buttons
"button[2.0,1.75;1,0.5;guide;Guide]"..
"button_exit[5,1.75;1,0.5;quit;Exit]"..
"label[2.9,-0.2;Input 1:]"..
"label[4.1,-0.2;Input 2:]"..
"label[1.0,1.1;Instrument:]"..
"label[6.0,1.1;Flux:]"..
"label[3.5,2.35;Output]"..
-- the rest of the formspec
"button[0.5,0.25;1.35,1;buttonForge;Forge]"..
"button[1.6,0.25;0.9,1;buttonForge10;x10]"..
"list[current_name;src1;2.9,0.25;1,1;]"..
@ -236,6 +260,12 @@ for _, anvil in ipairs(anvils) do
inv:set_size("flux", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
if( fields and fields.guide and sender ) then
-- anvils made from diffrent materials have diffrent capabilities
fields.anvil_typ = anvil[1];
realtest.show_craft_guide_anvil( sender, "realtest:craft_guide_anvil", fields);
return;
end
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
@ -310,3 +340,162 @@ for _, anvil in ipairs(anvils) do
end,
})
end
realtest.show_craft_guide_anvil = function( player, formname, fields)
if( formname ~= "realtest:craft_guide_anvil" or not( player ) or fields.quit) then
return;
end
if( not( fields.material )) then
if( fields.old_material ) then
fields.material = fields.old_material;
else
fields.material = metals.list[1];
end
end
-- select the plan that is to be shown
local nr = 1;
for i, v in ipairs(realtest.registered_anvil_recipes ) do
if( v and v.output and fields[ v.output ]) then
nr = i;
end
end
local plan = realtest.registered_anvil_recipes[ nr ];
-- abort if no plan can be found
if( not( plan )) then
return;
end
local stack = ItemStack( plan.output );
local def = stack:get_definition();
local name = "";
if( def ) then
name = def.description;
end
if( not( name )) then
name = plan.output;
end
local how_to = "Forge";
if( plan.type and plan.type=="weld" ) then
how_to = "Weld";
end
local formspec =
"size[12,8]"..
"label[1.5,-0.2;"..how_to.." "..tostring(stack:get_count()).."x "..name.." this way (click on "..how_to.."):]"..
-- extra exit button for those tablet users
"button_exit[5,2.25;1,0.5;quit;Exit]"..
-- labels that describe the general usage of a slot
"label[2.9,0.3;Input 1:]"..
"label[4.1,0.3;Input 2:]"..
"label[1.0,1.6;Instrument:]"..
"label[6.0,1.6;Flux:]"..
"label[3.5,2.85;Output]"..
"label[8,-0.4;Select metal type to work with:]"..
-- buttons that do nothing; they exist just so that the interface looks similar
"button[0.5,0.75;1.35,1;nothing;Forge]"..
"button[1.6,0.75;0.9,1;nothing;x10]"..
"button[5.5,0.75;1.35,1;buttonWeld;Weld]"..
"button[6.6,0.75;0.9,1;buttonWeld10;x10]"..
"image[3.69,0.72;0.54,1.5;anvil_arrow.png]"..
-- background for the inventory slots
"box[2.9,0.75;0.8,0.9;#BBBBBB]"..
"box[4.1,0.75;0.8,0.9;#BBBBBB]"..
"box[3.5,1.99;0.8,0.9;#BBBBBB]"..
"item_image[3.5,2.0;1,1;"..plan.output.."]"..
-- the 4 simulated slots for the instruments
"box[1.0,1.99;0.8,0.9;#BBBBBB]"..
"box[6.0,1.99;0.8,0.9;#BBBBBB]"..
-- hide the material (=selected metal) somewhere
"field[-10,-10;0.1,0.1;old_material;"..fields.material..";"..fields.material.."]"..
-- some receipes output more of the same item than just one
"label[3.0,2.5;"..tostring(stack:get_count()).."x]"..
"label[0,3.5;Select receipe to show:]";
-- show the indigrents
if( plan.item1 and plan.item1 ~= "" and minetest.registered_items[ plan.item1 ]) then
local button = "item_image[2.9,0.75;1,1;"..plan.item1.."]";
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v.output == plan.item1 ) then
button = "item_image_button[2.9,0.75;1,1;"..v.output..";"..v.output..";]";
end
end
formspec = formspec..button;
end
-- the second slot usually takes a plan
if( plan.item2 and plan.item2 ~= "" and minetest.registered_items[ plan.item2 ]) then
local button = "item_image[4.1,0.75;1,1;"..plan.item2.."]";
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v.output == plan.item2 ) then
button = "item_image_button[4.1,0.75;1,1;"..v.output..";"..v.output..";]";
end
end
formspec = formspec..button;
end
-- show the instrument needed
if( plan.instrument and plan.instrument ~= "" and minetest.registered_items[ "instruments:"..plan.instrument.."_copper" ]) then
-- find a suitable instrument that can be used to work on this
local found = -1;
for i,v in ipairs( instruments.levels ) do
if( found<1 and plan.level <= v ) then
found = i;
end
end
local instrument_material = "copper"; -- fallback
if( found ) then
instrument_material = instruments.materials[ found ];
end
-- the instrument may need to be made out of a diffrent material
formspec = formspec.."item_image_button[1.0,2.0;1,1;instruments:"..plan.instrument.."_"..instrument_material..";material;"..instrument_material.."]";
-- show error message for unkown tools
elseif( plan.instrument and plan.instrument ~= "" ) then
formspec = formspec.."label[0.5,2.5;ERROR]";
end
-- welding requires flux
if( plan.type and plan.type=="weld") then
formspec = formspec.."item_image[6.0,2.0;1,1;minerals:flux]";
end
-- show a list of all receipes to select from
local i = 1;
for _, v in ipairs(realtest.registered_anvil_recipes) do
if( v and not( v.material ) or v.material == fields.material) then
formspec = formspec..
"item_image_button["..tostring((i-1)%8)..","..
tostring(4+math.floor((i-1)/8))..";1,1;"..
v.output..";"..v.output..";]";
-- minetest.formspec_escape(v.output).."]";
i = i+1;
end
end
-- show the metals to select from
for i, v in ipairs( metals.list ) do
formspec = formspec..
"image_button["..tostring(8+(i-1)%4)..","..
tostring(math.floor((i-1)/4))..";1,1;"..
"metals_"..v.."_block.png;material;"..
v.."]";
end
-- show the anvils that can do this task
formspec = formspec.."label[0,6.9;The following anvils are strong enough for this task ";
if( plan.type=="weld") then
formspec = formspec.."(welding can be done on all anvils):]";
else
formspec = formspec.." (at least strength "..tostring(plan.level).."):]";
end
for i,anvil in ipairs( anvils ) do
if( anvil[3] >= plan.level or plan.type=="weld") then
formspec = formspec.."item_image_button["..tostring(i-1)..",7.3;1,1;anvil:anvil_"..anvil[1]..";material;"..anvil[1].."]";
end
end
minetest.show_formspec( player:get_player_name(), "realtest:craft_guide_anvil", formspec );
end
-- make sure we receive player input; needed for showing formspecs directly
minetest.register_on_player_receive_fields( realtest.show_craft_guide_anvil );

View File

@ -50,12 +50,19 @@ for _, tree in pairs(realtest.registered_trees) do
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,8]"..
-- add a link to the joiner table's craft guide
"button[2.8,2.25;1,0.5;guide;Guide]"..
"button_exit[6.3,2.25;1,0.5;quit;Exit]"..
"button[0.5,0.25;1.35,1;buttonCraft;Craft]"..
"button[1.6,0.25;0.9,1;buttonCraft10;x10]"..
"label[3.9,0.3;Input 1:]"..
"list[current_name;src1;3.9,0.75;1,1;]"..
"image[4.69,0.72;0.54,1.5;anvil_arrow.png]"..
"label[5.1,0.3;Input 2:]"..
"list[current_name;src2;5.1,0.75;1,1;]"..
"label[0.5,1.1;Instruments:]"..
"list[current_name;instruments;0.5,1.5;2,2;]"..
"label[4.5,2.85;Output]"..
"list[current_name;output;4.5,2;1,1;]"..
"list[current_player;main;0,4;8,4;]")
meta:set_string("infotext", "Joiner Table")
@ -66,6 +73,11 @@ for _, tree in pairs(realtest.registered_trees) do
inv:set_size("output", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
if( fields and fields.guide and sender ) then
realtest.show_craft_guide_joiner_table( sender, "realtest:craft_guide_joiner_table", fields);
return;
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -126,3 +138,91 @@ for _, tree in pairs(realtest.registered_trees) do
}
})
end
realtest.show_craft_guide_joiner_table = function( player, formname, fields)
if( formname ~= "realtest:craft_guide_joiner_table" or not( player ) or fields.quit) then
return;
end
-- select the plan that is to be shown
local nr = 1;
for i, v in ipairs(realtest.registered_joiner_table_recipes ) do
if( v and v.output and fields[ v.output ]) then
nr = i;
end
end
local plan = realtest.registered_joiner_table_recipes[ nr ];
-- abort if no plan can be found
if( not( plan )) then
return;
end
local stack = ItemStack( plan.output );
local def = stack:get_definition();
local name = "";
if( def ) then
name = def.description;
end
if( not( name )) then
name = plan.output;
end
local formspec =
"size[8,9]"..
"label[0,0;Create "..tostring(stack:get_count()).."x "..name.." this way:]"..
-- extra exit button for those tablet users
"button_exit[6.3,2.25;1,0.5;quit;Exit]"..
-- labels that describe the general usage of a slot
"label[3.9,0.3;Input 1:]"..
"label[5.1,0.3;Input 2:]"..
"label[0.5,1.1;Instruments:]"..
"label[4.5,2.85;Output]"..
-- the buttons serve only decorative purposes here
"button[0.5,0.25;1.35,1;nothing;Craft]"..
"button[1.6,0.25;0.9,1;nothing;x10]"..
"image[4.69,0.72;0.54,1.5;anvil_arrow.png]"..
-- background for the inventory slots
"box[3.9,0.75;0.8,0.9;#BBBBBB]"..
"box[5.1,0.75;0.8,0.9;#BBBBBB]"..
"box[4.5,1.98;0.8,0.9;#BBBBBB]"..
"item_image[4.5,2;1,1;"..plan.output.."]"..
-- the 4 simulated slots for the instruments
"box[0.5,1.5;0.8,0.9;#BBBBBB]"..
"box[0.5,2.5;0.8,0.9;#BBBBBB]"..
"box[1.5,1.5;0.8,0.9;#BBBBBB]"..
"box[1.5,2.5;0.8,0.9;#BBBBBB]"..
-- some receipes output more of the same item than just one
"label[4.0,2.5;"..tostring(stack:get_count()).."x]"..
"label[0,3.5;Select receipe to show:]";
-- show the indigrents
if( plan.item1 and plan.item1 ~= "" and minetest.registered_items[ plan.item1 ]) then
formspec = formspec.."item_image[3.9,0.75;1,1;"..plan.item1.."]";
end
-- the second slot usually takes a plan
if( plan.item2 and plan.item2 ~= "" and minetest.registered_items[ plan.item2 ]) then
formspec = formspec.."item_image[5.1,0.75;1,1;"..plan.item2.."]";
end
-- show the instrument needed
if( plan.instrument and plan.instrument ~= "" and minetest.registered_items[ "instruments:"..plan.instrument.."_copper" ]) then
formspec = formspec.."item_image[1.5,1.5;1,1;instruments:"..plan.instrument.."_copper]";
-- show error message for unkown tools
elseif( plan.instrument and plan.instrument ~= "" ) then
formspec = formspec.."label[0.5,2.5;ERROR]";
end
-- show a list of all receipes to select from
for i, v in ipairs(realtest.registered_joiner_table_recipes) do
formspec = formspec..
"item_image_button["..tostring((i-1)%8)..","..
tostring(4+math.floor((i-1)/8))..";1,1;"..
v.output..";"..v.output..";"..
minetest.formspec_escape(v.output).."]";
end
minetest.show_formspec( player:get_player_name(), "realtest:craft_guide_joiner_table", formspec );
end
-- make sure we receive player input; needed for showing formspecs directly
minetest.register_on_player_receive_fields( realtest.show_craft_guide_joiner_table );

View File

@ -20,6 +20,7 @@ end
realtest.register_instrument_plan("scribing_table:plan_axe", {
description = "Axe Plan",
inventory_image = "scribing_table_plan.png^(instruments_axe_copper.png^[transformR90)",
bitmap = {0,1,0,0,0,
1,1,1,1,0,
1,1,1,1,1,
@ -29,6 +30,7 @@ realtest.register_instrument_plan("scribing_table:plan_axe", {
realtest.register_instrument_plan("scribing_table:plan_hammer", {
description = "Hammer Plan",
inventory_image = "scribing_table_plan.png^(instruments_hammer_copper.png^[transformR90)",
bitmap = {1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
@ -38,6 +40,7 @@ realtest.register_instrument_plan("scribing_table:plan_hammer", {
realtest.register_instrument_plan("scribing_table:plan_pick", {
description = "Pick Plan",
inventory_image = "scribing_table_plan.png^instruments_pick_copper.png",
bitmap = {0,1,1,1,0,
1,0,0,0,1,
0,0,0,0,0,
@ -47,6 +50,7 @@ realtest.register_instrument_plan("scribing_table:plan_pick", {
realtest.register_instrument_plan("scribing_table:plan_shovel", {
description = "Shovel Plan",
inventory_image = "scribing_table_plan.png^(instruments_shovel_copper.png^[transformR90)",
bitmap = {0,1,1,1,0,
0,1,1,1,0,
0,1,1,1,0,
@ -56,6 +60,7 @@ realtest.register_instrument_plan("scribing_table:plan_shovel", {
realtest.register_instrument_plan("scribing_table:plan_spear", {
description = "Spear Plan",
inventory_image = "scribing_table_plan.png^instruments_spear_copper.png",
bitmap = {1,1,0,0,0,
1,1,1,0,0,
0,1,0,0,0,
@ -65,6 +70,7 @@ realtest.register_instrument_plan("scribing_table:plan_spear", {
realtest.register_instrument_plan("scribing_table:plan_sword", {
description = "Sword Plan",
inventory_image = "scribing_table_plan.png^(instruments_sword_copper.png^[transformR90)",
bitmap = {0,0,0,1,1,
0,0,1,1,1,
0,1,1,1,0,
@ -74,6 +80,7 @@ realtest.register_instrument_plan("scribing_table:plan_sword", {
realtest.register_instrument_plan("scribing_table:plan_bucket", {
description = "Bucket Plan",
inventory_image = "instruments_bucket_copper.png^scribing_table_plan.png",
bitmap = {1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
@ -83,6 +90,7 @@ realtest.register_instrument_plan("scribing_table:plan_bucket", {
realtest.register_instrument_plan("scribing_table:plan_chisel", {
description = "Chisel Plan",
inventory_image = "scribing_table_plan.png^instruments_chisel_copper.png",
bitmap = {0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
@ -92,6 +100,7 @@ realtest.register_instrument_plan("scribing_table:plan_chisel", {
realtest.register_instrument_plan("scribing_table:plan_lock", {
description = "Lock Plan",
inventory_image = "scribing_table_plan.png^metals_copper_lock.png",
bitmap = {0,1,1,1,0,
0,1,0,1,0,
0,1,1,1,0,
@ -101,6 +110,7 @@ realtest.register_instrument_plan("scribing_table:plan_lock", {
realtest.register_instrument_plan("scribing_table:plan_saw", {
description = "Saw Plan",
inventory_image = "scribing_table_plan.png^instruments_saw_copper.png",
bitmap = {1,1,0,0,0,
1,1,1,0,0,
0,1,1,1,0,
@ -110,6 +120,7 @@ realtest.register_instrument_plan("scribing_table:plan_saw", {
realtest.register_instrument_plan("scribing_table:stonebricks", {
description = "Stonebricks Plan",
inventory_image = "default_stone_bricks.png^scribing_table_plan.png",
bitmap = {1,1,1,1,1,
1,0,0,0,1,
1,1,1,1,1,
@ -119,6 +130,7 @@ realtest.register_instrument_plan("scribing_table:stonebricks", {
realtest.register_instrument_plan("scribing_table:plan_hatch", {
description = "Hatch Plan",
inventory_image = "hatches_copper_hatch.png^scribing_table_plan.png",
bitmap = {1,1,1,1,1,
1,0,1,0,1,
1,1,1,1,1,
@ -183,8 +195,13 @@ for i, tree_name in ipairs(realtest.registered_trees_list) do
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,10]"..
"button_exit[7.2,3.0;1,0.5;quit;Exit]"..
"button[5.5,4.8;1,0.5;guide;Guide]"..
"label[6.5,0.1;Paper:]"..
"list[current_name;paper;6.5,0.5;1,1;]"..
"label[0.5,0.1;Dyes for the scripture (color does not matter):]"..
"list[current_name;dye;0.5,0.5;5,5;]"..
"label[6.5,5.3;Output]"..
"list[current_name;res;6.5,4.5;1,1;]"..
"image[5.5,1.5;2,3.4;scribing_table_arrow.png]"..
"list[current_player;main;0,6;8,4;]"
@ -212,6 +229,11 @@ for i, tree_name in ipairs(realtest.registered_trees_list) do
end
return false
end,
on_receive_fields = function(pos, formname, fields, sender)
if( fields and fields.guide and sender ) then
realtest.show_craft_guide_scribing_table( sender, "realtest:craft_guide_scribing_table", fields);
end
end,
})
minetest.register_craft({
output = "scribing_table:scribing_table_"..tree.name:remove_modname_prefix(),
@ -222,3 +244,66 @@ for i, tree_name in ipairs(realtest.registered_trees_list) do
}
})
end
realtest.show_craft_guide_scribing_table = function( player, formname, fields)
if( formname ~= "realtest:craft_guide_scribing_table" or not( player ) or fields.quit) then
return;
end
-- select the plan that is to be shown
local nr = 1;
for i, v in ipairs(realtest.registered_instrument_plans) do
if( v and v.name and fields[ v.name ]) then
nr = i;
end
end
local plan = realtest.registered_instrument_plans[ nr ];
-- abort if no plan can be found
if( not( plan )) then
return;
end
local formspec =
"size[8,8]"..
"label[0,0;Create a "..tostring(plan.description).." by placing any dye this way:]"..
-- extra exit button for those tablet users
"button_exit[7.2,3.0;1,0.5;quit;Exit]"..
-- some labels as found on the main formspec
"label[6.5,0.1;Paper:]"..
"label[6.5,5.3;Output]"..
-- background for the paper and plan slots
"box[6.5,0.5;0.8,0.9;#BBBBBB]"..
"box[6.5,4.5;0.8,0.9;#BBBBBB]"..
"item_image[6.5,0.5;1,1;"..plan.paper.."]"..
"item_image[6.5,4.5;1,1;"..plan.name.."]"..
"image[5.5,1.5;2,3.4;scribing_table_arrow.png]"..
"label[0,5.5;Select plan to show:]";
-- show the actual receipe
for x=1,5 do
for y=1,5 do
-- imitate an inventory slot
formspec = formspec.."box["..(-0.5+x)..","..(-0.5+y)..";0.8,0.9;#BBBBBB]";
-- show symbolic green dye where needed (green is cheapest)
if( plan.bitmap[ x+5*(y-1)]==1 ) then
formspec = formspec..
"item_image["..(-0.5+x)..","..(-0.5+y)..";1,1;dye:green]";
end
end
end
-- show a list of all receipes to select from
for i, v in ipairs(realtest.registered_instrument_plans) do
formspec = formspec..
"item_image_button["..tostring((i-1)%8)..","..
tostring(6+math.floor((i-1)/8))..";1,1;"..
v.name..";"..v.name..";"..
minetest.formspec_escape(v.description).."]";
end
minetest.show_formspec( player:get_player_name(), "realtest:craft_guide_scribing_table", formspec );
end
-- make sure we receive player input; needed for showing formspecs directly
minetest.register_on_player_receive_fields( realtest.show_craft_guide_scribing_table );