forked from mtcontrib/homedecor_modpack
use the simplified inventory format for the wardrobe, where applicable
This commit is contained in:
parent
4d5975d407
commit
9420e9136c
@ -20,6 +20,10 @@ homedecor.register("wardrobe", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
expand = { top="air" },
|
||||
on_rotate = screwdriver.rotate_simple,
|
||||
infotext = "Wardrobe",
|
||||
inventory = {
|
||||
size = 10
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local skins = {"male1", "male2", "male3", "male4", "male5"}
|
||||
@ -30,33 +34,12 @@ homedecor.register("wardrobe", {
|
||||
"image_button_exit["..(i-1)..".5,0;1.1,2;homedecor_clothes_"..skins[i].."_preview.png;"..skins[i]..";]"..
|
||||
"image_button_exit["..(i-1)..".5,2;1.1,2;homedecor_clothes_fe"..skins[i].."_preview.png;fe"..skins[i]..";]"
|
||||
end
|
||||
|
||||
meta:set_string("formspec", "size[5.5,8.5]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
|
||||
"vertlabel[0,0.5;CLOTHES]"..
|
||||
clothes_strings..
|
||||
"vertlabel[0,5.2;STORAGE]"..
|
||||
"list[current_name;main;0.5,4.5;5,2;]"..
|
||||
"list[current_player;main;0.5,6.8;5,2;]")
|
||||
meta:set_string("infotext", "Wardrobe")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 5*2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.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 wardrobe 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 in wardrobe 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 wardrobe at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user