From 1e7fb18b0be123c6f2caacd81b02d6c7cf1752ec Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 16 Aug 2015 17:41:19 +0200 Subject: [PATCH] move office-themed nodes into an office-file --- homedecor/furniture.lua | 34 ----------- homedecor/init.lua | 2 + homedecor/misc-nodes.lua | 66 --------------------- homedecor/office.lua | 120 +++++++++++++++++++++++++++++++++++++++ homedecor/tables.lua | 26 --------- 5 files changed, 122 insertions(+), 126 deletions(-) create mode 100644 homedecor/office.lua diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index d1054a85..338a95c8 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -152,40 +152,6 @@ homedecor.register("wall_shelf", { } }) -local ofchairs_sbox = { - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 } - } - -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 - { -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_rotate = screwdriver.rotate_simple -}) - -end - -- Aliases for 3dforniture mod. minetest.register_alias("3dforniture:table", "homedecor:table") diff --git a/homedecor/init.lua b/homedecor/init.lua index d98ca2cc..e7ef9a9b 100644 --- a/homedecor/init.lua +++ b/homedecor/init.lua @@ -116,6 +116,8 @@ dofile(modpath.."/bathroom_sanitation.lua") dofile(modpath.."/laundry.lua") +dofile(modpath.."/office.lua") + dofile(modpath.."/nightstands.lua") dofile(modpath.."/clocks.lua") dofile(modpath.."/electrics.lua") diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index f0610b4e..4626a12e 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -287,22 +287,6 @@ homedecor.register("dvd_cd_cabinet", { sounds = default.node_sound_wood_defaults(), }) -homedecor.register("filing_cabinet", { - description = S("Filing Cabinet"), - mesh = "homedecor_filing_cabinet.obj", - tiles = { - homedecor.plain_wood, - "homedecor_filing_cabinet_front.png", - "homedecor_filing_cabinet_bottom.png" - }, - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), - infotext=S("Filing cabinet"), - inventory = { - size=16, - }, -}) - local pooltable_cbox = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 } @@ -477,56 +461,6 @@ homedecor.register("tool_cabinet", { minetest.register_alias("homedecor:tool_cabinet_bottom", "homedecor:tool_cabinet") minetest.register_alias("homedecor:tool_cabinet_top", "air") -homedecor.register("calendar", { - description = "Calendar", - mesh = "homedecor_calendar.obj", - tiles = {"homedecor_calendar.png"}, - inventory_image = "homedecor_calendar_inv.png", - wield_image = "homedecor_calendar_inv.png", - paramtype2 = "wallmounted", - walkable = false, - selection_box = { - type = "wallmounted", - wall_side = { -8/16, -8/16, -4/16, -5/16, 5/16, 4/16 }, - wall_bottom = { -4/16, -8/16, -8/16, 4/16, -5/16, 5/16 }, - wall_top = { -4/16, 5/16, -8/16, 4/16, 8/16, 5/16 } - }, - groups = {choppy=2,attached_node=1}, - legacy_wallmounted = true, - sounds = default.node_sound_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - local date = os.date("%Y-%m-%d") -- ISO 8601 format - meta:set_string("infotext", "Date (right-click to update):\n"..date) - end, - on_rightclick = function(pos, node, clicker) - local meta = minetest.get_meta(pos) - local date = os.date("%Y-%m-%d") - meta:set_string("infotext", "Date (right-click to update):\n"..date) - end -}) - -local globe_cbox = { - type = "fixed", - fixed = { -0.4, -0.5, -0.3, 0.3, 0.3, 0.3 } -} - -homedecor.register("desk_globe", { - description = "Desk globe", - mesh = "homedecor_desk_globe.obj", - tiles = { - "homedecor_generic_wood_red.png", - "homedecor_generic_metal_black.png^[brighten", - "homedecor_earth.png" - }, - inventory_image = "homedecor_desk_globe_inv.png", - selection_box = globe_cbox, - collision_box = globe_cbox, - groups = {choppy=2}, - walkable = false, - sounds = default.node_sound_wood_defaults(), -}) - local pframe_cbox = { type = "fixed", fixed = { -0.18, -0.5, -0.08, 0.18, -0.08, 0.18 } diff --git a/homedecor/office.lua b/homedecor/office.lua new file mode 100644 index 00000000..9e5d1e38 --- /dev/null +++ b/homedecor/office.lua @@ -0,0 +1,120 @@ +local S = homedecor.gettext + +homedecor.register("filing_cabinet", { + description = S("Filing Cabinet"), + mesh = "homedecor_filing_cabinet.obj", + tiles = { + homedecor.plain_wood, + "homedecor_filing_cabinet_front.png", + "homedecor_filing_cabinet_bottom.png" + }, + groups = { snappy = 3 }, + sounds = default.node_sound_wood_defaults(), + infotext=S("Filing cabinet"), + inventory = { + size=16, + }, +}) + +local desk_cbox = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 } +} +homedecor.register("desk", { + description = "Desk", + mesh = "homedecor_desk.obj", + tiles = { + homedecor.plain_wood, + "homedecor_desk_drawers.png", + "homedecor_generic_metal_black.png", + }, + inventory_image = "homedecor_desk_inv.png", + selection_box = desk_cbox, + collision_box = desk_cbox, + sounds = default.node_sound_wood_defaults(), + groups = { snappy = 3 }, + expand = { right="air" }, + inventory = { + size=24, + }, +}) +minetest.register_alias("homedecor:desk_r", "air") + +local globe_cbox = { + type = "fixed", + fixed = { -0.4, -0.5, -0.3, 0.3, 0.3, 0.3 } +} + +homedecor.register("desk_globe", { + description = "Desk globe", + mesh = "homedecor_desk_globe.obj", + tiles = { + "homedecor_generic_wood_red.png", + "homedecor_generic_metal_black.png^[brighten", + "homedecor_earth.png" + }, + inventory_image = "homedecor_desk_globe_inv.png", + selection_box = globe_cbox, + collision_box = globe_cbox, + groups = {choppy=2}, + walkable = false, + sounds = default.node_sound_wood_defaults(), +}) + +homedecor.register("calendar", { + description = "Calendar", + mesh = "homedecor_calendar.obj", + tiles = {"homedecor_calendar.png"}, + inventory_image = "homedecor_calendar_inv.png", + wield_image = "homedecor_calendar_inv.png", + paramtype2 = "wallmounted", + walkable = false, + selection_box = { + type = "wallmounted", + wall_side = { -8/16, -8/16, -4/16, -5/16, 5/16, 4/16 }, + wall_bottom = { -4/16, -8/16, -8/16, 4/16, -5/16, 5/16 }, + wall_top = { -4/16, 5/16, -8/16, 4/16, 8/16, 5/16 } + }, + groups = {choppy=2,attached_node=1}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local date = os.date("%Y-%m-%d") -- ISO 8601 format + meta:set_string("infotext", "Date (right-click to update):\n"..date) + end, + on_rightclick = function(pos, node, clicker) + local meta = minetest.get_meta(pos) + local date = os.date("%Y-%m-%d") + meta:set_string("infotext", "Date (right-click to update):\n"..date) + end +}) + +local ofchairs_sbox = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 } +} +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 + { -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 + } +} + +for _, c in pairs({"basic", "upscale"}) 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_rotate = screwdriver.rotate_simple + }) +end diff --git a/homedecor/tables.lua b/homedecor/tables.lua index a22a9d72..9910cec3 100644 --- a/homedecor/tables.lua +++ b/homedecor/tables.lua @@ -187,29 +187,3 @@ homedecor.register("utility_table_legs", { fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 } }, }) - -local desk_cbox = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 } -} - -homedecor.register("desk", { - description = "Desk", - mesh = "homedecor_desk.obj", - tiles = { - homedecor.plain_wood, - "homedecor_desk_drawers.png", - "homedecor_generic_metal_black.png", - }, - inventory_image = "homedecor_desk_inv.png", - selection_box = desk_cbox, - collision_box = desk_cbox, - sounds = default.node_sound_wood_defaults(), - groups = { snappy = 3 }, - expand = { right="air" }, - inventory = { - size=24, - }, -}) - -minetest.register_alias("homedecor:desk_r", "air")