Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2021-03-25 21:51:29 +01:00
commit ddb75a7564
43 changed files with 737 additions and 596 deletions

25
.luacheckrc Normal file
View File

@ -0,0 +1,25 @@
std = "lua51+minetest"
unused_args = false
allow_defined_top = true
max_line_length = 999
stds.minetest = {
read_globals = {
"minetest",
"VoxelManip",
"VoxelArea",
"PseudoRandom",
"ItemStack",
"default",
table = {
fields = {
"copy",
},
},
}
}
read_globals = {
"pipeworks",
}

View File

@ -1,47 +1,80 @@
more_chests
===========
# more_chests
Originally 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.
nxet's rework introduces a new backend which allows for easier extension of the available models, including two new models showcasing the feature.
More Chests
This mod is a fork of 0gb.us's chests_0gb_us https://forum.minetest.net/viewtopic.php?f=11&t=4366
### Available models
> NOTE: descriptions of the original models come from 0gb.us initial effort
Megaf's more_chests fixes several bugs, uses new textures and adds compatibility with [VanessaE's Pipeworks] (https://github.com/VanessaE/pipeworks) mod.
#### Cobble Chest
This locked chest looks like cobblestone, and has no info text. Great for hiding things in. However, unlike real cobblestone, this chest is breakable by hand. If you suspect there is one hiding, hold the left mouse button and run your hand along the walls. When cracks appear, you've found the chest.
1 | 2 | 3
---|---|---
default:wood | default:cobble | default:wood
default:cobble | default:steel_ingot | default:cobble
default:wood | default:cobble | default:wood
The following text was writen by 0gb.us
```
Cobble Chest:
{'default:wood','default:cobble','default:wood'},
{'default:cobble','default:steel_ingot','default:cobble'},
{'default:wood','default:cobble','default:wood'}
This locked chest looks like cobblestone, and has no info text. Great for hiding things in. However, unlike real cobblestone, this chest is breakable by hand. If you suspect there is one hiding, Hold the left mouse button, ant run your hand along the walls. When cracks appear, you've found the chest.
Drop Box:
{'default:wood','','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
#### Drop Box
Anyone can put things in, but only the chest's placer can remove items.
1 | 2 | 3
---|---|---
default:wood | _empty_ | default:wood
default:wood | default:steel_ingot | default:wood
default:wood | default:wood | default:wood
Secret Chest:
{'default:wood','default:cobble','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
As long as you remember to click “close” before you leave the chest, no one can see what the chest contains. Only the chest's owner can click “open” and “close” on the chest's formspec, revealing and hiding the chest's contents.
#### Secret Chest
As long as you remember to click "close" before you leave the chest, no one can see what the chest contains. Only the chest's owner can click "open" and "close" on the chest's formspec, revealing and hiding the chest's contents.
1 | 2 | 3
---|---|---
default:wood | default:cobble | default:wood
default:wood | default:steel_ingot | default:wood
default:wood | default:wood | default:wood
Shared Chest:
{'default:wood','default:leaves','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
#### Shared Chest
Exactly what it sounds like. The chest's placer can add people to the chest's shared list using the chest's formspec. Warning: anyone you add may empty the chest. When the chest is empty, it can be mined by anyone, just like a regular locked chest.
1 | 2 | 3
---|---|---
default:wood | default:leaves | default:wood
default:wood | default:steel_ingot | default:wood
default:wood | default:wood | default:wood
Wifi Chest
{'default:wood','default:mese','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
#### Wifi Chest
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.
```
1 | 2 | 3
---|---|---
default:wood | default:mese | default:wood
default:wood | default:steel_ingot | default:wood
default:wood | default:wood | default:wood
#### Fridge
A new model which comes in two forms, 1- and 2-block tall, which indeed have different sizes inventories. No fancy functionality here, I just wanted to know at a glance which one is the chest I'm storing food into.
###### Fridge Recipe
1 | 2 | 3
---|---|---
_empty_ | default:steel_ingot | _empty_
default:steel_ingot | default:ice | default:steel_ingot
_empty_ | default:steel_ingot | _empty_
###### Big Fridge Recipe
1 | 2 | 3
---|---|---
default:steel_ingot | default:steel_ingot | default:steel_ingot
default:steel_ingot | default:ice | default:steel_ingot
default:steel_ingot | default:steel_ingot | default:steel_ingot
#### Toolbox
This model has no particular functionality to offer other than giving your tools' chest a new look. As a bonus you can also craft the chest with different types of wood, which will give you different results. For the fanciest garage workshop you ever built on Minetest.
1 | 2 | 3
---|---|---
default:wood | default:wood | default:wood
default:wood | default:pickaxe | default:wood
default:wood | default:wood | default:wood
> Note: crafting also accepts Aspen, Acacia, Junglewood, Pine and Steel instead of wood

View File

@ -1,115 +0,0 @@
-- 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
end
return true
end
minetest.register_node("more_chests:cobble", {
description = S("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}
},
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 "")
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]" ..
"listring[current_name;main]"..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
end,
allow_metadata_inventory_put = 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()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
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()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_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 locked chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
end,
})
minetest.register_craft({
output = 'more_chests:cobble',
recipe = {
{'default:wood','default:cobble','default:wood'},
{'default:cobble','default:steel_ingot','default:cobble'},
{'default:wood','default:cobble','default:wood'}
}
})

