1 Commits
v1.2 ... master

Author SHA1 Message Date
f1f4dffcb1 Version MFF. 2018-09-08 13:13:11 +02:00
29 changed files with 64 additions and 257 deletions

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
## Generic ignorable patterns and files
*~
.*.swp
debug.txt

0
LICENSE Normal file → Executable file
View File

5
README.md Normal file → Executable file
View File

@ -5,8 +5,6 @@ More Chests
This mod is a fork of 0gb.us's chests_0gb_us https://forum.minetest.net/viewtopic.php?f=11&t=4366
Megaf's more_chests fixes several bugs, uses new textures and adds compatibility with [VanessaE's Pipeworks] (https://github.com/VanessaE/pipeworks) mod.
The following text was writen by 0gb.us
```
Cobble Chest:
@ -44,4 +42,5 @@ Wifi Chest
{'default:wood','default:wood','default:wood'}
A wacky chest that doesn't store it's items in the usual way, but instead, stores them remotely. For that reason, all wifi chests appear to have the same inventory. Due to not actually having an inventory, wifi chests can also be mined, even when they appear to have stuff in them. Lastly, as everyone gets their own wifi account, the items you see in the wifi chest are not the same items anyone else sees. This chest's properties make it nice for keeping secrets, as well as essentially almost doubling your inventory space, if you choose to carry one with you.
```
'''

0
aliases.lua Normal file → Executable file
View File

38
cobble.lua Normal file → Executable file
View File

@ -1,6 +1,3 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
@ -9,46 +6,28 @@ local function has_locked_chest_privilege(meta, player)
end
minetest.register_node("more_chests:cobble", {
description = S("Cobble Chest"),
description = "Cobble Chest",
tiles = {"default_cobble.png", "default_cobble.png", "default_cobble.png",
"default_cobble.png", "default_cobble.png", "cobblechest_front.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice = 1, tubedevice_receiver = 1},
-- First attempt to add a way to connect to pipeworks.
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("main", stack)
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("main", stack)
end,
input_inventory = "main",
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
--[[ meta:set_string("infotext", "Locked Chest (owned by "..
meta:get_string("owner")..")")]]
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_name;main]"..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
"listring[current_player;main]")
-- meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
@ -113,3 +92,4 @@ minetest.register_craft({
{'default:wood','default:cobble','default:wood'}
}
})

1
depends.txt Executable file
View File

@ -0,0 +1 @@
default

69
dropbox.lua Normal file → Executable file
View File

@ -1,7 +1,3 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
local DS = minetest.get_translator("default")
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
@ -10,49 +6,28 @@ local function has_locked_chest_privilege(meta, player)
end
minetest.register_node("more_chests:dropbox", {
description = S("Dropbox"),
tiles = {"dropbox_top.png", "dropbox_top.png", "dropbox_side.png",
"dropbox_side.png", "dropbox_side.png", "dropbox_front.png"},
description = "Dropbox",
tiles = {"default_chest_top.png", "default_chest_top.png", "dropbox_right.png",
"default_chest_side.png", "default_chest_side.png", "dropbox_front.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice = 1, tubedevice_receiver = 1},
-- Pipeworks
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("main", stack)
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("main", stack)
end,
input_inventory = "main",
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", S("@1 (owned by @2)",
S("Dropbox"),
meta:get_string("owner")))
meta:set_string("infotext", "Dropbox (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
meta:set_string("infotext", DS("Chest"))
"listring[current_player;main]")
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
@ -61,7 +36,7 @@ minetest.register_node("more_chests:dropbox", {
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
@ -72,32 +47,15 @@ minetest.register_node("more_chests:dropbox", {
end
return stack:get_count()
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, player) then
return stack:get_count()
end
local target = meta:get_inventory():get_list(listname)[index]
local target_name = target:get_name()
local stack_count = stack:get_count()
if target_name == stack:get_name()
and target:get_count() < stack_count then
return stack_count
end
if target_name ~= "" then
return 0
end
return stack_count
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in dropbox at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to dropbox at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from dropbox at "..minetest.pos_to_string(pos))
end,
@ -111,3 +69,4 @@ minetest.register_craft({
{'default:wood','default:wood','default:wood'}
}
})

0
init.lua Normal file → Executable file
View File

View File

@ -1,11 +0,0 @@
# textdomain: more_chests
Cobble Chest=Coffre en pierre taillée
Dropbox=Boîte de dépôt
Secret Chest=Coffre secret
Shared Chest=Coffre partagé
Wifi Chest=Coffre wifi
@1 (owned by @2)=@1 (appartient à @2)
Shared with (separate names with spaces)=Partagé avec (séparez les noms avec des espaces)
submit=valider

View File

@ -1,12 +0,0 @@
# textdomain: more_chests
# Translation by An0n3m0us
Secret Chest=Titkos Láda
Wifi Chest=Wifi Láda
Cobble Chest=Zúzottkő Láda
Shared Chest=Közös Láda
@1 (owned by @2)=@1 (@2 tulajdonában van)
Shared with (separate names with spaces)=Megosztva (válassza el a neveket szóközökkel)
submit=előterjeszt

View File

@ -1,6 +0,0 @@
# textdomain: more_chests
Secret Chest=
Wifi Chest=
Cobble Chest=
Shared Chest=
Dropbox=

View File

@ -1,4 +0,0 @@
name = more_chests
description = Adds several chests that behave differently, and can be used to donate items, share items, hide chests, make secret chests, and more.
depends = default
optional_depends = pipeworks

47
secret.lua Normal file → Executable file
View File

@ -1,6 +1,3 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
@ -9,53 +6,32 @@ local function has_locked_chest_privilege(meta, player)
end
local open = "size[8,10]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
"button[3,9;2,1;open;close]" ..
default.get_hotbar_bg(0,4.85)
"listring[current_player;main]"..
"button[3,9;2,1;open;close]"
local closed = "size[2,1]"..
"button[0,0;2,1;open;open]"
minetest.register_node("more_chests:secret", {
description = S("Secret Chest"),
tiles = {"secret_top.png", "secret_top.png", "secret_side.png",
"secret_side.png", "secret_side.png", "secret_front.png"},
description = "Secret Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "secret_front.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice = 1, tubedevice_receiver = 1},
-- Pipeworks
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("main", stack)
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("main", stack)
end,
input_inventory = "main",
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", S("@1 (owned by @2)",
S("Secret Chest"),
meta:get_string("owner")))
meta:set_string("infotext", "Secret Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", open)
meta:set_string("infotext", S("Secret Chest"))
meta:set_string("infotext", "Secret Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
@ -130,3 +106,4 @@ minetest.register_craft({
{'default:wood','default:wood','default:wood'}
}
})

57
shared.lua Normal file → Executable file
View File

@ -1,6 +1,3 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
local function has_locked_chest_privilege(meta, player)
local name = player:get_player_name()
local shared = " "..meta:get_string("shared").." "
@ -16,53 +13,32 @@ end
local function get_formspec(string)
return "size[8,10]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6;8,3;8]" ..
"field[.25,9.5;8,1;shared;"..S("Shared with (separate names with spaces)")..":;"..string.."]"..
"button[6,9.2;2,1;submit;"..S("submit").."]" ..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
"listring[current_player;main]"..
"field[.25,9.5;6,1;shared;Shared with (separate names with spaces):;"..string.."]"..
"button[6,9;2,1;submit;submit]"
end
minetest.register_node("more_chests:shared", {
description = S("Shared Chest"),
tiles = {"shared_top.png", "shared_top.png", "shared_side.png",
"shared_side.png", "shared_side.png", "shared_front.png"},
description = "Shared Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "shared_front.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice = 1, tubedevice_receiver = 1},
-- Pipeworks
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("main", stack)
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("main", stack)
end,
input_inventory = "main",
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", S("@1 (owned by @2)",
S("Shared Chest"),
meta:get_string("owner")))
meta:set_string("infotext", "Shared Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", get_formspec(""))
meta:set_string("infotext", S("Shared Chest"))
meta:set_string("infotext", "Shared Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
@ -119,7 +95,7 @@ minetest.register_node("more_chests:shared", {
end,
on_receive_fields = function(pos, formspec, fields, sender)
local meta = minetest.get_meta(pos);
if fields.shared then
if fields.shared then
if meta:get_string("owner") == sender:get_player_name() then
meta:set_string("shared", fields.shared);
meta:set_string("formspec", get_formspec(fields.shared))
@ -131,8 +107,9 @@ minetest.register_node("more_chests:shared", {
minetest.register_craft({
output = 'more_chests:shared',
recipe = {
{'default:wood','default:leaves','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
{'group:wood','group:leaves','group:wood'},
{'group:wood','group:ingot','group:wood'},
{'group:wood','group:wood','group:wood'}
}
})

BIN
textures/cobblechest_front.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 385 B

BIN
textures/dropbox_front.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 648 B

BIN
textures/dropbox_right.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

BIN
textures/secret_front.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 B

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

BIN
textures/shared_front.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 481 B

BIN
textures/wifi_front_animated.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 234 B

BIN
textures/wifi_side.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 149 B

BIN
textures/wifi_top.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 139 B

67
wifi.lua Normal file → Executable file
View File

@ -1,72 +1,22 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
local pipeworks_enabled = minetest.global_exists("pipeworks")
minetest.register_node("more_chests:wifi", {
description = S("Wifi Chest"),
description = "Wifi Chest",
tiles = {"wifi_top.png", "wifi_top.png", "wifi_side.png",
"wifi_side.png", "wifi_side.png",
{name="wifi_front_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2.0}}},
{name="wifi_front_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice = 1, tubedevice_receiver = 1},
-- Pipeworks
tube = pipeworks_enabled and {
insert_object = function(pos, node, stack, direction, owner)
if not owner then
return stack
end
local player = minetest.get_player_by_name(owner)
if not player then
return stack
end
local inv = player:get_inventory()
return inv:add_item("more_chests:wifi", stack)
end,
can_insert = function(pos, node, stack, direction, owner)
if not owner then
return false
end
local player = minetest.get_player_by_name(owner)
if not player then
return false
end
local inv = player:get_inventory()
return inv:room_for_item("more_chests:wifi", stack)
end,
input_inventory = "more_chests:wifi",
return_input_invref = function(pos, node, direction, player_name)
if not player_name then
return false
end
local player = minetest.get_player_by_name(player_name)
if not player then
return false
end
return player:get_inventory()
end,
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
} or nil,
after_place_node = pipeworks_enabled and pipeworks.after_place or nil,
after_dig_node = pipeworks_enabled and pipeworks.after_dig or nil,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]"..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_player;more_chests:wifi;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"list[current_player;more_chests:wifi;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;more_chests:wifi]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
meta:set_string("infotext", S("Wifi Chest"))
"listring[current_player;main]")
meta:set_string("infotext", "Wifi Chest")
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
@ -95,3 +45,4 @@ minetest.register_on_joinplayer(function(player)
local inv = player:get_inventory()
inv:set_size("more_chests:wifi", 8*4)
end)