From 546f8b501c9dfbba1a7fbd9722d9f5579419b6f8 Mon Sep 17 00:00:00 2001 From: jp Date: Sat, 28 Feb 2015 10:14:46 +0100 Subject: [PATCH] Opti. code --- homedecor/clocks.lua | 72 +++----- homedecor/crafts.lua | 2 +- homedecor/fences.lua | 63 ++----- homedecor/furniture.lua | 59 +++---- homedecor/kitchen_appliances.lua | 53 +----- homedecor/lighting.lua | 161 ++++++------------ homedecor/misc-nodes.lua | 136 +++++---------- ...ntern.obj => homedecor_ground_lantern.obj} | 0 homedecor/nightstands.lua | 91 +++------- homedecor/shingles.lua | 43 +---- homedecor/tables.lua | 27 +-- .../homedecor_kitchen_cabinet_top_wood.png | Bin 0 -> 324 bytes 12 files changed, 200 insertions(+), 507 deletions(-) rename homedecor/models/{homedecor_wall_lantern.obj => homedecor_ground_lantern.obj} (100%) create mode 100644 homedecor/textures/homedecor_kitchen_cabinet_top_wood.png diff --git a/homedecor/clocks.lua b/homedecor/clocks.lua index 136e24f..e204b01 100644 --- a/homedecor/clocks.lua +++ b/homedecor/clocks.lua @@ -1,48 +1,32 @@ -homedecor.register("analog_clock_plastic", { - description = "Analog clock (plastic)", - mesh = "homedecor_analog_clock.obj", - tiles = { "homedecor_analog_clock_plastic.png" }, - inventory_image = "homedecor_analog_clock_plastic_inv.png", - wield_image = "homedecor_analog_clock_plastic_inv.png", - collision_box = { - type = "fixed", - fixed = { - { -8/32, -3/32, 14/32, 8/32, 3/32, 16/32 }, - { -7/32, -5/32, 14/32, 7/32, 5/32, 16/32 }, - { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32 }, - { -5/32, -7/32, 14/32, 5/32, 7/32, 16/32 }, - { -3/32, -8/32, 14/32, 3/32, 8/32, 16/32 } - } - }, - selection_box = { - type = "fixed", - fixed = { -8/32, -8/32, 14/32, 8/32, 8/32, 16/32 } - }, - groups = {snappy=3}, -}) +local clock_cbox = { + type = "fixed", + fixed = { + { -8/32, -3/32, 14/32, 8/32, 3/32, 16/32 }, + { -7/32, -5/32, 14/32, 7/32, 5/32, 16/32 }, + { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32 }, + { -5/32, -7/32, 14/32, 5/32, 7/32, 16/32 }, + { -3/32, -8/32, 14/32, 3/32, 8/32, 16/32 } + } +} -homedecor.register("analog_clock_wood", { - description = "Analog clock (wood)", - mesh = "homedecor_analog_clock.obj", - tiles = { "homedecor_analog_clock_wood.png" }, - inventory_image = "homedecor_analog_clock_wood_inv.png", - wield_image = "homedecor_analog_clock_wood_inv.png", - collision_box = { - type = "fixed", - fixed = { - { -8/32, -3/32, 14/32, 8/32, 3/32, 16/32 }, - { -7/32, -5/32, 14/32, 7/32, 5/32, 16/32 }, - { -6/32, -6/32, 14/32, 6/32, 6/32, 16/32 }, - { -5/32, -7/32, 14/32, 5/32, 7/32, 16/32 }, - { -3/32, -8/32, 14/32, 3/32, 8/32, 16/32 } - } - }, - selection_box = { - type = "fixed", - fixed = { -8/32, -8/32, 14/32, 8/32, 8/32, 16/32 } - }, - groups = {snappy=3}, -}) +local clock_sbox = { + type = "fixed", + fixed = { -8/32, -8/32, 14/32, 8/32, 8/32, 16/32 } +} + +local materials = {"plastic", "wood"} + +for _, m in ipairs(materials) do + homedecor.register("analog_clock_"..m, { + description = "Analog clock ("..m..")", + mesh = "homedecor_analog_clock.obj", + tiles = { "homedecor_analog_clock_"..m..".png" }, + inventory_image = "homedecor_analog_clock_"..m.."_inv.png", + collision_box = clock_cbox, + selection_box = clock_sbox, + groups = {snappy=3}, + }) +end homedecor.register("digital_clock", { description = "Digital clock", diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 27ff1e6..448cb39 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -1281,7 +1281,7 @@ minetest.register_craft({ -- Wrought-iron wall latern minetest.register_craft({ - output = "homedecor:wall_lantern 4", + output = "homedecor:ground_lantern", recipe = { { "default:iron_lump", "default:iron_lump", "default:iron_lump" }, { "default:iron_lump", "default:torch", "default:iron_lump" }, diff --git a/homedecor/fences.lua b/homedecor/fences.lua index 27b33be..ce48a7f 100644 --- a/homedecor/fences.lua +++ b/homedecor/fences.lua @@ -15,22 +15,15 @@ if signs_modpath then end local S = homedecor.gettext +local materials = {"brass", "wrought_iron"} -homedecor.register("fence_brass", { - description = S("Brass Fence/railing"), - drawtype = "fencelike", - tiles = {"homedecor_tile_brass.png"}, - inventory_image = "homedecor_fence_brass.png", - selection_box = homedecor.nodebox.bar_y(1/7), - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), -}) +for _, m in ipairs(materials) do -homedecor.register("fence_wrought_iron", { - description = S("Wrought Iron Fence/railing"), +homedecor.register("fence_"..m, { + description = S("Fence/railing ("..m..")"), drawtype = "fencelike", - tiles = {"homedecor_tile_wrought_iron.png"}, - inventory_image = "homedecor_fence_wrought_iron.png", + tiles = {"homedecor_tile_"..m..".png"}, + inventory_image = "homedecor_fence_"..m..".png", selection_box = homedecor.nodebox.bar_y(1/7), groups = {snappy=3}, sounds = default.node_sound_wood_defaults(), @@ -38,17 +31,17 @@ homedecor.register("fence_wrought_iron", { -- brass/wrought iron with signs: -homedecor.register("fence_brass_with_sign", { - description = S("Brass Fence/railing with sign"), +homedecor.register("fence_"..m.."_with_sign", { + description = S("Fence/railing with sign ("..m..")"), tiles = { - "homedecor_sign_brass_post_top.png", - "homedecor_sign_brass_post_bottom.png", - "homedecor_sign_brass_post_side.png", - "homedecor_sign_brass_post_side.png", - "homedecor_sign_brass_post_back.png", - "homedecor_sign_brass_post_front.png", + "homedecor_sign_"..m.."_post_top.png", + "homedecor_sign_"..m.."_post_bottom.png", + "homedecor_sign_"..m.."_post_side.png", + "homedecor_sign_"..m.."_post_side.png", + "homedecor_sign_"..m.."_post_back.png", + "homedecor_sign_"..m.."_post_front.png", }, - wield_image = "homedecor_sign_brass_post.png", + wield_image = "homedecor_sign_"..m.."_post.png", node_box = sign_post_model, groups = {snappy=3,not_in_creative_inventory=1}, sounds = default.node_sound_wood_defaults(), @@ -57,34 +50,12 @@ homedecor.register("fence_brass_with_sign", { max_items = 2, items = { { items = { "default:sign_wall" }}, - { items = { "homedecor:fence_brass" }}, + { items = { "homedecor:fence_"..m }}, }, }, }) -homedecor.register("fence_wrought_iron_with_sign", { - description = S("Wrought Iron Fence/railing with sign"), - tiles = { - "homedecor_sign_wrought_iron_post_top.png", - "homedecor_sign_wrought_iron_post_bottom.png", - "homedecor_sign_wrought_iron_post_side.png", - "homedecor_sign_wrought_iron_post_side.png", - "homedecor_sign_wrought_iron_post_back.png", - "homedecor_sign_wrought_iron_post_front.png", - }, - wield_image = "homedecor_sign_wrought_iron_post.png", - node_box = sign_post_model, - groups = {snappy=3,not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - sunlight_propagates = true, - drop = { - max_items = 2, - items = { - { items = { "default:sign_wall" }}, - { items = { "homedecor:fence_wrought_iron" }}, - }, - }, -}) +end -- other types of fences diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 6966e5e..0fa2550 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -448,28 +448,34 @@ homedecor.register("grandfather_clock_top", { selection_box = homedecor.nodebox.null, }) -homedecor.register("office_chair_upscale", { - description = "Office chair (upscale)", - drawtype = "mesh", - tiles = { "homedecor_office_chair_upscale.png" }, - mesh = "homedecor_office_chair_upscale.obj", - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - selection_box = { +local ofchairs_sbox = { type = "fixed", fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 } - }, - collision_box = { + } + +local ofchairs_cbox = { type = "fixed", fixed = { { -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat { -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback - { -7/16, 1/16, -9/32, -5/16, 7/16, 6/16 }, -- right arm - { 5/16, 1/16, -9/32, 7/16, 7/16, 6/16 }, -- left arm { -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder { -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels } - }, + } + +local ofchairs = {"basic", "upscale"} + +for _, c in ipairs(ofchairs) do + +homedecor.register("office_chair_"..c, { + description = "Office chair ("..c..")", + drawtype = "mesh", + tiles = { "homedecor_office_chair_"..c..".png" }, + mesh = "homedecor_office_chair_"..c..".obj", + groups = { snappy = 3 }, + sounds = default.node_sound_wood_defaults(), + selection_box = ofchairs_sbox, + collision_box = ofchairs_cbox, expand = { top = "air" }, on_rightclick = function(pos, node, clicker) pos.y = pos.y+0.14 -- player's sit position. @@ -477,32 +483,7 @@ homedecor.register("office_chair_upscale", { end, }) -homedecor.register("office_chair_basic", { - description = "Office chair (basic)", - drawtype = "mesh", - tiles = { "homedecor_office_chair_basic.png" }, - mesh = "homedecor_office_chair_basic.obj", - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - selection_box = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 } - }, - collision_box = { - type = "fixed", - fixed = { - { -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat - { -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback - { -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder - { -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels - } - }, - expand = { top = "air" }, - on_rightclick = function(pos, node, clicker) - pos.y = pos.y+0.14 -- player's sit position. - homedecor.sit_exec(pos, node, clicker) - end, -}) +end -- Aliases for 3dforniture mod. diff --git a/homedecor/kitchen_appliances.lua b/homedecor/kitchen_appliances.lua index b70d5b1..46acbb3 100644 --- a/homedecor/kitchen_appliances.lua +++ b/homedecor/kitchen_appliances.lua @@ -377,55 +377,13 @@ homedecor.register("dishwasher", { groups = { snappy = 3 }, }) -homedecor.register("dishwasher_wood", { - description = "Dishwasher", - tiles = { - "homedecor_kitchen_cabinet_top.png", - "homedecor_dishwasher_bottom.png", - "homedecor_dishwasher_sides.png", - "homedecor_dishwasher_sides.png^[transformFX", - "homedecor_dishwasher_back.png", - "homedecor_dishwasher_front.png" - }, - paramtype = "light", - paramtype2 = "facedir", - groups = { snappy = 3 }, -}) +local materials = {"granite", "marble", "steel", "wood"} -homedecor.register("dishwasher_steel", { - description = "Dishwasher", +for _, m in ipairs(materials) do +homedecor.register("dishwasher_"..m, { + description = "Dishwasher ("..m..")", tiles = { - "homedecor_kitchen_cabinet_top_steel.png", - "homedecor_dishwasher_bottom.png", - "homedecor_dishwasher_sides.png", - "homedecor_dishwasher_sides.png^[transformFX", - "homedecor_dishwasher_back.png", - "homedecor_dishwasher_front.png" - }, - paramtype = "light", - paramtype2 = "facedir", - groups = { snappy = 3 }, -}) - -homedecor.register("dishwasher_marble", { - description = "Dishwasher", - tiles = { - "homedecor_kitchen_cabinet_top_marble.png", - "homedecor_dishwasher_bottom.png", - "homedecor_dishwasher_sides.png", - "homedecor_dishwasher_sides.png^[transformFX", - "homedecor_dishwasher_back.png", - "homedecor_dishwasher_front.png" - }, - paramtype = "light", - paramtype2 = "facedir", - groups = { snappy = 3 }, -}) - -homedecor.register("dishwasher_granite", { - description = "Dishwasher", - tiles = { - "homedecor_kitchen_cabinet_top_granite.png", + "homedecor_kitchen_cabinet_top_"..m..".png", "homedecor_dishwasher_bottom.png", "homedecor_dishwasher_sides.png", "homedecor_dishwasher_sides.png^[transformFX", @@ -436,3 +394,4 @@ homedecor.register("dishwasher_granite", { paramtype2 = "facedir", groups = { snappy = 3 }, }) +end diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index 01132ae..cd2702f 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -59,7 +59,6 @@ for i in ipairs(colors) do minetest.add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20}) end, }) -end local glowlight_nodebox = { half = homedecor.nodebox.slab_y(1/2), @@ -70,17 +69,15 @@ local glowlight_nodebox = { }, } --- Yellow - -homedecor.register("glowlight_half_yellow", { - description = S("Yellow Glowlight (thick)"), +homedecor.register("glowlight_half_"..color, { + description = S("Thick Glowlight ("..color..")"), tiles = { - 'homedecor_glowlight_yellow_top.png', - 'homedecor_glowlight_yellow_bottom.png', - 'homedecor_glowlight_thick_yellow_sides.png', - 'homedecor_glowlight_thick_yellow_sides.png', - 'homedecor_glowlight_thick_yellow_sides.png', - 'homedecor_glowlight_thick_yellow_sides.png' + "homedecor_glowlight_"..color.."_top.png", + "homedecor_glowlight_"..color.."_bottom.png", + "homedecor_glowlight_thick_"..color.."_sides.png", + "homedecor_glowlight_thick_"..color.."_sides.png", + "homedecor_glowlight_thick_"..color.."_sides.png", + "homedecor_glowlight_thick_"..color.."_sides.png" }, selection_box = glowlight_nodebox.half, node_box = glowlight_nodebox.half, @@ -90,53 +87,15 @@ homedecor.register("glowlight_half_yellow", { on_place = minetest.rotate_node }) -homedecor.register("glowlight_quarter_yellow", { - description = S("Yellow Glowlight (thin)"), +homedecor.register("glowlight_quarter_"..color, { + description = S("Thin Glowlight ("..color..")"), tiles = { - 'homedecor_glowlight_yellow_top.png', - 'homedecor_glowlight_yellow_bottom.png', - 'homedecor_glowlight_thin_yellow_sides.png', - 'homedecor_glowlight_thin_yellow_sides.png', - 'homedecor_glowlight_thin_yellow_sides.png', - 'homedecor_glowlight_thin_yellow_sides.png' - }, - selection_box = glowlight_nodebox.quarter, - node_box = glowlight_nodebox.quarter, - groups = { snappy = 3 }, - light_source = LIGHT_MAX-1, - sounds = default.node_sound_wood_defaults(), - on_place = minetest.rotate_node -}) - --- White - -homedecor.register("glowlight_half_white", { - description = S("White Glowlight (thick)"), - tiles = { - 'homedecor_glowlight_white_top.png', - 'homedecor_glowlight_white_bottom.png', - 'homedecor_glowlight_thick_white_sides.png', - 'homedecor_glowlight_thick_white_sides.png', - 'homedecor_glowlight_thick_white_sides.png', - 'homedecor_glowlight_thick_white_sides.png' - }, - selection_box = glowlight_nodebox.half, - node_box = glowlight_nodebox.half, - groups = { snappy = 3 }, - light_source = LIGHT_MAX, - sounds = default.node_sound_wood_defaults(), - on_place = minetest.rotate_node -}) - -homedecor.register("glowlight_quarter_white", { - description = S("White Glowlight (thin)"), - tiles = { - 'homedecor_glowlight_white_top.png', - 'homedecor_glowlight_white_bottom.png', - 'homedecor_glowlight_thin_white_sides.png', - 'homedecor_glowlight_thin_white_sides.png', - 'homedecor_glowlight_thin_white_sides.png', - 'homedecor_glowlight_thin_white_sides.png' + "homedecor_glowlight_"..color.."_top.png", + "homedecor_glowlight_"..color.."_bottom.png", + "homedecor_glowlight_thin_"..color.."_sides.png", + "homedecor_glowlight_thin_"..color.."_sides.png", + "homedecor_glowlight_thin_"..color.."_sides.png", + "homedecor_glowlight_thin_"..color.."_sides.png" }, selection_box = glowlight_nodebox.quarter, node_box = glowlight_nodebox.quarter, @@ -148,15 +107,15 @@ homedecor.register("glowlight_quarter_white", { -- Glowlight "cubes" -homedecor.register("glowlight_small_cube_yellow", { - description = S("Yellow Glowlight (small cube)"), +homedecor.register("glowlight_small_cube_"..color, { + description = S("Small Glowlight Cube ("..color..")"), tiles = { - 'homedecor_glowlight_cube_yellow_tb.png', - 'homedecor_glowlight_cube_yellow_tb.png', - 'homedecor_glowlight_cube_yellow_sides.png', - 'homedecor_glowlight_cube_yellow_sides.png', - 'homedecor_glowlight_cube_yellow_sides.png', - 'homedecor_glowlight_cube_yellow_sides.png' + "homedecor_glowlight_cube_"..color.."_tb.png", + "homedecor_glowlight_cube_"..color.."_tb.png", + "homedecor_glowlight_cube_"..color.."_sides.png", + "homedecor_glowlight_cube_"..color.."_sides.png", + "homedecor_glowlight_cube_"..color.."_sides.png", + "homedecor_glowlight_cube_"..color.."_sides.png" }, selection_box = glowlight_nodebox.small_cube, node_box = glowlight_nodebox.small_cube, @@ -166,23 +125,7 @@ homedecor.register("glowlight_small_cube_yellow", { on_place = minetest.rotate_node }) -homedecor.register("glowlight_small_cube_white", { - description = S("White Glowlight (small cube)"), - tiles = { - 'homedecor_glowlight_cube_white_tb.png', - 'homedecor_glowlight_cube_white_tb.png', - 'homedecor_glowlight_cube_white_sides.png', - 'homedecor_glowlight_cube_white_sides.png', - 'homedecor_glowlight_cube_white_sides.png', - 'homedecor_glowlight_cube_white_sides.png' - }, - selection_box = glowlight_nodebox.small_cube, - node_box = glowlight_nodebox.small_cube, - groups = { snappy = 3 }, - light_source = LIGHT_MAX-1, - sounds = default.node_sound_wood_defaults(), - on_place = minetest.rotate_node -}) +end homedecor.register("plasma_lamp", { description = "Plasma Lamp", @@ -267,21 +210,40 @@ homedecor.register("oil_lamp", { sounds = default.node_sound_wood_defaults(), }) -local wl_cbox = { +local gl_cbox = { type = "fixed", fixed = { -0.25, -0.5, -0.25, 0.25, 0.45, 0.25 }, } -homedecor.register("wall_lantern", { - description = S("Wall Lantern"), - mesh = "homedecor_wall_lantern.obj", - tiles = {"homedecor_wall_lantern.png"}, - inventory_image = "homedecor_wall_lantern_inv.png", - wield_image = "homedecor_wall_lantern_inv.png", +minetest.register_alias("homedecor:wall_lantern", "homedecor:ground_lantern") + +homedecor.register("ground_lantern", { + description = S("Ground Lantern"), + mesh = "homedecor_ground_lantern.obj", + tiles = {"homedecor_ground_lantern.png"}, + inventory_image = "homedecor_ground_lantern_inv.png", + wield_image = "homedecor_ground_lantern_inv.png", groups = {snappy=3}, light_source = 11, - selection_box = wl_cbox, - collision_box = wl_cbox, + selection_box = gl_cbox, + collision_box = gl_cbox +}) + +local hl_cbox = { + type = "fixed", + fixed = { -0.25, -0.4, -0.2, 0.25, 0.5, 0.5 }, +} + +homedecor.register("hanging_lantern", { + description = S("Hanging Lantern"), + mesh = "homedecor_hanging_lantern.obj", + tiles = {"homedecor_hanging_lantern.png"}, + inventory_image = "homedecor_hanging_lantern_inv.png", + wield_image = "homedecor_hanging_lantern_inv.png", + groups = {snappy=3}, + light_source = 11, + selection_box = hl_cbox, + collision_box = hl_cbox }) homedecor.register("lattice_lantern_large", { @@ -411,20 +373,3 @@ for _, color in ipairs(dlamp_colors) do groups = {snappy=3}, }) end - -local hl_cbox = { - type = "fixed", - fixed = { -0.25, -0.4, -0.2, 0.25, 0.5, 0.5 }, -} - -homedecor.register("hanging_lantern", { - description = S("Hanging Lantern"), - mesh = "homedecor_hanging_lantern.obj", - tiles = {"homedecor_hanging_lantern.png"}, - inventory_image = "homedecor_hanging_lantern_inv.png", - wield_image = "homedecor_hanging_lantern_inv.png", - groups = {snappy=3}, - light_source = 11, - selection_box = hl_cbox, - collision_box = hl_cbox, -}) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index c1ac0b9..fc3c4d6 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -1,5 +1,3 @@ --- Various misc. nodes - local S = homedecor.gettext homedecor.register("ceiling_paint", { @@ -12,12 +10,7 @@ homedecor.register("ceiling_paint", { walkable = false, groups = { snappy = 3 }, sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "wallmounted", - --wall_top = - --wall_bottom = - --wall_side = - }, + selection_box = { type = "wallmounted" }, }) homedecor.register("ceiling_tile", { @@ -30,75 +23,38 @@ homedecor.register("ceiling_tile", { walkable = false, groups = { snappy = 3 }, sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "wallmounted", - --wall_top = - --wall_bottom = - --wall_side = - }, + selection_box = { type = "wallmounted" }, }) -homedecor.register("rug_small", { - description = S("Small Throw Rug"), +local rug_sizes = {"small", "large"} + +for _, s in ipairs(rug_sizes) do +homedecor.register("rug_"..s, { + description = S("Throw Rug ("..s..")"), drawtype = 'signlike', - tiles = { 'homedecor_rug_small.png' }, - wield_image = 'homedecor_rug_small.png', - inventory_image = 'homedecor_rug_small.png', + tiles = {"homedecor_rug_"..s..".png"}, + wield_image = "homedecor_rug_"..s..".png", + inventory_image = "homedecor_rug_"..s..".png", sunlight_propagates = true, paramtype2 = "wallmounted", walkable = false, - groups = { snappy = 3 }, + groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "wallmounted", - --wall_top = - --wall_bottom = - --wall_side = - }, + selection_box = { type = "wallmounted" }, }) +end -homedecor.register("rug_large", { - description = S("Large Area Rug"), - drawtype = 'signlike', - tiles = { 'homedecor_rug_large.png' }, - wield_image = 'homedecor_rug_large.png', - inventory_image = 'homedecor_rug_large.png', - sunlight_propagates = true, - paramtype2 = "wallmounted", - walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "wallmounted", - --wall_top = - --wall_bottom = - --wall_side = - }, - }) +local pot_colors = {"black", "green", "terracotta"} -homedecor.register("flower_pot_terracotta", { - description = S("Terracotta Flower Pot"), +for _, p in ipairs(pot_colors) do +homedecor.register("flower_pot_"..p, { + description = S("Flower Pot ("..p..")"), mesh = "homedecor_flowerpot.obj", - tiles = { "homedecor_flower_pot_terracotta.png" }, - groups = { snappy = 3, potting_soil=1}, - sounds = default.node_sound_leaves_defaults(), -}) - -homedecor.register("flower_pot_black", { - description = S("Black Plastic Flower Pot"), - mesh = "homedecor_flowerpot.obj", - tiles = { "homedecor_flower_pot_black.png" }, - groups = { snappy = 3, potting_soil=1 }, - sounds = default.node_sound_leaves_defaults(), -}) - -homedecor.register("flower_pot_green", { - description = S("Green Plastic Flower Pot"), - mesh = "homedecor_flowerpot.obj", - tiles = { "homedecor_flower_pot_green.png" }, + tiles = { "homedecor_flower_pot_"..p..".png" }, groups = { snappy = 3, potting_soil=1 }, sounds = default.node_sound_leaves_defaults(), }) +end homedecor.register("pole_brass", { description = S("Brass Pole"), @@ -510,21 +466,21 @@ local bottle_cbox = { } } -homedecor.register("bottle_brown", { - tiles = { "homedecor_bottle_brown.png" }, - inventory_image = "homedecor_bottle_brown_inv.png", - description = "Brown bottle", - mesh = "homedecor_bottle.obj", - sunlight_propagates = true, - groups = {snappy=3}, - collision_box = bottle_cbox, - selection_box = bottle_cbox -}) +local fbottle_cbox = { + type = "fixed", + fixed = { + { -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 } + } +} -homedecor.register("bottle_green", { - tiles = { "homedecor_bottle_green.png" }, - inventory_image = "homedecor_bottle_green_inv.png", - description = "Green bottle", +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", sunlight_propagates = true, groups = {snappy=3}, @@ -534,17 +490,10 @@ homedecor.register("bottle_green", { -- 4-bottle sets -local fbottle_cbox = { - type = "fixed", - fixed = { - { -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 } - } -} - -homedecor.register("4_bottles_brown", { - tiles = { "homedecor_bottle_brown.png" }, - inventory_image = "homedecor_4_bottles_brown_inv.png", - description = "Four brown bottles", +homedecor.register("4_bottles_"..b, { + tiles = { "homedecor_bottle_"..b..".png" }, + inventory_image = "homedecor_4_bottles_"..b.."_inv.png", + description = "Four "..b.." bottles", mesh = "homedecor_4_bottles.obj", sunlight_propagates = true, groups = {snappy=3}, @@ -552,16 +501,7 @@ homedecor.register("4_bottles_brown", { selection_box = fbottle_cbox }) -homedecor.register("4_bottles_green", { - tiles = { "homedecor_bottle_green.png" }, - inventory_image = "homedecor_4_bottles_green_inv.png", - description = "Four green bottles", - mesh = "homedecor_4_bottles.obj", - sunlight_propagates = true, - groups = {snappy=3}, - collision_box = fbottle_cbox, - selection_box = fbottle_cbox -}) +end homedecor.register("4_bottles_multi", { tiles = { "homedecor_4_bottles_multi.png" }, diff --git a/homedecor/models/homedecor_wall_lantern.obj b/homedecor/models/homedecor_ground_lantern.obj similarity index 100% rename from homedecor/models/homedecor_wall_lantern.obj rename to homedecor/models/homedecor_ground_lantern.obj diff --git a/homedecor/nightstands.lua b/homedecor/nightstands.lua index b99e770..a7b3187 100644 --- a/homedecor/nightstands.lua +++ b/homedecor/nightstands.lua @@ -1,15 +1,16 @@ --- This file supplies nightstands - local S = homedecor.gettext +local woods = {"mahogany", "oak"} -homedecor.register("nightstand_oak_one_drawer", { - description = S("Oak Nightstand with One Drawer"), - tiles = { 'homedecor_nightstand_oak_top.png', - 'homedecor_nightstand_oak_bottom.png', - 'homedecor_nightstand_oak_right.png', - 'homedecor_nightstand_oak_left.png', - 'homedecor_nightstand_oak_back.png', - 'homedecor_nightstand_oak_1_drawer_front.png'}, +for _, w in ipairs(woods) do + +homedecor.register("nightstand_"..w.."_one_drawer", { + description = S("Nightstand with One Drawer ("..w..")"), + tiles = { 'homedecor_nightstand_'..w..'_top.png', + 'homedecor_nightstand_'..w..'_bottom.png', + 'homedecor_nightstand_'..w..'_right.png', + 'homedecor_nightstand_'..w..'_left.png', + 'homedecor_nightstand_'..w..'_back.png', + 'homedecor_nightstand_'..w..'_1_drawer_front.png'}, selection_box = { type = "regular" }, node_box = { type = "fixed", @@ -30,14 +31,14 @@ homedecor.register("nightstand_oak_one_drawer", { }, }) -homedecor.register("nightstand_oak_two_drawers", { - description = S("Oak Nightstand with Two Drawers"), - tiles = { 'homedecor_nightstand_oak_top.png', - 'homedecor_nightstand_oak_bottom.png', - 'homedecor_nightstand_oak_right.png', - 'homedecor_nightstand_oak_left.png', - 'homedecor_nightstand_oak_back.png', - 'homedecor_nightstand_oak_2_drawer_front.png'}, +homedecor.register("nightstand_"..w.."_two_drawers", { + description = S("Nightstand with Two Drawers ("..w..")"), + tiles = { 'homedecor_nightstand_'..w..'_top.png', + 'homedecor_nightstand_'..w..'_bottom.png', + 'homedecor_nightstand_'..w..'_right.png', + 'homedecor_nightstand_'..w..'_left.png', + 'homedecor_nightstand_'..w..'_back.png', + 'homedecor_nightstand_'..w..'_2_drawer_front.png'}, selection_box = { type = "regular" }, node_box = { type = "fixed", @@ -56,56 +57,4 @@ homedecor.register("nightstand_oak_two_drawers", { }, }) -homedecor.register("nightstand_mahogany_one_drawer", { - description = S("Mahogany Nightstand with One Drawer"), - tiles = { 'homedecor_nightstand_mahogany_top.png', - 'homedecor_nightstand_mahogany_bottom.png', - 'homedecor_nightstand_mahogany_right.png', - 'homedecor_nightstand_mahogany_left.png', - 'homedecor_nightstand_mahogany_back.png', - 'homedecor_nightstand_mahogany_1_drawer_front.png'}, - selection_box = { type = "regular" }, - node_box = { - type = "fixed", - fixed = { - { -8/16, 0, -30/64, 8/16, 8/16, 8/16 }, -- top half - { -7/16, 1/16, -32/64, 7/16, 7/16, -29/64}, -- drawer face - { -8/16, -8/16, -30/64, -7/16, 0, 8/16 }, -- left - { 7/16, -8/16, -30/64, 8/16, 0, 8/16 }, -- right - { -8/16, -8/16, 7/16, 8/16, 0, 8/16 }, -- back - { -8/16, -8/16, -30/64, 8/16, -7/16, 8/16 } -- bottom - } - }, - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - infotext=S("One-drawer Nightstand"), - inventory = { - size=8, - }, -}) - -homedecor.register("nightstand_mahogany_two_drawers", { - description = S("Mahogany Nightstand with Two Drawers"), - tiles = { 'homedecor_nightstand_mahogany_top.png', - 'homedecor_nightstand_mahogany_bottom.png', - 'homedecor_nightstand_mahogany_right.png', - 'homedecor_nightstand_mahogany_left.png', - 'homedecor_nightstand_mahogany_back.png', - 'homedecor_nightstand_mahogany_2_drawer_front.png'}, - selection_box = { type = "regular" }, - node_box = { - type = "fixed", - fixed = { - { -8/16, -8/16, -30/64, 8/16, 8/16, 8/16 }, -- main body - { -7/16, 1/16, -32/64, 7/16, 7/16, -29/64 }, -- top drawer face - { -7/16, -7/16, -32/64, 7/16, -1/16, -29/64 }, -- bottom drawer face - - } - }, - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - infotext=S("Two-drawer Nightstand"), - inventory = { - size=16, - }, -}) +end diff --git a/homedecor/shingles.lua b/homedecor/shingles.lua index ac5f320..58c40bc 100644 --- a/homedecor/shingles.lua +++ b/homedecor/shingles.lua @@ -1,5 +1,3 @@ --- Various kidns of shingles - local S = homedecor.gettext minetest.register_node("homedecor:skylight", { @@ -29,42 +27,19 @@ minetest.register_node("homedecor:skylight_frosted", { selection_box = homedecor.nodebox.slab_y(0.1), }) -minetest.register_node("homedecor:shingles_wood", { - description = S("Wood Shingles"), +local materials = {"asphalt", "terracotta", "wood"} + +for _, s in ipairs(materials) do +minetest.register_node("homedecor:shingles_"..s, { + description = S("Shingles ("..s..")"), drawtype = "raillike", - tiles = { "homedecor_shingles_wood.png" }, - wield_image = "homedecor_shingles_wood.png", - inventory_image = "homedecor_shingles_wood_inv.png", + tiles = { "homedecor_shingles_"..s..".png" }, + wield_image = "homedecor_shingles_"..s..".png", + inventory_image = "homedecor_shingles_"..s.."_inv.png", paramtype = "light", walkable = false, groups = { snappy = 3 }, sounds = default.node_sound_leaves_defaults(), selection_box = homedecor.nodebox.slab_y(0.1), }) - -minetest.register_node("homedecor:shingles_asphalt", { - description = S("Asphalt Shingles"), - drawtype = "raillike", - tiles = { "homedecor_shingles_asphalt.png" }, - wield_image = "homedecor_shingles_asphalt.png", - inventory_image = "homedecor_shingles_asphalt_inv.png", - paramtype = "light", - walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults(), - selection_box = homedecor.nodebox.slab_y(0.1), -}) - -minetest.register_node("homedecor:shingles_terracotta", { - description = S("Terracotta Shingles"), - drawtype = "raillike", - tiles = { "homedecor_shingles_terracotta.png" }, - wield_image = "homedecor_shingles_terracotta.png", - inventory_image = "homedecor_shingles_terracotta_inv.png", - paramtype = "light", - walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults(), - selection_box = homedecor.nodebox.slab_y(0.1), -}) - +end diff --git a/homedecor/tables.lua b/homedecor/tables.lua index eee9fde..27a4254 100644 --- a/homedecor/tables.lua +++ b/homedecor/tables.lua @@ -157,27 +157,15 @@ homedecor.register("utility_table_top", { -- Various kinds of table legs -homedecor.register("table_legs_brass", { - description = S("Brass Table Legs"), - drawtype = "plantlike", - tiles = {"homedecor_table_legs_brass.png"}, - inventory_image = "homedecor_table_legs_brass.png", - wield_image = "homedecor_table_legs_brass.png", - walkable = false, - groups = {snappy=3}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } - }, -}) +local materials = {"brass", "wrought_iron"} -homedecor.register("table_legs_wrought_iron", { - description = S("Wrought Iron Table Legs"), +for _, t in ipairs(materials) do +homedecor.register("table_legs_"..t, { + description = S("Table Legs ("..t..")"), drawtype = "plantlike", - tiles = {"homedecor_table_legs_wrought_iron.png"}, - inventory_image = "homedecor_table_legs_wrought_iron.png", - wield_image = "homedecor_table_legs_wrought_iron.png", + tiles = {"homedecor_table_legs_"..t..".png"}, + inventory_image = "homedecor_table_legs_"..t..".png", + wield_image = "homedecor_table_legs_"..t..".png", walkable = false, groups = {snappy=3}, sounds = default.node_sound_leaves_defaults(), @@ -186,6 +174,7 @@ homedecor.register("table_legs_wrought_iron", { fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } }, }) +end homedecor.register("utility_table_legs", { description = S("Legs for Utility Table"), diff --git a/homedecor/textures/homedecor_kitchen_cabinet_top_wood.png b/homedecor/textures/homedecor_kitchen_cabinet_top_wood.png new file mode 100644 index 0000000000000000000000000000000000000000..983f4828ee36af731a93ff97a825a032584e0c0d GIT binary patch literal 324 zcmV-K0lWT*P)*8p zh+CnJUZjv7*Om#eN!=T!yD@kBrIKutt3IfZAwV0UYm1O=LIi1A{V?_-) zq|X}l619dFIjKB4vJ_i~|0000