diff --git a/homedecor/gastronomy.lua b/homedecor/gastronomy.lua new file mode 100644 index 0000000..f1b6e5d --- /dev/null +++ b/homedecor/gastronomy.lua @@ -0,0 +1,208 @@ +local S = homedecor.gettext + +local cutlery_cbox = { + type = "fixed", + fixed = { + { -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 }, + { -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 } + } +} + +homedecor.register("cutlery_set", { + drawtype = "mesh", + mesh = "homedecor_cutlery_set.obj", + tiles = { "homedecor_cutlery_set.png" }, + inventory_image = "homedecor_cutlery_set_inv.png", + description = "Cutlery set", + groups = {snappy=3}, + selection_box = cutlery_cbox, + walkable = false, + sounds = default.node_sound_glass_defaults(), +}) + +local bottle_cbox = { + type = "fixed", + fixed = { + { -0.125, -0.5, -0.125, 0.125, 0, 0.125} + } +} + +local fbottle_cbox = { + type = "fixed", + fixed = { + { -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 } + } +} + +local bottle_colors = {"brown", "green"} + +for _, b in ipairs(bottle_colors) do + + homedecor.register("bottle_"..b, { + tiles = { "homedecor_bottle_"..b..".png" }, + inventory_image = "homedecor_bottle_"..b.."_inv.png", + description = "Bottle ("..b..")", + mesh = "homedecor_bottle.obj", + walkable = false, + groups = {snappy=3}, + sounds = default.node_sound_glass_defaults(), + selection_box = bottle_cbox + }) + + -- 4-bottle sets + + homedecor.register("4_bottles_"..b, { + tiles = { + "homedecor_bottle_"..b..".png", + "homedecor_bottle_"..b..".png" + }, + inventory_image = "homedecor_4_bottles_"..b.."_inv.png", + description = "Four "..b.." bottles", + mesh = "homedecor_4_bottles.obj", + walkable = false, + groups = {snappy=3}, + sounds = default.node_sound_glass_defaults(), + selection_box = fbottle_cbox + }) +end + +homedecor.register("4_bottles_multi", { + tiles = { + "homedecor_bottle_brown.png", + "homedecor_bottle_green.png" + }, + inventory_image = "homedecor_4_bottles_multi_inv.png", + description = "Four misc brown/green bottles", + mesh = "homedecor_4_bottles.obj", + groups = {snappy=3}, + walkable = false, + sounds = default.node_sound_glass_defaults(), + selection_box = fbottle_cbox +}) + +local wine_cbox = homedecor.nodebox.slab_z(0.25) +homedecor.register("wine_rack", { + description = "Wine Rack", + mesh = "homedecor_wine_rack.obj", + tiles = { + "homedecor_generic_wood_red.png", + "homedecor_bottle_brown.png", + "homedecor_bottle_brown2.png", + "homedecor_bottle_brown3.png", + "homedecor_bottle_brown4.png" + }, + inventory_image = "homedecor_wine_rack_inv.png", + groups = {choppy=2}, + selection_box = wine_cbox, + collision_box = wine_cbox, + sounds = default.node_sound_defaults(), +}) + +homedecor.register("dartboard", { + description = "Dartboard", + mesh = "homedecor_dartboard.obj", + tiles = { "homedecor_dartboard.png" }, + inventory_image = "homedecor_dartboard_inv.png", + wield_image = "homedecor_dartboard_inv.png", + paramtype2 = "wallmounted", + walkable = false, + selection_box = { + type = "wallmounted", + }, + groups = {choppy=2,dig_immediate=2,attached_node=1}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +homedecor.register("beer_tap", { + description = "Beer tap", + mesh = "homedecor_beer_taps.obj", + tiles = { + "homedecor_generic_metal_bright.png", + "homedecor_generic_metal_black.png", + }, + inventory_image = "homedecor_beertap_inv.png", + groups = { snappy=3 }, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 } + }, + on_punch = function(pos, node, puncher, pointed_thing) + local wielditem = puncher:get_wielded_item() + local inv = puncher:get_inventory() + + local wieldname = wielditem:get_name() + if wieldname == "vessels:drinking_glass" then + if inv:room_for_item("main", "homedecor:beer_mug 1") then + wielditem:take_item() + puncher:set_wielded_item(wielditem) + inv:add_item("main", "homedecor:beer_mug 1") + minetest.chat_send_player(puncher:get_player_name(), "Ahh, a frosty cold beer - look in your inventory for it!") + else + minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a beer mug!") + end + end + end +}) + +minetest.register_craft({ + output = "homedecor:beer_tap", + recipe = { + { "group:stick","default:steel_ingot","group:stick" }, + { "homedecor:kitchen_faucet","default:steel_ingot","homedecor:kitchen_faucet" }, + { "default:steel_ingot","default:steel_ingot","default:steel_ingot" } + }, +}) + +local beer_cbox = { + type = "fixed", + fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 } +} + +homedecor.register("beer_mug", { + description = "Beer mug", + drawtype = "mesh", + mesh = "homedecor_beer_mug.obj", + tiles = { "homedecor_beer_mug.png" }, + inventory_image = "homedecor_beer_mug_inv.png", + groups = { snappy=3, oddly_breakable_by_hand=3 }, + walkable = false, + sounds = default.node_sound_glass_defaults(), + selection_box = beer_cbox, + on_use = minetest.item_eat(2) +}) + +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_rotate = screwdriver.rotate_simple, + 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/init.lua b/homedecor/init.lua index 1c28ce9..7107540 100644 --- a/homedecor/init.lua +++ b/homedecor/init.lua @@ -142,6 +142,7 @@ dofile(homedecor.modpath.."/lighting.lua") dofile(homedecor.modpath.."/kitchen_appliances.lua") dofile(homedecor.modpath.."/kitchen_furniture.lua") +dofile(homedecor.modpath.."/gastronomy.lua") dofile(homedecor.modpath.."/bathroom_furniture.lua") dofile(homedecor.modpath.."/bathroom_sanitation.lua") diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 25d203b..f0610b4 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -370,101 +370,6 @@ homedecor.register("coat_tree", { on_rotate = screwdriver.rotate_simple }) -local cutlery_cbox = { - type = "fixed", - fixed = { - { -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 }, - { -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 } - } -} - -homedecor.register("cutlery_set", { - drawtype = "mesh", - mesh = "homedecor_cutlery_set.obj", - tiles = { "homedecor_cutlery_set.png" }, - inventory_image = "homedecor_cutlery_set_inv.png", - description = "Cutlery set", - groups = {snappy=3}, - selection_box = cutlery_cbox, - walkable = false, - sounds = default.node_sound_glass_defaults(), -}) - -local bottle_cbox = { - type = "fixed", - fixed = { - { -0.125, -0.5, -0.125, 0.125, 0, 0.125} - } -} - -local fbottle_cbox = { - type = "fixed", - fixed = { - { -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 } - } -} - -local bottle_colors = {"brown", "green"} - -for _, b in ipairs(bottle_colors) do - - homedecor.register("bottle_"..b, { - tiles = { "homedecor_bottle_"..b..".png" }, - inventory_image = "homedecor_bottle_"..b.."_inv.png", - description = "Bottle ("..b..")", - mesh = "homedecor_bottle.obj", - walkable = false, - groups = {snappy=3}, - sounds = default.node_sound_glass_defaults(), - selection_box = bottle_cbox - }) - - -- 4-bottle sets - - homedecor.register("4_bottles_"..b, { - tiles = { - "homedecor_bottle_"..b..".png", - "homedecor_bottle_"..b..".png" - }, - inventory_image = "homedecor_4_bottles_"..b.."_inv.png", - description = "Four "..b.." bottles", - mesh = "homedecor_4_bottles.obj", - walkable = false, - groups = {snappy=3}, - sounds = default.node_sound_glass_defaults(), - selection_box = fbottle_cbox - }) -end - -homedecor.register("4_bottles_multi", { - tiles = { - "homedecor_bottle_brown.png", - "homedecor_bottle_green.png" - }, - inventory_image = "homedecor_4_bottles_multi_inv.png", - description = "Four misc brown/green bottles", - mesh = "homedecor_4_bottles.obj", - groups = {snappy=3}, - walkable = false, - sounds = default.node_sound_glass_defaults(), - selection_box = fbottle_cbox -}) - -homedecor.register("dartboard", { - description = "Dartboard", - mesh = "homedecor_dartboard.obj", - tiles = { "homedecor_dartboard.png" }, - inventory_image = "homedecor_dartboard_inv.png", - wield_image = "homedecor_dartboard_inv.png", - paramtype2 = "wallmounted", - walkable = false, - selection_box = { - type = "wallmounted", - }, - groups = {choppy=2,dig_immediate=2,attached_node=1}, - legacy_wallmounted = true, - sounds = default.node_sound_wood_defaults(), -}) local piano_cbox = { type = "fixed", @@ -548,56 +453,6 @@ homedecor.register("skateboard", { on_place = minetest.rotate_node }) -homedecor.register("beer_tap", { - description = "Beer tap", - mesh = "homedecor_beer_taps.obj", - tiles = { - "homedecor_generic_metal_bright.png", - "homedecor_generic_metal_black.png", - }, - inventory_image = "homedecor_beertap_inv.png", - groups = { snappy=3 }, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 } - }, - on_punch = function(pos, node, puncher, pointed_thing) - local wielditem = puncher:get_wielded_item() - local inv = puncher:get_inventory() - - local wieldname = wielditem:get_name() - if wieldname == "vessels:drinking_glass" then - if inv:room_for_item("main", "homedecor:beer_mug 1") then - wielditem:take_item() - puncher:set_wielded_item(wielditem) - inv:add_item("main", "homedecor:beer_mug 1") - minetest.chat_send_player(puncher:get_player_name(), "Ahh, a frosty cold beer - look in your inventory for it!") - else - minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a beer mug!") - end - end - end -}) - -local beer_cbox = { - type = "fixed", - fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 } -} - -homedecor.register("beer_mug", { - description = "Beer mug", - drawtype = "mesh", - mesh = "homedecor_beer_mug.obj", - tiles = { "homedecor_beer_mug.png" }, - inventory_image = "homedecor_beer_mug_inv.png", - groups = { snappy=3, oddly_breakable_by_hand=3 }, - walkable = false, - sounds = default.node_sound_glass_defaults(), - selection_box = beer_cbox, - on_use = minetest.item_eat(2) -}) - homedecor.register("tool_cabinet", { description = "Metal tool cabinet and work table", mesh = "homedecor_tool_cabinet.obj", @@ -672,24 +527,6 @@ homedecor.register("desk_globe", { sounds = default.node_sound_wood_defaults(), }) -local wine_cbox = homedecor.nodebox.slab_z(0.25) -homedecor.register("wine_rack", { - description = "Wine Rack", - mesh = "homedecor_wine_rack.obj", - tiles = { - "homedecor_generic_wood_red.png", - "homedecor_bottle_brown.png", - "homedecor_bottle_brown2.png", - "homedecor_bottle_brown3.png", - "homedecor_bottle_brown4.png" - }, - inventory_image = "homedecor_wine_rack_inv.png", - groups = {choppy=2}, - selection_box = wine_cbox, - collision_box = wine_cbox, - sounds = default.node_sound_defaults(), -}) - local pframe_cbox = { type = "fixed", fixed = { -0.18, -0.5, -0.08, 0.18, -0.08, 0.18 } @@ -905,37 +742,3 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack end 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_rotate = screwdriver.rotate_simple, - 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 -})