From c6b6af5c66662bfb4ed810b5b0e87a06ab6c79e3 Mon Sep 17 00:00:00 2001 From: Lunovox Date: Wed, 26 Jul 2023 17:23:08 -0300 Subject: [PATCH] Exemplo de Formspec em Hypertext. --- formspecs.lua | 75 ++++++++++++++++++++++++++++ init.lua | 1 + item_eurn.lua | 13 +++-- favicon.png => textures/favicon.png | Bin 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 formspecs.lua rename favicon.png => textures/favicon.png (100%) diff --git a/formspecs.lua b/formspecs.lua new file mode 100644 index 0000000..e566f02 --- /dev/null +++ b/formspecs.lua @@ -0,0 +1,75 @@ +modEUrn.FormSpecs = { + showHypertext = function(playername) + --Fonte: + -- * https://minetest.gitlab.io/minetest/formspec/ + -- * https://minetest.gitlab.io/minetest/formspec/#hypertextxywhnametext + -- * https://github.com/minetest/minetest/blob/master/doc/lua_api.md + local myFormSpec = "" + myFormSpec = myFormSpec + --.."formspec_version[5.6.0]" + .."formspec_version[6]" + .."size[16,8,false]" + .."background[0,-8;16,16;text_eurn_front.png]" + --.."bgcolor[000000;false;FFFFFF]" + --.."bgcolor[#00880044;false;#000000]" + --.."bgcolor[#636D7600;true]" + --.."position[0,0]" + --.."container[0,0]" + --.."image[0,-8;16,16;text_eurn_front.png]" + .."vertlabel[15.75,0.5;"..minetest.formspec_escape(modEUrn.translate("E-URN")).."]" + .."hypertext[0.5,0.5;15,7;myPage;" + --..minetest.formspec_escape("") + .."" + .."" + ..minetest.formspec_escape(([[ + + + +
+ + +
+ +Esse é um Exemplo de Link em formato hyperlink. (Não é funcional!) + + + + + + + + + + + + + + + + + + + + + + + + + + +
+-= Fim =- +=D +
+ + ]]):format(playername:upper())) + .."]" -- Fim de hypertext[] + --.."container_end[]" + + + + + --"hypertext[,;,;;]" + minetest.show_formspec(playername, "frmEUrnInit", myFormSpec) + end, +} diff --git a/init.lua b/init.lua index c65475d..1e3505e 100644 --- a/init.lua +++ b/init.lua @@ -6,6 +6,7 @@ modEUrn = { dofile(modEUrn.modpath.."/translate.lua") -- <== Antes de 'api.lua'! dofile(modEUrn.modpath.."/api.lua") +dofile(modEUrn.modpath.."/formspecs.lua") dofile(modEUrn.modpath.."/commands.lua") dofile(modEUrn.modpath.."/item_eurn.lua") diff --git a/item_eurn.lua b/item_eurn.lua index cc107da..213d1b4 100644 --- a/item_eurn.lua +++ b/item_eurn.lua @@ -37,12 +37,15 @@ minetest.register_node("eurn:eurn", { meta:set_string("owner",ownername) end, on_rightclick = function(pos, node, clicker) - local clickername = clicker:get_player_name() + local clickername = clicker:get_player_name() local meta = minetest.get_meta(pos) - local ownername = meta:get_string("owner") - if ownername == clickername then - minetest.sound_play("sfx_eurn_button", {object=clicker, max_hear_distance=5.0,}) - end + local ownername = meta:get_string("owner") + --[[ + if ownername == clickername then + minetest.sound_play("sfx_eurn_button", {object=clicker, max_hear_distance=5.0,}) + end + --]] + modEUrn.FormSpecs.showHypertext(clickername) end, diff --git a/favicon.png b/textures/favicon.png similarity index 100% rename from favicon.png rename to textures/favicon.png