diff --git a/chest.lua b/chest.lua new file mode 100644 index 0000000..74300df --- /dev/null +++ b/chest.lua @@ -0,0 +1,44 @@ +minetest.register_node("axinitium:chest", { + description = "Axinitium Chest", + tiles = {"chest_top.png", "chest_top.png", "chest_side.png", + "chest_side.png", "chest_side.png", "chest_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;axinitiumchest;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;axinitiumchest]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85)) + + meta:set_string("infotext", "Axinitium 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 axinitium 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 axinitium 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 axinitium chest at "..minetest.pos_to_string(pos)) + end, +}) + + +minetest.register_on_joinplayer(function(player) + local inv = player:get_inventory() + inv:set_size("axinitiumchest", 8*2) +end) + diff --git a/crafts.lua b/crafts.lua index 4d0957e..c259fd6 100644 --- a/crafts.lua +++ b/crafts.lua @@ -107,3 +107,13 @@ minetest.register_craft({ {'default:stick'}, } }) + +--Define Axinite Chest crafting recipe +minetest.register_craft({ + output = 'axinitium:chest', + recipe = { + {'axinitium:block','default:mese','axinitium:block'}, + {'axinitium:block','default:steel_ingot','axinitium:block'}, + {'axinitium:block','axinitium:block','axinitium:block'}, + } +}) diff --git a/init.lua b/init.lua index f297e26..ab50ee3 100644 --- a/init.lua +++ b/init.lua @@ -152,3 +152,4 @@ dofile(path.."/items.lua") dofile(path.."/tools.lua") dofile(path.."/armor.lua") dofile(path.."/arrow.lua") +dofile(path.."/chest.lua") diff --git a/textures/chest_front.png b/textures/chest_front.png new file mode 100644 index 0000000..e31cf92 Binary files /dev/null and b/textures/chest_front.png differ diff --git a/textures/chest_side.png b/textures/chest_side.png new file mode 100644 index 0000000..f741db2 Binary files /dev/null and b/textures/chest_side.png differ diff --git a/textures/chest_top.png b/textures/chest_top.png new file mode 100644 index 0000000..b3bac3e Binary files /dev/null and b/textures/chest_top.png differ