Nightstands now offer small inventories - one-drawer units get 8 slots, while

two-drawer nightstands get 16 slots (8x2).  They're smaller than chests because
they're cheaper to make.
This commit is contained in:
Vanessa Ezekowitz 2012-09-27 22:16:28 -04:00
parent ae0d8c0bbc
commit 1ca119a557

111
init.lua
View File

@ -304,6 +304,34 @@ minetest.register_node('homedecor:nightstand_oak_one_drawer', {
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,6]"..
"list[current_name;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]")
meta:set_string("infotext", "One-drawer Nightstand")
local inv = meta:get_inventory()
inv:set_size("main", 8)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
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 nightstand 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 nightstand 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 nightstand at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node('homedecor:nightstand_oak_two_drawers', {
@ -320,7 +348,35 @@ minetest.register_node('homedecor:nightstand_oak_two_drawers', {
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,7]"..
"list[current_name;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]")
meta:set_string("infotext", "Two-drawer Nightstand")
local inv = meta:get_inventory()
inv:set_size("main", 16)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
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 nightstand 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 nightstand 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 nightstand at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node('homedecor:nightstand_mahogany_one_drawer', {
description = "Oak Nightstand with One Drawer",
tiles = { 'homedecor_nightstand_mahogany_sides.png',
@ -335,6 +391,34 @@ minetest.register_node('homedecor:nightstand_mahogany_one_drawer', {
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,6]"..
"list[current_name;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]")
meta:set_string("infotext", "One-drawer Nightstand")
local inv = meta:get_inventory()
inv:set_size("main", 8)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
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 nightstand 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 nightstand 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 nightstand at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node('homedecor:nightstand_mahogany_two_drawers', {
@ -351,6 +435,33 @@ minetest.register_node('homedecor:nightstand_mahogany_two_drawers', {
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,7]"..
"list[current_name;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]")
meta:set_string("infotext", "Two-drawer Nightstand")
local inv = meta:get_inventory()
inv:set_size("main", 16)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
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 nightstand 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 nightstand 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 nightstand at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node('homedecor:utility_table_top', {