View File

@ -1,113 +0,0 @@
-- 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
end
return true
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"},
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}
},
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")))
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]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
meta:set_string("infotext", DS("Chest"))
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
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()..
" tried to access a dropbox belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
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)
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)
minetest.log("action", player:get_player_name()..
" takes stuff from dropbox at "..minetest.pos_to_string(pos))
end,
})
minetest.register_craft({
output = 'more_chests:dropbox',
recipe = {
{'default:wood','','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
}
})

View File

@ -1,8 +1,10 @@
dofile(minetest.get_modpath("more_chests").."/cobble.lua")
dofile(minetest.get_modpath("more_chests").."/dropbox.lua")
dofile(minetest.get_modpath("more_chests").."/secret.lua")
dofile(minetest.get_modpath("more_chests").."/shared.lua")
dofile(minetest.get_modpath("more_chests").."/wifi.lua")
dofile(minetest.get_modpath("more_chests").."/aliases.lua")
dofile(minetest.get_modpath("more_chests").."/models/cobble.lua")
dofile(minetest.get_modpath("more_chests").."/models/dropbox.lua")
dofile(minetest.get_modpath("more_chests").."/models/fridge.lua")
dofile(minetest.get_modpath("more_chests").."/models/secret.lua")
dofile(minetest.get_modpath("more_chests").."/models/shared.lua")
dofile(minetest.get_modpath("more_chests").."/models/toolbox.lua")
dofile(minetest.get_modpath("more_chests").."/models/wifi.lua")
dofile(minetest.get_modpath("more_chests").."/utils/aliases.lua")
minetest.log("action", "[more_chests] loaded.")

View File

@ -1,11 +1,17 @@
# textdomain: more_chests
Cobble Chest=Coffre en pierre taillée
Dropbox=Boîte de dépôt
Fridge=Réfrigérateur
Big Fridge=Grand réfrigérateur
Secret Chest=Coffre secret
Shared Chest=Coffre partagé
Wifi Chest=Coffre wifi
Wooden Toolbox=Boîte à outils en bois
Aspen Wood Toolbox=Boîte à outils en bois de tremble
Acacia Wood Toolbox=Boîte à outils en bois dacacia
Junglewood Toolbox=Boîte à outils en bois de la jungle
Pine Wood Toolbox=Boîte à outils en bois de pin
Steel Toolbox=Boîte à outils en acier
@1 (owned by @2)=@1 (appartient à @2)
Shared with (separate names with spaces)=Partagé avec (séparez les noms avec des espaces)
submit=valider

17
locale/more_chests.it.tr Normal file
View File

@ -0,0 +1,17 @@
# textdomain: more_chests
Cobble Chest=Baule in ciottoli
Dropbox=Baule Donazioni
Fridge=Frigorifero
Big Fridge=Frigorifero Grande
Secret Chest=Baule Segreto
Shared Chest=Baule Condiviso
Wifi Chest=Baule WiFi
Wooden Toolbox=Scatola degli attrezzi in legno
Aspen Wood Toolbox=Scatola degli attrezzi in legno di pioppo
Acacia Wood Toolbox=Scatola degli attrezzi in legno di acacia
Junglewood Toolbox=Scatola degli attrezzi in legno di jungla
Pine Wood Toolbox=Scatola degli attrezzi in legno di pino
Steel Toolbox=Scatola degli attrezzi in acciaio
@1 (owned by @2)=@1 (di proprietà di @2)
Shared with (separate names with spaces)=Condiviso con (separa i nomi con degli spazi)
submit=invia

View File

@ -1,6 +1,17 @@
# textdomain: more_chests
Secret Chest=
Wifi Chest=
Cobble Chest=
Shared Chest=
Dropbox=
Fridge=
Big Fridge=
Secret Chest=
Shared Chest=
Wifi Chest=
Wooden Toolbox=
Aspen Wood Toolbox=
Acacia Wood Toolbox=
Junglewood Toolbox=
Pine Wood Toolbox=
Steel Toolbox=
@1 (owned by @2)=
Shared with (separate names with spaces)=
submit=

View File

@ -1,3 +1,4 @@
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

25
models/cobble.lua Normal file
View File

@ -0,0 +1,25 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local S = minetest.get_translator("more_chests")
local cobble = gen_def({
description = S("Cobble Chest"),
type = "chest",
size = "small",
tiles = {
top = "default_cobble.png",
side = "default_cobble.png",
front = "cobblechest_front.png"
},
pipeworks_enabled = true
})
minetest.register_node("more_chests:cobble", cobble)
minetest.register_craft({
output = "more_chests:cobble",
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"default:cobble", "default:steel_ingot", "default:cobble"},
{"group:wood", "default:cobble", "group:wood"}
}
})

