Add sfinv support to email
This commit is contained in:
parent
b7d60d1363
commit
d18c0c88cf
4 changed files with 20 additions and 5 deletions
|
@ -1 +1,2 @@
|
||||||
chatplus?
|
chatplus?
|
||||||
|
sfinv?
|
||||||
|
|
|
@ -72,8 +72,7 @@ end)
|
||||||
function email.get_formspec(name)
|
function email.get_formspec(name)
|
||||||
local inbox = email.get_inbox(name)
|
local inbox = email.get_inbox(name)
|
||||||
|
|
||||||
local fs = "size[12,8]"
|
local fs = "vertlabel[0,0;Your Inbox]"
|
||||||
fs = fs .. "vertlabel[0,0;email Mail]"
|
|
||||||
|
|
||||||
function row(fs, c1, date, from, msg)
|
function row(fs, c1, date, from, msg)
|
||||||
date = minetest.formspec_escape(date)
|
date = minetest.formspec_escape(date)
|
||||||
|
@ -127,7 +126,7 @@ function email.show_inbox(name, text_mode)
|
||||||
return true, "End of mail (" .. #inbox .. " items)"
|
return true, "End of mail (" .. #inbox .. " items)"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local fs = email.get_formspec(name)
|
local fs = "size[12,8]" .. email.get_formspec(name)
|
||||||
minetest.show_formspec(name, "email:inbox", fs)
|
minetest.show_formspec(name, "email:inbox", fs)
|
||||||
|
|
||||||
return true, "Opened inbox!"
|
return true, "Opened inbox!"
|
||||||
|
@ -136,6 +135,21 @@ function email.show_inbox(name, text_mode)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.global_exists("sfinv") then
|
||||||
|
sfinv.register_page("email:inbox", {
|
||||||
|
title = "Inbox",
|
||||||
|
get = function(self, player, context)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
return ([[
|
||||||
|
size[12,8]
|
||||||
|
bgcolor[#080808BB;true]
|
||||||
|
background[5,5;1,1;gui_formbg.png;true]
|
||||||
|
{{ nav }}
|
||||||
|
]]) .. email.get_formspec(name)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player,formname,fields)
|
minetest.register_on_player_receive_fields(function(player,formname,fields)
|
||||||
if fields.clear then
|
if fields.clear then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
|
@ -31,7 +31,7 @@ rules.txt = table.concat(items, ",")
|
||||||
if minetest.global_exists("sfinv") then
|
if minetest.global_exists("sfinv") then
|
||||||
sfinv.register_page("rules:rules", {
|
sfinv.register_page("rules:rules", {
|
||||||
title = "Rules",
|
title = "Rules",
|
||||||
get = function(player, context)
|
get = function(self, player, context)
|
||||||
return ([[
|
return ([[
|
||||||
size[8,8.6]
|
size[8,8.6]
|
||||||
bgcolor[#080808BB;true]
|
bgcolor[#080808BB;true]
|
||||||
|
|
|
@ -5,7 +5,7 @@ sfinv.register_page("sfinv:crafting", {
|
||||||
is_in_nav = function(player, context)
|
is_in_nav = function(player, context)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
get = function(player, context)
|
get = function(self, player, context)
|
||||||
return [[ {{ layout }}
|
return [[ {{ layout }}
|
||||||
list[current_player;craft;1.75,0.5;3,3;]
|
list[current_player;craft;1.75,0.5;3,3;]
|
||||||
list[current_player;craftpreview;5.75,1.5;1,1;]
|
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||||
|
|
Loading…
Reference in a new issue