mirror of
https://gitlab.com/lunovox/e-urn.git
synced 2025-03-15 07:21:22 +00:00
Exemplo de Formspec em Hypertext.
This commit is contained in:
parent
51aa274e30
commit
c6b6af5c66
4 changed files with 84 additions and 5 deletions
75
formspecs.lua
Normal file
75
formspecs.lua
Normal file
|
@ -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("<global margin=10 valign=0 color=#FF00FF hovercolor=#00FFFF size=12 font=normal halign=center >")
|
||||
.."<global valign=middle halign=left margin=10 background=#FFFFFFCC color=#000000 hovercolor=#00FF00 size=12 font=normal>"
|
||||
.."<tag name=action color=#FF0000 hovercolor=#00FF00 font=normal size=12>"
|
||||
..minetest.formspec_escape(([[
|
||||
|
||||
|
||||
|
||||
<center>
|
||||
<img name=favicon.png float=center width=96 height=96>
|
||||
<style font=mono color=#FF0000 size=24><b>OLÁ %s!</b></style>
|
||||
</center>
|
||||
|
||||
Esse é um <action name=lnkExemplo1><item name=default:sword_wood valign=middle width=14 height=14> Exemplo de Link</action> em formato hyperlink. (Não é funcional!)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<center>
|
||||
-= Fim =-
|
||||
<bigger>=D</bigger>
|
||||
</center>
|
||||
|
||||
]]):format(playername:upper()))
|
||||
.."]" -- Fim de hypertext[]
|
||||
--.."container_end[]"
|
||||
|
||||
|
||||
|
||||
|
||||
--"hypertext[<X>,<Y>;<W>,<H>;<name>;<text>]"
|
||||
minetest.show_formspec(playername, "frmEUrnInit", myFormSpec)
|
||||
end,
|
||||
}
|
1
init.lua
1
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")
|
||||
|
||||
|
|
|
@ -40,9 +40,12 @@ minetest.register_node("eurn:eurn", {
|
|||
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
|
||||
--]]
|
||||
modEUrn.FormSpecs.showHypertext(clickername)
|
||||
end,
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Loading…
Add table
Reference in a new issue