diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index eac206af..45e0c345 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -118,6 +118,17 @@ minetest.register_craftitem("homedecor:chainlink_brass", { inventory_image = "homedecor_chainlink_brass.png" }) +minetest.register_craftitem("homedecor:soda_can", { + description = "Soda Can", + inventory_image = "homedecor_soda_can.png", + on_use = minetest.item_eat(2), +}) + +minetest.register_craftitem("homedecor:coin", { + description = "Gold Coin", + inventory_image = "homedecor_coin.png", +}) + -- alternate crafting if mesecons is/isn't installed if not minetest.get_modpath("mesecons") then @@ -3198,6 +3209,33 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "homedecor:soda_machine", + recipe = { + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "dye:red", "default:steel_ingot"}, + {"default:steel_ingot", "default:copperblock", "default:steel_ingot"}, + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:coin 5", + recipe = {"moreblocks:micro_goldblock_1", "default:sword_stone"} +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:coin 15", + recipe = {"default:gold_ingot", "default:sword_steel"} +}) + +minetest.register_craft({ + type = "shapeless", + output = "homedecor:coin 50", + recipe = {"default:goldblock", "default:sword_mese"} +}) + for i in ipairs(homedecor.banister_materials) do local name = homedecor.banister_materials[i][1] diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 72c52526..1a02e198 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -828,3 +828,35 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack end end) +local svm_cbox = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5} +} + +homedecor.register("soda_machine", { + description = "Soda Vending Machine", + mesh = "homedecor_soda_machine.obj", + tiles = {"homedecor_soda_machine.png"}, + groups = {snappy=3}, + selection_box = svm_cbox, + collision_box = svm_cbox, + expand = { top="air" }, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher, pointed_thing) + local wielditem = puncher:get_wielded_item() + local wieldname = wielditem:get_name() + local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} } + local fdir = node.param2 + local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] } + if wieldname == "homedecor:coin" then + wielditem:take_item() + puncher:set_wielded_item(wielditem) + minetest.spawn_item(pos_drop, "homedecor:soda_can") + minetest.sound_play("insert_coin", { + pos=pos, max_hear_distance = 5 + }) + else + minetest.chat_send_player(puncher:get_player_name(), "Please insert a coin in the machine.") + end + end +}) diff --git a/homedecor/models/homedecor_soda_machine.obj b/homedecor/models/homedecor_soda_machine.obj new file mode 100644 index 00000000..66d651f6 --- /dev/null +++ b/homedecor/models/homedecor_soda_machine.obj @@ -0,0 +1,34 @@ +# Blender v2.72 (sub 0) OBJ File: '' +# www.blender.org +mtllib vending_machine.mtl +o Cube +v 0.499998 -0.499998 -0.499998 +v 0.499998 -0.499998 0.499998 +v -0.499998 -0.499998 0.499998 +v -0.499998 -0.499998 -0.499998 +v 0.499998 1.499994 -0.499998 +v 0.499998 1.499994 0.499998 +v -0.499998 1.499994 0.499998 +v -0.499998 1.499994 -0.499998 +vt 0.250050 0.250050 +vt 0.000100 0.250050 +vt 0.000100 0.000100 +vt 0.250050 0.000100 +vt 0.250050 0.749950 +vt 0.250050 0.999900 +vt 0.000100 0.999900 +vt 0.000100 0.749950 +vt 0.999900 0.250049 +vt 0.999900 0.749949 +vt 0.749950 0.749950 +vt 0.749950 0.250050 +vt 0.500000 0.749950 +vt 0.500000 0.250050 +usemtl Material +s off +f 1/1 2/2 3/3 4/4 +f 5/5 8/6 7/7 6/8 +f 1/1 5/5 6/8 2/2 +f 2/9 6/10 7/11 3/12 +f 3/12 7/11 8/13 4/14 +f 5/5 1/1 4/14 8/13 diff --git a/homedecor/sounds/insert_coin.ogg b/homedecor/sounds/insert_coin.ogg new file mode 100644 index 00000000..2ee99d5f Binary files /dev/null and b/homedecor/sounds/insert_coin.ogg differ diff --git a/homedecor/textures/homedecor_coin.png b/homedecor/textures/homedecor_coin.png new file mode 100644 index 00000000..84b0932b Binary files /dev/null and b/homedecor/textures/homedecor_coin.png differ diff --git a/homedecor/textures/homedecor_soda_can.png b/homedecor/textures/homedecor_soda_can.png new file mode 100644 index 00000000..2797b6e2 Binary files /dev/null and b/homedecor/textures/homedecor_soda_can.png differ diff --git a/homedecor/textures/homedecor_soda_machine.png b/homedecor/textures/homedecor_soda_machine.png new file mode 100644 index 00000000..82f0ab90 Binary files /dev/null and b/homedecor/textures/homedecor_soda_machine.png differ