From 63439e19ea0770e29fcbae5cb9116c2640d8c5e1 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 2 Apr 2022 16:32:44 -0400 Subject: [PATCH] initial progress --- .luacheckrc | 39 +++++++ homedecor_3d_extras/.luacheckrc | 18 --- homedecor_3d_extras/init.lua | 24 ++-- homedecor_3d_extras/mod.conf | 3 +- homedecor_books/.luacheckrc | 21 ---- homedecor_books/init.lua | 9 +- homedecor_books/mod.conf | 4 +- homedecor_climate_control/.luacheckrc | 21 ---- homedecor_climate_control/init.lua | 151 +++++++++++++------------- homedecor_climate_control/mod.conf | 4 +- homedecor_clocks/.luacheckrc | 21 ---- homedecor_clocks/init.lua | 138 ++++++++++++----------- homedecor_clocks/mod.conf | 4 +- homedecor_cobweb/.luacheckrc | 18 --- homedecor_cobweb/init.lua | 39 ++++--- homedecor_cobweb/mod.conf | 3 +- homedecor_common/.luacheckrc | 21 ---- homedecor_common/expansion.lua | 10 +- homedecor_common/init.lua | 11 ++ homedecor_common/inventory.lua | 21 ++-- homedecor_common/materials.lua | 101 +++++++++++++++++ homedecor_common/mod.conf | 4 +- homedecor_common/nodeboxes.lua | 2 +- homedecor_common/registration.lua | 31 +++++- 24 files changed, 397 insertions(+), 321 deletions(-) create mode 100644 .luacheckrc delete mode 100644 homedecor_3d_extras/.luacheckrc delete mode 100644 homedecor_books/.luacheckrc delete mode 100644 homedecor_climate_control/.luacheckrc delete mode 100644 homedecor_clocks/.luacheckrc delete mode 100644 homedecor_cobweb/.luacheckrc delete mode 100644 homedecor_common/.luacheckrc create mode 100644 homedecor_common/materials.lua diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 00000000..008b489f --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,39 @@ +unused_args = false + +globals = { + "homedecor", + "homedecor_lighting", + "homedecor_windows_and_treatments", + "homedecor_roofing", + "homedecor_misc", + "homedecor_exterior", + "homedecor_electrical", + "homedecor_cobweb", + "lavalamp", + "lrfurn", + "signs_lib", + + -- mod-deps + "armor" +} + +read_globals = { + "minetest", "core", + "vector", "ItemStack", + + -- Stdlib + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn"}}, + + -- mod-deps + "default", + "unifieddyes", + "player_api", + "screwdriver", + "hopper", + "mesecon", + "skins", + "homedecor_doors_and_gates", + "stairsplus", + "creative" +} \ No newline at end of file diff --git a/homedecor_3d_extras/.luacheckrc b/homedecor_3d_extras/.luacheckrc deleted file mode 100644 index f3a5fb28..00000000 --- a/homedecor_3d_extras/.luacheckrc +++ /dev/null @@ -1,18 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", -} - -globals = { -} - diff --git a/homedecor_3d_extras/init.lua b/homedecor_3d_extras/init.lua index 263573f2..50776547 100644 --- a/homedecor_3d_extras/init.lua +++ b/homedecor_3d_extras/init.lua @@ -1,14 +1,16 @@ -minetest.override_item("default:bookshelf", { - drawtype = "mesh", - mesh = "homedecor_3d_bookshelf.obj", - tiles = { - "default_wood.png", - "default_wood.png^homedecor_3d_bookshelf_inside_back.png", - "homedecor_3d_bookshelf_books.png", - }, - paramtype = "light", - paramtype2 = "facedir", -}) +if minetest.get_modpath("default") then + minetest.override_item("default:bookshelf", { + drawtype = "mesh", + mesh = "homedecor_3d_bookshelf.obj", + tiles = { + "default_wood.png", + "default_wood.png^homedecor_3d_bookshelf_inside_back.png", + "homedecor_3d_bookshelf_books.png", + }, + paramtype = "light", + paramtype2 = "facedir", + }) +end if minetest.get_modpath("vessels") then minetest.override_item("vessels:shelf", { diff --git a/homedecor_3d_extras/mod.conf b/homedecor_3d_extras/mod.conf index 4cfc7c1c..74535dcc 100644 --- a/homedecor_3d_extras/mod.conf +++ b/homedecor_3d_extras/mod.conf @@ -1,4 +1,3 @@ name = homedecor_3d_extras description = Homedecor Mod: 3d extras -depends = default -optional_depends = vessels, moreblocks, doors +optional_depends = vessels, moreblocks, doors, default diff --git a/homedecor_books/.luacheckrc b/homedecor_books/.luacheckrc deleted file mode 100644 index f729bf5a..00000000 --- a/homedecor_books/.luacheckrc +++ /dev/null @@ -1,21 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "creative", - "default", - "homedecor", -} - -globals = { -} - diff --git a/homedecor_books/init.lua b/homedecor_books/init.lua index 59ed57b4..a89ce2d7 100644 --- a/homedecor_books/init.lua +++ b/homedecor_books/init.lua @@ -97,7 +97,7 @@ for _, c in ipairs(bookcolors) do if data.title and data.title ~= "" then meta:set_string("infotext", data.title) end - if not creative.is_enabled_for(plname) then + if not minetest.is_creative_enabled(plname) then itemstack:take_item() end return itemstack @@ -128,16 +128,15 @@ for _, c in ipairs(bookcolors) do local owner = meta:get_string("owner") or "" local formspec if owner == "" or owner == player_name then - formspec = "size[8,8]"..default.gui_bg..default.gui_bg_img.. + formspec = "size[8,8]".. "field[0.5,1;7.5,0;title;Book title :;".. minetest.formspec_escape(title).."]".. "textarea[0.5,1.5;7.5,7;text;Book content :;".. minetest.formspec_escape(text).."]".. "button_exit[2.5,7.5;3,1;save;Save]" else - formspec = "size[8,8]"..default.gui_bg.. + formspec = "size[8,8]".. "button_exit[7,0.25;1,0.5;close;X]".. - default.gui_bg_img.. "label[0.5,0.5;by "..owner.."]".. "label[0.5,0;"..minetest.formspec_escape(title).."]".. "textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]" @@ -167,7 +166,7 @@ for _, c in ipairs(bookcolors) do output = "homedecor:book_"..color, recipe = { "dye:"..color, - "default:book" + homedecor.materials.book }, }) diff --git a/homedecor_books/mod.conf b/homedecor_books/mod.conf index 54d6c859..34be332b 100644 --- a/homedecor_books/mod.conf +++ b/homedecor_books/mod.conf @@ -1,4 +1,4 @@ name = homedecor_books description = Homedecor mod: books -depends = homedecor_common, default, creative -optional_depends = unifieddyes +depends = homedecor_common +optional_depends = unifieddyes, default, creative diff --git a/homedecor_climate_control/.luacheckrc b/homedecor_climate_control/.luacheckrc deleted file mode 100644 index 6718384e..00000000 --- a/homedecor_climate_control/.luacheckrc +++ /dev/null @@ -1,21 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "default", - "homedecor", - "screwdriver", -} - -globals = { -} - diff --git a/homedecor_climate_control/init.lua b/homedecor_climate_control/init.lua index 41834d28..66d29947 100644 --- a/homedecor_climate_control/init.lua +++ b/homedecor_climate_control/init.lua @@ -7,12 +7,30 @@ homedecor.register("air_conditioner", { mesh = "homedecor_ac.obj", tiles = { "homedecor_ac.png", - "default_glass.png" + homedecor.glass }, - groups = { snappy = 3 }, + groups = { snappy = 3, dig_stone = 3 }, use_texture_alpha = "clip", - sounds = default.node_sound_leaves_defaults(), + _sound_def = { + key = "node_sound_leaves_defaults", + }, selection_box = { type="regular" }, + crafts = { + { + recipe = { + { "steel_ingot", "building_blocks:grate", "steel_ingot" }, + { "steel_ingot", "homedecor:fan_blades", "basic_materials:motor" }, + { "steel_ingot", "basic_materials:motor", "steel_ingot" }, + }, + }, + { + recipe = { + { "steel_ingot", "building_blocks:grate", "steel_ingot" }, + { "steel_ingot", "basic_materials:motor", "steel_ingot" }, + { "steel_ingot", "basic_materials:motor", "steel_ingot" }, + }, + } + } }) -- fans @@ -75,6 +93,14 @@ homedecor.register("desk_fan", { local entities = minetest.get_objects_inside_radius(pos, 0.1) if entities[1] then entities[1]:remove() end end, + crafts = { + { + recipe = { + {"steel_ingot", "homedecor:fan_blades", "basic_materials:motor"}, + {"", "steel_ingot", ""} + }, + } + } }) -- ceiling fan @@ -97,9 +123,27 @@ homedecor.register("ceiling_fan", { } }, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-1, - sounds = default.node_sound_glass_defaults(), + groups = { snappy = 3, dig_stone = 3 }, + light_source = minetest.LIGHT_MAX-1, + _sound_def = { + key = "node_sound_glass_defaults", + }, + crafts = { + { + recipe = { + { "basic_materials:motor" }, + { "homedecor:fan_blades" }, + { "homedecor:glowlight_small_cube" } + } + }, + { + recipe = { + { "basic_materials:motor" }, + { "homedecor:fan_blades" }, + { "homedecor:glowlight_small_cube" } + } + } + } }) -- heating devices @@ -115,8 +159,10 @@ homedecor.register("space_heater", { }, inventory_image = "homedecor_heater_inv.png", walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_wood_defaults(), + groups = { snappy = 3, dig_stone = 3 }, + _sound_def = { + key = "node_sound_wood_defaults", + }, node_box = { type = "fixed", fixed = { @@ -126,6 +172,15 @@ homedecor.register("space_heater", { selection_box = { type = "fixed", fixed = {-0.1875, -0.5, 0.0625, 0.1875, 0, 0.3125} + }, + crafts = { + { + recipe = { + {"basic_materials:plastic_sheet", "basic_materials:heating_element", "basic_materials:plastic_sheet"}, + {"basic_materials:plastic_sheet", "homedecor:fan_blades", "basic_materials:motor"}, + {"basic_materials:plastic_sheet", "basic_materials:heating_element", "basic_materials:plastic_sheet"} + }, + } } }) @@ -138,10 +193,21 @@ homedecor.register("radiator", { }, inventory_image = "homedecor_radiator_inv.png", description = S("Radiator heater"), - groups = {snappy=3}, + groups = {snappy=3, dig_stone = 3}, selection_box = r_cbox, collision_box = r_cbox, - sounds = default.node_sound_wood_defaults(), + _sound_def = { + key = "node_sound_wood_defaults", + }, + crafts = { + { + recipe = { + { "steel_ingot", "basic_materials:heating_element", "steel_ingot" }, + { "basic_materials:ic", "basic_materials:heating_element", "" }, + { "steel_ingot", "basic_materials:heating_element", "steel_ingot" } + }, + } + } }) -- crafting @@ -154,70 +220,7 @@ minetest.register_craft( { output = "homedecor:fan_blades 2", recipe = { { "", "basic_materials:plastic_sheet", "" }, - { "", "default:steel_ingot", "" }, + { "", homedecor.materials.steel_ingot, "" }, { "basic_materials:plastic_sheet", "", "basic_materials:plastic_sheet" } }, }) - -minetest.register_craft({ - output = "homedecor:air_conditioner", - recipe = { - { "default:steel_ingot", "building_blocks:grate", "default:steel_ingot" }, - { "default:steel_ingot", "homedecor:fan_blades", "basic_materials:motor" }, - { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:air_conditioner", - recipe = { - { "default:steel_ingot", "building_blocks:grate", "default:steel_ingot" }, - { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" }, - { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:ceiling_fan", - recipe = { - { "basic_materials:motor" }, - { "homedecor:fan_blades" }, - { "homedecor:glowlight_small_cube" } - } -}) - -minetest.register_craft({ - output = "homedecor:ceiling_fan", - recipe = { - { "basic_materials:motor" }, - { "homedecor:fan_blades" }, - { "homedecor:glowlight_small_cube" } - } -}) - - -minetest.register_craft( { - output = "homedecor:desk_fan", - recipe = { - {"default:steel_ingot", "homedecor:fan_blades", "basic_materials:motor"}, - {"", "default:steel_ingot", ""} - }, -}) - -minetest.register_craft( { - output = "homedecor:space_heater", - recipe = { - {"basic_materials:plastic_sheet", "basic_materials:heating_element", "basic_materials:plastic_sheet"}, - {"basic_materials:plastic_sheet", "homedecor:fan_blades", "basic_materials:motor"}, - {"basic_materials:plastic_sheet", "basic_materials:heating_element", "basic_materials:plastic_sheet"} - }, -}) - -minetest.register_craft( { - output = "homedecor:radiator", - recipe = { - { "default:steel_ingot", "basic_materials:heating_element", "default:steel_ingot" }, - { "basic_materials:ic", "basic_materials:heating_element", "" }, - { "default:steel_ingot", "basic_materials:heating_element", "default:steel_ingot" } - }, -}) diff --git a/homedecor_climate_control/mod.conf b/homedecor_climate_control/mod.conf index 889b90f4..97c75f6a 100644 --- a/homedecor_climate_control/mod.conf +++ b/homedecor_climate_control/mod.conf @@ -1,4 +1,4 @@ name = homedecor_climate_control description = Homedecor mod: climate control -depends = homedecor_common, default, basic_materials -optional_depends = building_blocks, screwdriver +depends = homedecor_common +optional_depends = building_blocks, screwdriver, default diff --git a/homedecor_clocks/.luacheckrc b/homedecor_clocks/.luacheckrc deleted file mode 100644 index 6718384e..00000000 --- a/homedecor_clocks/.luacheckrc +++ /dev/null @@ -1,21 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "default", - "homedecor", - "screwdriver", -} - -globals = { -} - diff --git a/homedecor_clocks/init.lua b/homedecor_clocks/init.lua index 9474d1f2..4e800851 100644 --- a/homedecor_clocks/init.lua +++ b/homedecor_clocks/init.lua @@ -1,18 +1,43 @@ - local S = minetest.get_translator("homedecor_clocks") +local wood +if minetest.get_modpath("default") then + wood = "default_wood.png" +else + + wood = "[combine:16x16^[noalpha^[colorize:#563d2d" +end + +local plastic_craft = { + output = "homedecor:analog_clock_plastic 2", + recipe = { + { "basic_materials:plastic_sheet", "dye_black", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "dye_black", "basic_materials:plastic_sheet" }, + }, +} + +local wood_craft = { + output = "homedecor:analog_clock_wood 2", + recipe = { + { "group:stick", "dye_black", "group:stick" }, + { "group:stick", "basic_materials:ic", "group:stick" }, + { "group:stick", "dye_black", "group:stick" }, + }, +} + local clock_sbox = { type = "fixed", fixed = { -8/32, -8/32, 14/32, 8/32, 8/32, 16/32 } } local clock_materials = { - { "plastic", S("Plastic analog clock"), "homedecor_generic_plastic.png" }, - { "wood", S("Wooden analog clock"), "default_wood.png" } + {"plastic", S("Plastic analog clock"), "homedecor_generic_plastic.png", plastic_craft}, + {"wood", S("Wooden analog clock"), wood, wood_craft} } for _, mat in ipairs(clock_materials) do - local name, desc, tex = unpack(mat) + local name, desc, tex, craft = unpack(mat) homedecor.register("analog_clock_"..name, { description = desc, mesh = "homedecor_analog_clock.obj", @@ -24,8 +49,13 @@ for _, mat in ipairs(clock_materials) do inventory_image = "homedecor_analog_clock_"..name.."_inv.png", walkable = false, selection_box = clock_sbox, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), + groups = {snappy=3, dig_tree=2}, + _sound_def = { + key = "node_sound_wood_defaults", + }, + crafts = { + craft + } }) end @@ -47,8 +77,20 @@ homedecor.register("digital_clock", { } }, walkable = false, - sounds = default.node_sound_wood_defaults(), - groups = {snappy=3}, + _sound_def = { + key = "node_sound_wood_defaults", + }, + groups = {snappy=3, dig_tree=2}, + crafts = { + { + output = "homedecor:digital_clock 2", + recipe = { + { "basic_materials:plastic_sheet", "paper", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" }, + }, + } + } }) homedecor.register("alarm_clock", { @@ -69,8 +111,19 @@ homedecor.register("alarm_clock", { } }, walkable = false, - sounds = default.node_sound_wood_defaults(), - groups = {snappy=3}, + _sound_def = { + key = "node_sound_wood_defaults", + }, + groups = {snappy=3, dig_tree=2}, + crafts = { + { + recipe = { + { "basic_materials:plastic_sheet", "homedecor:speaker_driver", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "homedecor:digital_clock", "basic_materials:plastic_sheet" }, + { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" }, + }, + } + } }) local gf_cbox = { @@ -82,7 +135,7 @@ homedecor.register("grandfather_clock", { description = S("Grandfather Clock"), mesh = "homedecor_grandfather_clock.obj", tiles = { - "default_glass.png", + homedecor.glass, "homedecor_grandfather_clock_face.png", homedecor.lux_wood, "homedecor_grandfather_clock_face_edge.png", @@ -90,60 +143,23 @@ homedecor.register("grandfather_clock", { }, use_texture_alpha = "clip", inventory_image = "homedecor_grandfather_clock_inv.png", - groups = { snappy = 3 }, + groups = {snappy = 3, dig_tree=2}, selection_box = gf_cbox, collision_box = gf_cbox, - sounds = default.node_sound_wood_defaults(), + _sound_def = { + key = "node_sound_wood_defaults", + }, expand = { top="placeholder" }, on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil, -}) - --- crafting - - -minetest.register_craft({ - output = "homedecor:analog_clock_plastic 2", - recipe = { - { "basic_materials:plastic_sheet", "dye:black", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "dye:black", "basic_materials:plastic_sheet" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:analog_clock_wood 2", - recipe = { - { "group:stick", "dye:black", "group:stick" }, - { "group:stick", "basic_materials:ic", "group:stick" }, - { "group:stick", "dye:black", "group:stick" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:digital_clock 2", - recipe = { - { "basic_materials:plastic_sheet", "default:paper", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "basic_materials:ic", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:alarm_clock", - recipe = { - { "basic_materials:plastic_sheet", "homedecor:speaker_driver", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "homedecor:digital_clock", "basic_materials:plastic_sheet" }, - { "basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet" }, - }, -}) - -minetest.register_craft({ - output = "homedecor:grandfather_clock", - recipe = { - { "building_blocks:slab_hardwood","homedecor:analog_clock_wood","building_blocks:slab_hardwood" }, - { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" }, - { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" } - }, + crafts = { + { + recipe = { + { "building_blocks:slab_hardwood","homedecor:analog_clock_wood","building_blocks:slab_hardwood" }, + { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" }, + { "building_blocks:slab_hardwood","basic_materials:brass_ingot","building_blocks:slab_hardwood" } + }, + } + } }) -- aliases diff --git a/homedecor_clocks/mod.conf b/homedecor_clocks/mod.conf index f82affd4..9ebf87d7 100644 --- a/homedecor_clocks/mod.conf +++ b/homedecor_clocks/mod.conf @@ -1,4 +1,4 @@ name = homedecor_clocks description = Homedecor mod: clocks -depends = homedecor_common, default, basic_materials, dye -optional_depends = building_blocks, screwdriver +depends = homedecor_common +optional_depends = building_blocks, screwdriver, default, basic_materials, dye diff --git a/homedecor_cobweb/.luacheckrc b/homedecor_cobweb/.luacheckrc deleted file mode 100644 index f3a5fb28..00000000 --- a/homedecor_cobweb/.luacheckrc +++ /dev/null @@ -1,18 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", -} - -globals = { -} - diff --git a/homedecor_cobweb/init.lua b/homedecor_cobweb/init.lua index 0e5b8fc2..ad8a9331 100644 --- a/homedecor_cobweb/init.lua +++ b/homedecor_cobweb/init.lua @@ -1,7 +1,7 @@ local S = minetest.get_translator("homedecor_cobweb") homedecor_cobweb = {} -minetest.register_node(":homedecor:cobweb_corner", { +homedecor.register("cobweb_corner", { description = S("Cobweb"), drawtype = "torchlike", tiles = { "homedecor_cobweb_torchlike.png" }, @@ -19,13 +19,23 @@ minetest.register_node(":homedecor:cobweb_corner", { walkable = false, selection_box = { type = "regular" }, visual_scale = 1.4, - groups = { snappy = 3, liquid=3 }, + groups = { snappy = 3, liquid=3, dig_glass = 1 }, after_place_node = function(pos, placer, itemstack, pointed_thing) homedecor_cobweb.rotate(pos) - end + end, + crafts = { + { + output = "homedecor:cobweb_corner 5", + recipe = { + {"string", "", "string"}, + {"", "string", ""}, + {"string", "", "string"} + }, + } + } }) -minetest.register_node(":homedecor:cobweb_centered", { +homedecor.register("cobweb_centered", { description = S("Cobweb"), drawtype = "nodebox", tiles = { "homedecor_cobweb.png" }, @@ -49,11 +59,11 @@ minetest.register_node(":homedecor:cobweb_centered", { type = "fixed", fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0 } }, - groups = { snappy = 3, liquid=3, not_in_creative_inventory = 1 }, + groups = { snappy = 3, liquid=3, dig_glass = 1, not_in_creative_inventory = 1 }, drop = "homedecor:cobweb_corner" }) -minetest.register_node(":homedecor:cobweb_flat", { +homedecor.register("cobweb_flat", { description = S("Cobweb"), drawtype = "nodebox", tiles = { "homedecor_cobweb.png" }, @@ -77,11 +87,11 @@ minetest.register_node(":homedecor:cobweb_flat", { type = "fixed", fixed = { -0.5, -0.5, 0.495, 0.5, 0.5, 0.495 } }, - groups = { snappy = 3, liquid=3, not_in_creative_inventory = 1 }, + groups = { snappy = 3, liquid=3, dig_glass = 1, not_in_creative_inventory = 1 }, drop = "homedecor:cobweb_corner" }) -minetest.register_node(":homedecor:cobweb_plantlike", { +homedecor.register("cobweb_plantlike", { description = S("Cobweb"), drawtype = "plantlike", tiles = { "homedecor_cobweb_plantlike.png" }, @@ -98,7 +108,7 @@ minetest.register_node(":homedecor:cobweb_plantlike", { walkable = false, selection_box = { type = "regular" }, visual_scale = 1.189, - groups = { snappy = 3, liquid=3, not_in_creative_inventory = 1 }, + groups = { snappy = 3, liquid=3, dig_glass = 1, not_in_creative_inventory = 1 }, drop = "homedecor:cobweb_corner" }) @@ -159,14 +169,3 @@ function homedecor_cobweb.rotate(pos) end end - --- crafting - -minetest.register_craft( { - output = "homedecor:cobweb_corner 5", - recipe = { - { "farming:string", "", "farming:string" }, - { "", "farming:string", "" }, - { "farming:string", "", "farming:string" } - }, -}) diff --git a/homedecor_cobweb/mod.conf b/homedecor_cobweb/mod.conf index d80cd394..e8e0360e 100644 --- a/homedecor_cobweb/mod.conf +++ b/homedecor_cobweb/mod.conf @@ -1,3 +1,4 @@ name = homedecor_cobweb description = Homedecor mod: cobweb -depends = homedecor_common, default +depends = homedecor_common +optional_depends = default diff --git a/homedecor_common/.luacheckrc b/homedecor_common/.luacheckrc deleted file mode 100644 index ef788aab..00000000 --- a/homedecor_common/.luacheckrc +++ /dev/null @@ -1,21 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "creative", - "default", - "screwdriver", -} - -globals = { -} - diff --git a/homedecor_common/expansion.lua b/homedecor_common/expansion.lua index 037d09b6..05a989b5 100644 --- a/homedecor_common/expansion.lua +++ b/homedecor_common/expansion.lua @@ -103,7 +103,7 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2, poin ctrl_node_def.after_place_node(pos, placer, itemstack, pointed_thing) end - if not creative.is_enabled_for(placer_name) then + if not minetest.is_creative_enabled(placer_name) then itemstack:take_item() end end @@ -133,7 +133,8 @@ function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, nod end -- Stack one door node above another --- like homedecor.stack_vertically but tests first if it was placed as a right wing, then uses node1_right and node2_right instead +-- like homedecor.stack_vertically but tests first if it was placed as a right wing, +-- then uses node1_right and node2_right instead function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, node1_right, node2_right) local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing) @@ -230,8 +231,9 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then local newname = string.gsub(thisnode.name, "_regular", "_extended") - local newparam2 = param2 % 8 - -- FIXME: is newparam2 a legacy unused variable from a8729575abfbd15cc622b413b71976c9157fbab4? or should this variable be used somewhere? + -- local newparam2 = param2 % 8 + -- FIXME: is newparam2 a legacy unused variable from a8729575abfbd15cc622b413b71976c9157fbab4? + -- or should this variable be used somewhere? minetest.swap_node(toppos, { name = thisnode.name, param2 = param2}) minetest.swap_node(pos, { name = newname, param2 = param2}) itemstack:take_item() diff --git a/homedecor_common/init.lua b/homedecor_common/init.lua index f03078ca..cf53f2ff 100644 --- a/homedecor_common/init.lua +++ b/homedecor_common/init.lua @@ -54,6 +54,16 @@ homedecor.mahogany_wood = { name = "homedecor_generic_wood_plain.png", color = homedecor.white_wood = "homedecor_generic_wood_plain.png" homedecor.dark_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff39240f } homedecor.lux_wood = { name = "homedecor_generic_wood_luxury.png", color = 0xff643f23 } +homedecor.glass = "default_glass.png" + +if not minetest.get_modpath("default") then + homedecor.glass = + "[combine:16x16:" .. + "0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" .. + "0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" .. + "0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" .. + "15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff" +end homedecor.color_black = 0xff303030 homedecor.color_dark_grey = 0xff606060 @@ -64,6 +74,7 @@ dofile(modpath.."/nodeboxes.lua") dofile(modpath.."/expansion.lua") dofile(modpath.."/furnaces.lua") dofile(modpath.."/inventory.lua") +dofile(modpath.."/materials.lua") dofile(modpath.."/registration.lua") dofile(modpath.."/water_particles.lua") dofile(modpath.."/sit.lua") diff --git a/homedecor_common/inventory.lua b/homedecor_common/inventory.lua index 94956c68..30d9172e 100644 --- a/homedecor_common/inventory.lua +++ b/homedecor_common/inventory.lua @@ -12,47 +12,46 @@ local default_can_dig = function(pos,player) return meta:get_inventory():is_empty("main") end -local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots + local default_inventory_formspecs = { - ["4"]="size[8,6]".. background .. + ["4"]="size[8,6]".. "list[context;main;2,0;4,1;]" .. "list[current_player;main;0,2;8,4;]" .. "listring[]", - ["6"]="size[8,6]".. background .. + ["6"]="size[8,6]".. "list[context;main;1,0;6,1;]".. "list[current_player;main;0,2;8,4;]" .. "listring[]", - ["8"]="size[8,6]".. background .. + ["8"]="size[8,6]".. "list[context;main;0,0;8,1;]".. "list[current_player;main;0,2;8,4;]" .. "listring[]", - ["12"]="size[8,7]".. background .. + ["12"]="size[8,7]".. "list[context;main;1,0;6,2;]".. "list[current_player;main;0,3;8,4;]" .. "listring[]", - ["16"]="size[8,7]".. background .. + ["16"]="size[8,7]".. "list[context;main;0,0;8,2;]".. "list[current_player;main;0,3;8,4;]" .. "listring[]", - ["24"]="size[8,8]".. background .. + ["24"]="size[8,8]".. "list[context;main;0,0;8,3;]".. "list[current_player;main;0,4;8,4;]" .. "listring[]", - ["32"]="size[8,9]".. background .. + ["32"]="size[8,9]".. "list[context;main;0,0.3;8,4;]".. "list[current_player;main;0,4.85;8,1;]".. "list[current_player;main;0,6.08;8,3;8]".. "listring[context;main]" .. - "listring[current_player;main]" .. - default.get_hotbar_bg(0,4.85), + "listring[current_player;main]", - ["50"]="size[10,10]".. background .. + ["50"]="size[10,10]".. "list[context;main;0,0;10,5;]".. "list[current_player;main;1,6;8,4;]" .. "listring[]", diff --git a/homedecor_common/materials.lua b/homedecor_common/materials.lua new file mode 100644 index 00000000..3ba681f6 --- /dev/null +++ b/homedecor_common/materials.lua @@ -0,0 +1,101 @@ +homedecor.materials = { + dirt = "default:dirt", + sand = "default:sand", + gravel = "default:gravel", + copper_ingot = "default:copper_ingot", + steel_ingot = "default:steel_ingot", + gold_ingot = "default:gold_ingot", + tin_ingot = "default:tin_ingot", + mese_crystal_fragment = "default:mese_crystal_fragment", + torch = "default:torch", + diamond = "default:diamond", + clay_lump = "default:clay_lump", + water_bucket = "bucket:bucket_water", + empty_bucket = "bucket:bucket_empty", + dye_dark_grey = "dye:dark_grey", + dye_black = "dye:black", + silicon = "mesecons_materials:silicon", + string = "farming:string", + paper = "default:paper", + book = "default:book", +} + +if minetest.get_modpath("moreores") then + homedecor.materials.silver_ingot = "moreores:silver_ingot" +end + +if minetest.get_modpath("mcl_core") then + homedecor.materials = { + dirt = "mcl_core:dirt", + sand = "mcl_core:sand", + gravel = "mcl_core:gravel", + steel_ingot = "mcl_core:iron_ingot", + gold_ingot = "mcl_core:gold_ingot", + mese_crystal_fragment = "mesecons:redstone", + torch = "mcl_torches:torch", + diamond = "mcl_core:diamond", + clay_lump = "mcl_core:clay_lump", + water_bucket = "mcl_buckets:bucket_water", + empty_bucket = "mcl_buckets:bucket_empty", + dye_dark_grey = "mcl_dye:dark_grey", + -- Use iron where no equivalent + copper_ingot = "mcl_core:iron_ingot", + tin_ingot = "mcl_core:iron_ingot", + silver_ingot = "mcl_core:iron_ingot", + silicon = "mesecons_materials:silicon", + } +elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then + homedecor.materials = { + dirt = "fl_topsoil:dirt", + sand = "fl_stone:sand", + gravel = "fl_topsoil:gravel", + steel_ingot = "fl_ores:iron_ingot", + gold_ingot = "fl_ores:gold_ingot", + mese_crystal_fragment = "fl_ores:iron_ingot", + torch = "fl_light_sources:torch", + diamond = "fl_ores:diamond", + clay_lump = "fl_bricks:clay_lump", + water_bucket = "fl_bucket:bucket_water", + empty_bucket = "fl_bucket:bucket", + dye_dark_grey = "fl_dyes:dark_grey_dye", + dye_black = "fl_dyes:black_dye", + copper_ingot = "fl_ores:copper_ingot", + tin_ingot = "fl_ores:tin_ingot", + silver_ingot = "fl_ores:iron_ingot", + silicon = "mesecons_materials:silicon", + string = "fl_plantlife:oxeye_daisy", + paper = "basic_materials:plastic_sheet", + } +elseif minetest.get_modpath("hades_core") then + homedecor.materials = { + dirt = "hades_core:dirt", + sand = "hades_core:fertile_sand", + gravel = "hades_core:gravel", + steel_ingot = "hades_core:steel_ingot", + gold_ingot = "hades_core:gold_ingot", + mese_crystal_fragment = "hades_core:mese_crystal_fragment", + torch = "hades_torches:torch", + diamond = "hades_core:diamond", + clay_lump = "hades_core:clay_lump", + dye_dark_grey = "dye:dark_grey", + copper_ingot = "hades_core:copper_ingot", + tin_ingot = "hades_core:tin_ingot", + --[[ + Since hades doesnt have buckets or water for the user, + using dirt from near water to pull the water out + ]] + water_bucket = "hades_core:dirt", + empty_bucket = "hades_core:fertile_sand", + -- Set this to steel unless hadesextraores is present + silver_ingot = "hades_core:steel_ingot", + silicon = "hades_materials:silicon", + } + + if minetest.get_modpath("hades_bucket") then + homedecor.materials["water_bucket"] = "hades_bucket:bucket_water" + homedecor.materials["empty_bucket"] = "hades_bucket:bucket_empty" + end + if minetest.get_modpath("hades_extraores") then + homedecor.materials["silver_ingot"] = "hades_extraores:silver_ingot" + end +end \ No newline at end of file diff --git a/homedecor_common/mod.conf b/homedecor_common/mod.conf index 1a62348c..c31a6975 100644 --- a/homedecor_common/mod.conf +++ b/homedecor_common/mod.conf @@ -1,4 +1,4 @@ name = homedecor_common description = Homedecor mod: common -depends = default, creative -optional_depends = screwdriver, hopper +depends = basic_materials +optional_depends = screwdriver, hopper, default, creative, sound_api diff --git a/homedecor_common/nodeboxes.lua b/homedecor_common/nodeboxes.lua index 6960072b..f9150880 100644 --- a/homedecor_common/nodeboxes.lua +++ b/homedecor_common/nodeboxes.lua @@ -10,7 +10,7 @@ homedecor.box = { slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end, -- slab starting from -z (+z with negative depth) slab_z = function(depth, shift) - -- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth, + -- for consistency with the other functions here, we have to assume that a z slab starts from -z and extends by depth, -- but since conventionally a lot of nodes place slabs against +z for player convenience, we define -- a "negative" depth as a depth extending from the other side, i.e. +z local s = shift or 0 diff --git a/homedecor_common/registration.lua b/homedecor_common/registration.lua index 04f5ab38..cf87c709 100644 --- a/homedecor_common/registration.lua +++ b/homedecor_common/registration.lua @@ -46,9 +46,9 @@ function homedecor.register(name, original_def) if expand then -- dissallow rotating only half the expanded node by default -- unless we know better - def.on_rotate = def.on_rotate - or (minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple) - or screwdriver.disallow) or nil + def.on_rotate = def.on_rotate or + (minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple) or + minetest.get_modpath("screwdriver") and screwdriver.disallow) or nil def.on_place = def.on_place or function(itemstack, placer, pointed_thing) if expand.top then @@ -96,6 +96,31 @@ function homedecor.register(name, original_def) end end + local crafts = def.crafts and table.copy(def.crafts) or {} + def.crafts = nil + -- register the actual minetest node minetest.register_node(":homedecor:" .. name, def) + + for _, cdef in pairs(crafts) do + if cdef.recipe then + for k, row in pairs(cdef.recipe) do + if type(row) == "string" and homedecor.materials[row] then + cdef.recipe[k] = homedecor.materials[row] + elseif type(row) == "table" then + for i, item in pairs(row) do + if homedecor.materials[item] then + cdef.recipe[k][i] = homedecor.materials[item] + end + end + end + end + end + + if cdef.type ~= "toolrepair" and not cdef.output then + cdef.output = ":homedecor:" .. name + end + + minetest.register_craft(cdef) + end end