44
models/dropbox.lua Normal file
View File

@ -0,0 +1,44 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local actions = dofile(minetest.get_modpath("more_chests") .. "/utils/actions.lua")
local S = minetest.get_translator("more_chests")
local dropbox = gen_def({
description = S("Dropbox"),
type = "dropbox",
size = "small",
tiles = {
top = "dropbox_top.png",
side = "dropbox_side.png",
front = "dropbox_front.png"
},
pipeworks_enabled = true,
allow_metadata_inventory_move = false,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if actions.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
})
minetest.register_node("more_chests:dropbox", dropbox)
minetest.register_craft({
output = "more_chests:dropbox",
recipe = {
{"group:wood", "", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

49
models/fridge.lua Normal file
View File

@ -0,0 +1,49 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local S = minetest.get_translator("more_chests")
-- TODO model open
-- normal fridge
local fridge = gen_def({
description = S("Fridge"),
type = "fridge",
size = "small",
tiles = {
side = "fridge_side.png",
front = "fridge_front.png",
},
})
minetest.register_node("more_chests:fridge", fridge)
minetest.register_craft({
output = "more_chests:fridge",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"", "default:steel_ingot", ""}
}
})
-- big fridge
local big_fridge = gen_def({
description = S("Big Fridge"),
type = "fridge",
size = "big",
node_box = {
{-0.5, -0.5, -0.5, 0.5, 1.5, 0.5},
},
tiles = {
side = "fridge_side.png",
front = "fridge_front.png",
},
})
minetest.register_node("more_chests:big_fridge", big_fridge)
minetest.register_craft({
output = "more_chests:big_fridge",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
}
})

53
models/secret.lua Normal file
View File

@ -0,0 +1,53 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local actions = dofile(minetest.get_modpath("more_chests") .. "/utils/actions.lua")
local S = minetest.get_translator("more_chests")
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]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
"button[3,9;2,1;open;close]" ..
default.get_hotbar_bg(0,4.85)
local closed = "size[2,1]" ..
"button[0,0;2,1;open;open]"
local secret = gen_def({
description = S("Secret Chest"),
type = "secret chest",
size = "small",
tiles = {
top = "secret_top.png",
side = "secret_side.png",
front = "secret_front.png"
},
formspec = open,
pipeworks_enabled = true,
})
secret.on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
if actions.has_locked_chest_privilege(meta, sender) then
if fields.open == "open" then
meta:set_string("formspec", open)
else
meta:set_string("formspec", closed)
end
end
end
minetest.register_node("more_chests:secret", secret)
minetest.register_craft({
output = "more_chests:secret",
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

71
models/shared.lua Normal file
View File

@ -0,0 +1,71 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local actions = dofile(minetest.get_modpath("more_chests") .. "/utils/actions.lua")
local S = minetest.get_translator("more_chests")
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") .. "]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
end
local function check_privs(meta, player)
local name = player:get_player_name()
local shared = " " .. meta:get_string("shared") .. " "
if name == meta:get_string("owner") then
return true
elseif shared:find(" " .. name .. " ") then
return true
else
return false
end
end
local shared = gen_def({
description = S("Shared Chest"),
type = "shared chest",
size = "small",
tiles = {
top = "shared_top.png",
side = "shared_side.png",
front = "shared_front.png"
},
formspec = get_formspec(""),
pipeworks_enabled = true,
sounds = default.node_sound_wood_defaults(),
allow_metadata_inventory_move = actions.get_allow_metadata_inventory_move{"shared chest", check_privs=check_privs},
allow_metadata_inventory_put = actions.get_allow_metadata_inventory_put{"shared chest", check_privs=check_privs},
allow_metadata_inventory_take = actions.get_allow_metadata_inventory_take{"shared chest", check_privs=check_privs},
})
shared.on_receive_fields = function(pos, formspec, fields, sender)
local meta = minetest.get_meta(pos);
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))
end
end
end
minetest.register_node("more_chests:shared", shared)
minetest.register_craft({
output = "more_chests:shared",
recipe = {
{"group:wood", "default:leaves", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

33
models/toolbox.lua Normal file
View File

@ -0,0 +1,33 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local S = minetest.get_translator("more_chests")
local function register_toolbox(description, material, side_tile, craft_item)
local def = gen_def({
description = description,
type = "toolbox",
size = "big",
-- node_box = {-0.5, -0.5, -0.5, 1.5, 0.5, 0.5}, -- makes it two blocks wide
tiles = {
side = side_tile,
front = "toolbox_" .. material .. "_front.png",
top = "toolbox_" .. material .. "_top.png",
},
})
minetest.register_node("more_chests:toolbox_" .. material, def)
minetest.register_craft({
output = "more_chests:toolbox_" .. material,
recipe = {
{craft_item, craft_item, craft_item},
{craft_item, "group:pickaxe", craft_item},
{craft_item, craft_item, craft_item}
}
})
end
register_toolbox(S("Wooden Toolbox"), "wood", "default_wood.png", "default:wood")
register_toolbox(S("Aspen Wood Toolbox"), "aspen", "default_aspen_wood.png", "default:aspen_wood")
register_toolbox(S("Acacia Wood Toolbox"), "acacia", "default_acacia_wood.png", "default:acacia_wood")
register_toolbox(S("Junglewood Toolbox"), "jungle", "default_junglewood.png", "default:junglewood")
register_toolbox(S("Pine Wood Toolbox"), "pine", "default_pine_wood.png", "default:pine_wood")
register_toolbox(S("Steel Toolbox"), "steel", "default_steel_block.png", "default:steel_ingot")

89
models/wifi.lua Normal file
View File

@ -0,0 +1,89 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local S = minetest.get_translator("more_chests")
local pipeworks_enabled = minetest.global_exists("pipeworks")
local wifi = gen_def({
description = S("Wifi Chest"),
type = "wifi chest",
size = "small",
tiles = {
top = "wifi_top.png",
side = "wifi_side.png",
front = {name="wifi_front_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2.0}}
},
inventory_name = "more_chests:wifi",
pipeworks_enabled = pipeworks_enabled, -- this adds groups
})
-- wifi chests can always be removed because content is detached
wifi.can_dig = function(pos, player) return true end
-- pipeworks support (we need to override what is created by gen_def because too generic)
wifi.tube = pipeworks_enabled and {
insert_object = function(pos, node, stack, direction, owner)
local wifi_chest_owner
if not owner then
local wifi_chest = minetest.get_meta(pos)
if not wifi_chest then
return stack
end
wifi_chest_owner = wifi_chest:get_string("owner")
if not wifi_chest_owner then
return stack
end
end
local player = minetest.get_player_by_name(owner or wifi_chest_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)
local wifi_chest_owner
if not owner then
local wifi_chest = minetest.get_meta(pos)
if not wifi_chest then
return stack
end
wifi_chest_owner = wifi_chest:get_string("owner")
if not wifi_chest_owner then
return false
end
end
local player = minetest.get_player_by_name(owner or wifi_chest_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
minetest.register_node("more_chests:wifi", wifi)
minetest.register_craft({
output = "more_chests:wifi",
recipe = {
{"group:wood", "default:mese", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
})
minetest.register_on_joinplayer(function(player)
local inv = player:get_inventory()
inv:set_size("more_chests:wifi", 8*4)
end)

View File

@ -1,132 +0,0 @@
-- 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
end
return true
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]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
"button[3,9;2,1;open;close]" ..
default.get_hotbar_bg(0,4.85)
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"},
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}
},
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")))
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("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a secret chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
end,
allow_metadata_inventory_put = 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()..
" tried to access a secret chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
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()..
" tried to access a secret chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_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 secret chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to secret chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from secret chest at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, sender) then
if fields.open == "open" then
meta:set_string("formspec", open)
else
meta:set_string("formspec", closed)
end
end
end,
})
minetest.register_craft({
output = 'more_chests:secret',
recipe = {
{'default:wood','default:cobble','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
}
})

View File

@ -1,138 +0,0 @@
-- 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").." "
if name == meta:get_string("owner") then
return true
elseif shared:find(" "..name.." ") then
return true
else
return false
end
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").."]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
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"},
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}
},
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")))
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("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a shared chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
end,
allow_metadata_inventory_put = 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()..
" tried to access a shared chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
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()..
" tried to access a shared chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_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 shared chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to shared chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from shared chest at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formspec, fields, sender)
local meta = minetest.get_meta(pos);
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))
end
end
end,
})
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'}
}
})

