Version MFF.
2
inbox/depends.txt
Normal file → Executable file
@ -1,3 +1 @@
|
||||
default
|
||||
homedecor_i18n
|
||||
screwdriver?
|
||||
|
32
inbox/init.lua
Normal file → Executable file
@ -1,8 +1,5 @@
|
||||
|
||||
local S = homedecor_i18n.gettext
|
||||
|
||||
local inbox = {}
|
||||
local screwdriver = rawget(_G, "screwdriver") or {}
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
minetest.register_craft({
|
||||
output ="inbox:empty",
|
||||
@ -22,7 +19,7 @@ minetest.register_node("inbox:empty", {
|
||||
paramtype = "light",
|
||||
drawtype = "mesh",
|
||||
mesh = "inbox_mailbox.obj",
|
||||
description = S("Mailbox"),
|
||||
description = "Mailbox",
|
||||
tiles = {
|
||||
"inbox_red_metal.png",
|
||||
"inbox_white_metal.png",
|
||||
@ -39,7 +36,7 @@ minetest.register_node("inbox:empty", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = placer:get_player_name()
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("infotext", S("@1's Mailbox", owner))
|
||||
meta:set_string("infotext", owner.."'s Mailbox")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_size("drop", 1)
|
||||
@ -48,27 +45,24 @@ minetest.register_node("inbox:empty", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
if owner == player or
|
||||
minetest.check_player_privs(player, "protection_bypass") and
|
||||
clicker:get_player_control().aux1 then
|
||||
local meta = minetest.get_meta(pos)
|
||||
if owner == player then
|
||||
minetest.show_formspec(
|
||||
player,
|
||||
"inbox:mailbox",
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_formspec(pos))
|
||||
else
|
||||
minetest.show_formspec(
|
||||
player,
|
||||
"inbox:mailbox",
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_insert_formspec(pos))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local name = player and player:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
local inv = meta:get_inventory()
|
||||
return name == owner and inv:is_empty("main")
|
||||
return player:get_player_name() == owner and inv:is_empty("main")
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -99,8 +93,7 @@ function inbox.get_inbox_formspec(pos)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[]"
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
@ -109,7 +102,6 @@ function inbox.get_inbox_insert_formspec(pos)
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"list[nodemeta:".. spos .. ";drop;3.5,2;1,1;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[]"
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
|
0
inbox/models/inbox_mailbox.obj
Normal file → Executable file
0
inbox/textures/inbox_grey_metal.png
Normal file → Executable file
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
0
inbox/textures/inbox_red_metal.png
Normal file → Executable file
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 319 B |
0
inbox/textures/inbox_white_metal.png
Normal file → Executable file
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 156 B |
BIN
inbox/textures/mailbox_inv.png
Normal file → Executable file
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |