Compare commits
5 Commits
cf1dc3895a
...
046eccf148
Author | SHA1 | Date |
---|---|---|
fat115 | 046eccf148 | |
Tai @ Flex | 9b8c3f76f3 | |
Tai @ Flex | 13dd3b9e79 | |
Tai @ Flex | 1ae5ef7bfc | |
Tai @ Flex | 52eb8f857f |
|
@ -1 +1,2 @@
|
|||
default
|
||||
intllib?
|
||||
|
|
74
init.lua
74
init.lua
|
@ -3,6 +3,11 @@
|
|||
GPL3 ]]
|
||||
|
||||
local mailbox = {}
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
|
||||
|
@ -16,17 +21,16 @@ function mailbox.get_formspec(pos, owner, fs_type)
|
|||
|
||||
if fs_type == 1 then
|
||||
return "size[8,9.5]" .. xbg .. default.get_hotbar_bg(0, 5.5) ..
|
||||
"checkbox[0,0;books_only;Only allow written books;" .. selected .. "]" ..
|
||||
"checkbox[0,0;books_only;"..S("Only allow written books")..";" .. selected .. "]" ..
|
||||
"list[nodemeta:" .. spos .. ";mailbox;0,1;8,4;]" ..
|
||||
"list[current_player;main;0,5.5;8,1;]" ..
|
||||
"list[current_player;main;0,6.75;8,3;8]" ..
|
||||
"listring[nodemeta:" .. spos .. ";mailbox]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"button_exit[5,0;1,1;unrent;Unrent]"..
|
||||
"listring[current_player;main]" ..
|
||||
"button_exit[7,0;1,1;exit;X]"
|
||||
else
|
||||
return "size[8,5.5]" .. xbg .. default.get_hotbar_bg(0, 1.5) ..
|
||||
"label[0,0;Send your goods\nto " .. owner .. " :]" ..
|
||||
"label[0,0;"..S("Send your goods\nto: @1", owner).."]" ..
|
||||
"list[nodemeta:" .. spos .. ";drop;3.5,0;1,1;]" ..
|
||||
"list[current_player;main;0,1.5;8,1;]" ..
|
||||
"list[current_player;main;0,2.75;8,3;8]" ..
|
||||
|
@ -39,20 +43,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if not formname:match("mailbox:mailbox_") then
|
||||
return
|
||||
end
|
||||
if fields.unrent then
|
||||
local pos = minetest.string_to_pos(formname:sub(17))
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("mailbox") then
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = "mailbox:mailbox_free"
|
||||
minetest.swap_node(pos, node) -- preserve Facedir
|
||||
-- minetest.swap_node(pos, {name = "mailbox:mailbox" })
|
||||
mailbox.after_place_free(pos, player)
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), "Your mailbox is not empty!")
|
||||
end
|
||||
end
|
||||
|
||||
if fields.books_only then
|
||||
local pos = minetest.string_to_pos(formname:sub(17))
|
||||
local node = minetest.get_node(pos)
|
||||
|
@ -72,30 +63,13 @@ mailbox.after_place_node = function(pos, placer, _)
|
|||
local player_name = placer:get_player_name()
|
||||
|
||||
meta:set_string("owner", player_name)
|
||||
meta:set_string("infotext", player_name.."'s Mailbox")
|
||||
meta:set_string("infotext", S("@1's Mailbox", player_name))
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("mailbox", 8*4)
|
||||
inv:set_size("drop", 1)
|
||||
end
|
||||
|
||||
mailbox.on_rightclick_free = function(pos, _, clicker, _)
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = "mailbox:mailbox"
|
||||
minetest.swap_node(pos, node) -- preserve Facedir
|
||||
-- minetest.swap_node(pos, {name = "mailbox:mailbox" })
|
||||
mailbox.after_place_node(pos, clicker)
|
||||
end
|
||||
|
||||
mailbox.after_place_free = function(pos, placer, _)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player_name = placer:get_player_name()
|
||||
|
||||
-- meta:set_string("owner", player_name)
|
||||
meta:set_string("infotext", "Free Mailbox, right-click to claim")
|
||||
end
|
||||
|
||||
|
||||
mailbox.on_rightclick = function(pos, _, clicker, _)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
|
@ -140,7 +114,7 @@ mailbox.allow_metadata_inventory_put = function(pos, listname, index, stack, pla
|
|||
if inv:room_for_item("mailbox", stack) then
|
||||
return -1
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), "Mailbox full.")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Mailbox full."))
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
@ -149,7 +123,7 @@ end
|
|||
|
||||
|
||||
minetest.register_node("mailbox:mailbox", {
|
||||
description = "Mailbox",
|
||||
description = S("Mailbox"),
|
||||
tiles = {
|
||||
"mailbox_mailbox_top.png", "mailbox_mailbox_bottom.png",
|
||||
"mailbox_mailbox_side.png", "mailbox_mailbox_side.png",
|
||||
|
@ -166,30 +140,8 @@ minetest.register_node("mailbox:mailbox", {
|
|||
allow_metadata_inventory_put = mailbox.allow_metadata_inventory_put,
|
||||
})
|
||||
|
||||
minetest.register_node("mailbox:mailbox_free", {
|
||||
description = "Mailbox for Rent",
|
||||
tiles = {
|
||||
"mailbox_mailbox_free_top.png", "mailbox_mailbox_free_bottom.png",
|
||||
"mailbox_mailbox_free_side.png", "mailbox_mailbox_free_side.png",
|
||||
"mailbox_mailbox_free.png", "mailbox_mailbox_free.png",
|
||||
},
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 1},
|
||||
on_rotate = screwdriver.rotate_simple,
|
||||
sounds = default.node_sound_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
|
||||
after_place_node = mailbox.after_place_free,
|
||||
on_rightclick = mailbox.on_rightclick_free,
|
||||
can_dig = mailbox.can_dig,
|
||||
-- on_metadata_inventory_put = mailbox.on_metadata_inventory_put,
|
||||
-- allow_metadata_inventory_put = mailbox.allow_metadata_inventory_put,
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("mailbox:letterbox", {
|
||||
description = "Letterbox (you hacker you!)",
|
||||
description = S("Letterbox (you hacker you!)"),
|
||||
tiles = {
|
||||
"mailbox_letterbox_top.png", "mailbox_letterbox_bottom.png",
|
||||
"mailbox_letterbox_side.png", "mailbox_letterbox_side.png",
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
|
@ -0,0 +1,47 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-08-04 11:31+0200\n"
|
||||
"PO-Revision-Date: 2017-08-04 12:28+0200\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.12\n"
|
||||
"Last-Translator: fat115 <fat115@framasoft.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
"Language: fr\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "Only allow written books"
|
||||
msgstr "Accepter uniquement les livres"
|
||||
|
||||
#: init.lua
|
||||
msgid ""
|
||||
"Send your goods\n"
|
||||
"to: @1"
|
||||
msgstr ""
|
||||
"Envoyer vos biens\n"
|
||||
"à @1"
|
||||
|
||||
#: init.lua
|
||||
msgid "@1's Mailbox"
|
||||
msgstr "Boite aux lettres de @1"
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox full."
|
||||
msgstr "Boite aux lettres pleine"
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox"
|
||||
msgstr "Boite aux lettres"
|
||||
|
||||
#: init.lua
|
||||
msgid "Letterbox (you hacker you!)"
|
||||
msgstr "Boite aux lettres (graine de pirate ! )"
|
|
@ -0,0 +1,44 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-08-04 11:30+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "Only allow written books"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid ""
|
||||
"Send your goods\n"
|
||||
"to: @1"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "@1's Mailbox"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox full."
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Mailbox"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Letterbox (you hacker you!)"
|
||||
msgstr ""
|
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in New Issue