BIN
textures/fridge_front.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
textures/fridge_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
textures/toolbox_front.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
textures/toolbox_top.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 239 B

90
utils/actions.lua Normal file
View File

@ -0,0 +1,90 @@
local function get_inventory_auth_string(player, meta, pos, label)
return player:get_player_name() .. " tried to access a locked " .. label .. " belonging to " .. meta:get_string("owner") .. " at " .. minetest.pos_to_string(pos)
end
function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end
function get_allow_metadata_inventory_move(t)
setmetatable(t, {__index={check_privs=has_locked_chest_privilege}})
local label, check_privs = t[1], t.check_privs
return function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not check_privs(meta, player) then
minetest.log("action", get_inventory_auth_string(player, meta, pos, label))
return 0
end
return count
end
end
function get_allow_metadata_inventory_put(t)
setmetatable(t, {__index={check_privs=has_locked_chest_privilege}})
local label, check_privs = t[1], t.check_privs
return function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not check_privs(meta, player) then
minetest.log("action", get_inventory_auth_string(player, meta, pos, label))
return 0
end
return stack:get_count()
end
end
function get_allow_metadata_inventory_take(t)
setmetatable(t, {__index={check_privs=has_locked_chest_privilege}})
local label, check_privs = t[1], t.check_privs
return function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not check_privs(meta, player) then
minetest.log("action", get_inventory_auth_string(player, meta, pos, label))
return 0
end
return stack:get_count()
end
end
local function get_inventory_action_string(player, pos, action, label)
return player:get_player_name() .. " moves stuff " .. action .. " locked " .. label .. " at " .. minetest.pos_to_string(pos)
end
function get_on_metadata_inventory_move(label)
return function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", get_inventory_action_string(player, pos, "in", label)
)
end
end
function get_on_metadata_inventory_put(label)
return function(pos, listname, index, stack, player)
minetest.log("action", get_inventory_action_string(player, pos, "to", label))
end
end
function get_on_metadata_inventory_take(label)
return function(pos, listname, index, stack, player)
minetest.log("action", get_inventory_action_string(player, pos, "from", label))
end
end
actions = {
has_locked_chest_privilege = has_locked_chest_privilege,
get_allow_metadata_inventory_move = get_allow_metadata_inventory_move,
get_allow_metadata_inventory_put = get_allow_metadata_inventory_put,
get_allow_metadata_inventory_take = get_allow_metadata_inventory_take,
get_on_metadata_inventory_move = get_on_metadata_inventory_move,
get_on_metadata_inventory_put = get_on_metadata_inventory_put,
get_on_metadata_inventory_take = get_on_metadata_inventory_take,
}
return actions

98
utils/base.lua Normal file
View File

@ -0,0 +1,98 @@
-- NOTE: `require` is not allowed with mod security on
-- `dofile` with a return on the module is used instead
generate_formspec_string = dofile(minetest.get_modpath("more_chests").."/utils/formspec.lua")
local actions = dofile(minetest.get_modpath("more_chests").."/utils/actions.lua")
local S = minetest.get_translator("more_chests")
local function parse_action(value, default_getter)
if value == false then -- model disabled this attribute
return nil
elseif value == nil then -- model wants the default attribute
return default_getter()
else -- model provided its own attribute
return value
end
end
function generate_chest_def(def)
-- TODO assert def.size in ("big", "small")
local out = {
description = def.description,
tiles = {
def.tiles.top or def.tiles.side,
def.tiles.top or def.tiles.side,
def.tiles.side,
def.tiles.side,
def.tiles.side,
def.tiles.front
},
paramtype2 = "facedir",
legacy_facedir_simple = true,
groups = {
snappy=2,
choppy=2,
oddly_breakable_by_hand=2
},
sounds = def.sounds or 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)", def.description, meta:get_string("owner")))
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local formspec_str = def.formspec or generate_formspec_string(def.size, def.inventory_name or nil)
meta:set_string("formspec", formspec_str)
meta:set_string("infotext", def.description)
meta:set_string("owner", "")
if def.inventory_name == nil or def.inventory_name == "main" then
local inv = meta:get_inventory()
local chest_size = def.size == "big" and 14*5 or 8*4
inv:set_size("main", chest_size)
end
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
}
-- register log actions, NOTE passing an anonymous function to avoid getting the default if not necessary
out.allow_metadata_inventory_move = parse_action(def.allow_metadata_inventory_move, function() actions.get_allow_metadata_inventory_move{def.type} end)
out.allow_metadata_inventory_put = parse_action(def.allow_metadata_inventory_put, function() actions.get_allow_metadata_inventory_put{def.type} end)
out.allow_metadata_inventory_take = parse_action(def.allow_metadata_inventory_take, function() actions.get_allow_metadata_inventory_take{def.type} end)
out.on_metadata_inventory_move = parse_action(def.on_metadata_inventory_move, function() actions.get_on_metadata_inventory_move(def.type) end)
out.on_metadata_inventory_put = parse_action(def.on_metadata_inventory_put, function() actions.get_on_metadata_inventory_put(def.type) end)
out.on_metadata_inventory_take = parse_action(def.on_metadata_inventory_take, function() actions.get_on_metadata_inventory_take(def.type) end)
-- if model is not a simple block handle node_box attribute
if def.node_box then
out.drawtype = "nodebox"
out.node_box = {
type = "fixed",
fixed = def.node_box,
}
end
-- add pipeworks compatibility, TODO needs proper testing
if def.pipeworks_enabled == true then
out.groups.tubedevice = 1
out.groups.tubedevice_receiver = 1
out.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}
}
end
return out
end
return generate_chest_def

