Compare commits
5 Commits
0623a7dfef
...
9b8c3f76f3
Author | SHA1 | Date |
---|---|---|
Tai @ Flex | 9b8c3f76f3 | |
Tai @ Flex | 13dd3b9e79 | |
Tai @ Flex | 1ae5ef7bfc | |
Tai @ Flex | 52eb8f857f | |
Tai @ Flex | cf1dc3895a |
14
README.md
14
README.md
|
@ -1,3 +1,13 @@
|
|||
# mailbox
|
||||
everamzah:
|
||||
|
||||
Thanks to @SmallJoker AKA Krock for helping me with the minetest.swap_node part of the mod!
|
||||
> # mailbox
|
||||
>
|
||||
> Thanks to @SmallJoker AKA Krock for helping me with the minetest.swap_node part of the mod!
|
||||
|
||||
This repository is the continuation of everamzah's `mailbox` mod for Minetest.
|
||||
|
||||
It provides a modified xdecor mailbox, enhanced to be able to accept books-only as an option (blue box) or the default accept-anything (red box).
|
||||
|
||||
Releases are available [on the releases tab](https://github.com/taikedz/everamzah-mailbox/releases) (GitHub)
|
||||
|
||||
-- taikedz
|
||||
|
|
57
init.lua
57
init.lua
|
@ -21,8 +21,7 @@ function mailbox.get_formspec(pos, owner, fs_type)
|
|||
"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) ..
|
||||
|
@ -39,20 +38,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)
|
||||
|
@ -79,23 +65,6 @@ mailbox.after_place_node = function(pos, placer, _)
|
|||
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()
|
||||
|
@ -166,28 +135,6 @@ 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!)",
|
||||
tiles = {
|
||||
|
|
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