commit b2bd5d1646469a093c16c9c4b15ea23731789e32 Author: DonBatman Date: Fri Oct 9 20:14:13 2015 -0700 First upload diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..dd2b4f6 --- /dev/null +++ b/init.lua @@ -0,0 +1,112 @@ +local item1 = "default:diamond 3" +local item2 = "default:steel_ingot 10" +local item3 = "default:sand 5" +local item4 = "default:pick_steel" +local item5 = "default:mese_crystal 3" +-- if you want to add more items or have less please edit lines 30+ +minetest.register_node("myitemchest:chest", { + description = "Chest", + tiles = { + "myitemchest_chest_top.png", + "myitemchest_chest_top.png", + "myitemchest_chest_front.png", + "myitemchest_chest_front.png", + "myitemchest_chest_front.png", + "myitemchest_chest_front.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {choppy = 2}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.3125, 0.5, 0.3125, 0.375}, + } + }, + on_rightclick = function(pos, node, player, itemstack, pointed_thing) + minetest.set_node(pos, {name="myitemchest:chest_open", param2=node.param2}) + minetest.spawn_item({x=pos.x,y=pos.y+0.5,z=pos.z}, item1) + minetest.spawn_item({x=pos.x,y=pos.y+0.5,z=pos.z}, item2) + minetest.spawn_item({x=pos.x,y=pos.y+0.5,z=pos.z}, item3) + minetest.spawn_item({x=pos.x,y=pos.y+0.5,z=pos.z}, item4) + minetest.spawn_item({x=pos.x,y=pos.y+0.5,z=pos.z}, item5) + end, +}) +minetest.register_node("myitemchest:chest2", { + description = "Chest", + tiles = { + "myitemchest_chest_top.png", + "myitemchest_chest_top.png", + "myitemchest_chest_top.png", + "myitemchest_chest_top.png", + "myitemchest_chest_top.png", + "myitemchest_chest_top.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {choppy = 2}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.3125, 0.5, 0.3125, 0.375}, + } + }, + on_rightclick = function(pos, node, player, itemstack, pointed_thing) + minetest.swap_node(pos, {name="myitemchest:chest_open", param2=node.param2}) + end, +}) +minetest.register_node("myitemchest:chest_open", { + description = "Chest Open", + tiles = { + "myitemchest_chest_open_top.png", + "myitemchest_chest_open_top.png", + "myitemchest_chest_open_side.png", + "myitemchest_chest_open_side.png^[transformFx", + "myitemchest_chest_top.png", + "myitemchest_chest_top.png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + drop = "myitemchest:chest2", + groups = {choppy = 2,not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.3125, 0.5, -0.4375, 0.375}, + {-0.5, -0.5, 0.3125, 0.5, 0.1875, 0.375}, + {-0.5, -0.5, -0.3125, -0.4375, 0.1875, 0.375}, + {0.4375, -0.5, -0.3125, 0.5, 0.1875, 0.375}, + {-0.5, -0.5, -0.3125, 0.5, 0.1875, -0.25}, + {-0.5, 0.1875, 0.4375, 0.5, 0.875, 0.5}, + {-0.5, 0.1875, 0.375, 0.5, 0.25, 0.5}, + {-0.5, 0.8125, 0.375, 0.5, 0.875, 0.5}, + {-0.5, 0.1875, 0.375, -0.4375, 0.875, 0.5}, + {0.4375, 0.1875, 0.375, 0.5, 0.875, 0.5}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.3125, 0.5, -0.4375, 0.375}, + {-0.5, -0.5, 0.3125, 0.5, 0.1875, 0.375}, + {-0.5, -0.5, -0.3125, -0.4375, 0.1875, 0.375}, + {0.4375, -0.5, -0.3125, 0.5, 0.1875, 0.375}, + {-0.5, -0.5, -0.3125, 0.5, 0.1875, -0.25}, + {-0.5, 0.1875, 0.4375, 0.5, 0.875, 0.5}, + {-0.5, 0.1875, 0.375, 0.5, 0.25, 0.5}, + {-0.5, 0.8125, 0.375, 0.5, 0.875, 0.5}, + {-0.5, 0.1875, 0.375, -0.4375, 0.875, 0.5}, + {0.4375, 0.1875, 0.375, 0.5, 0.875, 0.5}, + } + }, + + on_rightclick = function(pos, node, player, itemstack, pointed_thing) + minetest.swap_node(pos, {name="myitemchest:chest2", param2=node.param2}) + end, +}) diff --git a/textures/myitemchest_chest_front.png b/textures/myitemchest_chest_front.png new file mode 100644 index 0000000..86b5ff6 Binary files /dev/null and b/textures/myitemchest_chest_front.png differ diff --git a/textures/myitemchest_chest_open_side.png b/textures/myitemchest_chest_open_side.png new file mode 100644 index 0000000..2926d77 Binary files /dev/null and b/textures/myitemchest_chest_open_side.png differ diff --git a/textures/myitemchest_chest_open_top.png b/textures/myitemchest_chest_open_top.png new file mode 100644 index 0000000..8f18df0 Binary files /dev/null and b/textures/myitemchest_chest_open_top.png differ diff --git a/textures/myitemchest_chest_top.png b/textures/myitemchest_chest_top.png new file mode 100644 index 0000000..32f4788 Binary files /dev/null and b/textures/myitemchest_chest_top.png differ