46
utils/formspec.lua Normal file
View File

@ -0,0 +1,46 @@
function generate(size, inventory_name)
local cfg
-- chest inventory name
local inv_name = inventory_name
if inv_name == nil then
inv_name = "main"
end
if size == "small" then
cfg = {
window_width = 8,
window_height = 9,
chest_width = 8,
chest_height = 4,
}
elseif size == "big" then
cfg = {
window_width = 14,
window_height = 10,
chest_width = 14,
chest_height = 5,
}
end
-- calc padding to vertically align center the chest and the player's inventory
local player_inv_y_orig = cfg.chest_height + 0.85
local player_inv_x_orig = (cfg.window_width - 8) / 2 -- 8=player_inv_width
return "size[" ..
cfg.window_width .. "," .. cfg.window_height .. "]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list["..((inv_name == "main") and "current_name" or "current_player")..";"..inv_name..";0,0.3;" ..
cfg.chest_width .. "," .. cfg.chest_height .. ";]" ..
"list[current_player;main;" ..
player_inv_x_orig .. "," .. player_inv_y_orig ..
";8,1;]" ..
"list[current_player;main;" ..
player_inv_x_orig .. "," .. (player_inv_y_orig + 1.15) ..
";8,3;8]" ..
"listring["..(inv_name == "main" and "current_name" or "current_player")..";"..inv_name.."]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(player_inv_x_orig, player_inv_y_orig)
end
return generate

View File

@ -1,54 +0,0 @@
-- Load support for translation.
local S = minetest.get_translator("more_chests")
minetest.register_node("more_chests:wifi", {
description = S("Wifi Chest"),
tiles = {"wifi_top.png", "wifi_top.png", "wifi_side.png",
"wifi_side.png", "wifi_side.png", "wifi_front.png"},
paramtype2 = "facedir",
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]" ..
"listring[current_player;more_chests:wifi]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85))
meta:set_string("infotext", S("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()..
" moves stuff in wifi chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to wifi chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from wifi chest at "..minetest.pos_to_string(pos))
end,
})
minetest.register_craft({
output = 'more_chests:wifi',
recipe = {
{'default:wood','default:mese','default:wood'},
{'default:wood','default:steel_ingot','default:wood'},
{'default:wood','default:wood','default:wood'}
}
})
minetest.register_on_joinplayer(function(player)
local inv = player:get_inventory()
inv:set_size("more_chests:wifi", 8*4)
end)