From 2fd9e59242efba7a8a375c4fb36f1f6f6ecc1500 Mon Sep 17 00:00:00 2001 From: Rogier Date: Sat, 7 Feb 2015 18:10:40 +0100 Subject: [PATCH] Display conversion method symbolically and textually next to arrow --- api.lua | 4 ++++ register.lua | 7 ++++--- textures/ui_craftgrid_icon.png | Bin 0 -> 680 bytes 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 textures/ui_craftgrid_icon.png diff --git a/api.lua b/api.lua index b338cfb..d9e85e3 100644 --- a/api.lua +++ b/api.lua @@ -152,6 +152,7 @@ end unified_inventory.register_craft_type("normal", { description = "Crafting", + icon = "ui_craftgrid_icon.png", width = 3, height = 3, get_shaped_craft_width = function (craft) return craft.width end, @@ -167,6 +168,7 @@ unified_inventory.register_craft_type("normal", { unified_inventory.register_craft_type("shapeless", { description = "Mixing", + icon = "ui_craftgrid_icon.png", width = 3, height = 3, dynamic_display_size = function (craft) @@ -181,6 +183,7 @@ unified_inventory.register_craft_type("shapeless", { unified_inventory.register_craft_type("cooking", { description = "Cooking", + icon = "default_furnace_front.png", width = 1, height = 1, }) @@ -188,6 +191,7 @@ unified_inventory.register_craft_type("cooking", { unified_inventory.register_craft_type("digging", { description = "Digging", + icon = "default_tool_steelpick.png", width = 1, height = 1, }) diff --git a/register.lua b/register.lua index 3f0d27c..67a4c02 100644 --- a/register.lua +++ b/register.lua @@ -224,9 +224,10 @@ unified_inventory.register_page("craftguide", { local craft_type = unified_inventory.registered_craft_types[craft.type] or unified_inventory.craft_type_defaults(craft.type, {}) - formspec = formspec.."label[6,3.35;" .. S("Method:") .. "]" - formspec = formspec.."label[6,3.75;" - ..minetest.formspec_escape(craft_type.description).."]" + if craft_type.icon then + formspec = formspec..string.format(" image[%f,%f;%f,%f;%s]",5.2,0.85,0.5,0.5,craft_type.icon) + end + formspec = formspec.."label[5,1.50;" .. minetest.formspec_escape(craft_type.description).."]" formspec = formspec..stack_image_button(6, 1, 1.1, 1.1, "item_button_usage_", ItemStack(craft.output)) local display_size = craft_type.dynamic_display_size and craft_type.dynamic_display_size(craft) or { width = craft_type.width, height = craft_type.height } local craft_width = craft_type.get_shaped_craft_width and craft_type.get_shaped_craft_width(craft) or display_size.width diff --git a/textures/ui_craftgrid_icon.png b/textures/ui_craftgrid_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5b8025af6c753eaa1617d7dfb688d36abf4a0b2f GIT binary patch literal 680 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H0wgodS2_SGmUKs7M+U~W1%@xC#RK_FN#5=* z4FB8v&+G^CI14-?iy0WWg+Z8+Vb&Z8pb8sL7srr_TW@FW)niGNXpL`{nA}n1YB+a+ zXt;v3{oQ*FE(;gCZQ9CWI`~u zT=uh15@^jAt=e^m(+=N$b>_x{^U1&FH*dc7>)YbrnVTCh4-GBH$6i5)03y2p7;D{{HJZ3j?Lc6 zmj7LQy14y|Gb#TYZdUKjs^nzMtgGd7TRrW0s^?FC1&3G%UZyLoSBPP#u<+RYRXf+e zYT9%GgPM7^_cq@uz4}RrDeATJ#q*CQ`9y69-nyry;qCE)OqIjxHnX>_++p=W4K4oNJaL7O8cR}#H zpMm!tNo&WlrZ+4%Im7r_R&cLyY}nNxMGOPz*5*y`f8F5RB%Gpt!cPF`zoLiS>;H#N U;0<202FPRZboFyt=akR{0B6`H9smFU literal 0 HcmV?d00001