From c62257ccbf95937c8534ccb7516d2626d457f30d Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 23 Apr 2022 21:42:09 -0400 Subject: [PATCH] add building blocks --- building_blocks/.luacheckrc | 21 ------ building_blocks/alias.lua | 6 +- building_blocks/mod.conf | 4 +- building_blocks/node_stairs.lua | 109 ++++++++++++++++++++------------ building_blocks/recipes.lua | 64 ++++++++++--------- homedecor_common/materials.lua | 6 +- 6 files changed, 112 insertions(+), 98 deletions(-) delete mode 100644 building_blocks/.luacheckrc diff --git a/building_blocks/.luacheckrc b/building_blocks/.luacheckrc deleted file mode 100644 index 69e608c5..00000000 --- a/building_blocks/.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", - "stairsplus", - "default", - "stairs", -} - -globals = { -} - diff --git a/building_blocks/alias.lua b/building_blocks/alias.lua index 065f7405..d796a88d 100644 --- a/building_blocks/alias.lua +++ b/building_blocks/alias.lua @@ -40,8 +40,10 @@ if not minetest.get_modpath("technic") then description = S("Granite"), tiles = { "technic_granite.png" }, is_ground_content = true, - groups = {cracky=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=1, dig_stone=2}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) minetest.register_craft({ output = "technic:granite 9", diff --git a/building_blocks/mod.conf b/building_blocks/mod.conf index 146d5ef6..81ae801c 100644 --- a/building_blocks/mod.conf +++ b/building_blocks/mod.conf @@ -1,3 +1,3 @@ name = building_blocks -depends = default -optional_depends = moreblocks, gloopblocks, stairs +depends = homedecor_common +optional_depends = moreblocks, gloopblocks, stairs, default diff --git a/building_blocks/node_stairs.lua b/building_blocks/node_stairs.lua index 07cbe223..41059212 100644 --- a/building_blocks/node_stairs.lua +++ b/building_blocks/node_stairs.lua @@ -21,8 +21,10 @@ building_blocks_stairs("building_blocks:grate", { sunlight_propagates = true, is_ground_content = true, use_texture_alpha = "clip", - groups = {cracky=1}, - sounds = default.node_sound_metal_defaults(), + groups = {cracky=1, dig_generic=3}, + _sound_def = { + key = "node_sound_metal_defaults", + }, }) building_blocks_stairs("building_blocks:smoothglass", { drawtype = "glasslike", @@ -33,7 +35,9 @@ building_blocks_stairs("building_blocks:smoothglass", { is_ground_content = true, use_texture_alpha = "clip", groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, }) building_blocks_stairs("building_blocks:woodglass", { drawtype = "glasslike", @@ -44,52 +48,68 @@ building_blocks_stairs("building_blocks:woodglass", { is_ground_content = true, use_texture_alpha = "clip", groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, }) building_blocks_stairs("building_blocks:Adobe", { tiles = {"building_blocks_Adobe.png"}, description = S("Adobe"), is_ground_content = true, - groups = {crumbly=3}, - sounds = default.node_sound_stone_defaults(), + groups = {crumbly=3, dig_stone=2}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) +local grasstex = {"[combine:16x16^[noalpha^[colorize:#006400"} +if minetest.get_modpath("default") then + grasstex = minetest.registered_nodes["default:dirt_with_grass"].tiles +end building_blocks_stairs("building_blocks:fakegrass", { - tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + tiles = grasstex, description = S("Fake Grass"), is_ground_content = true, - groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_grass_footstep", gain=0.4}, - }), + groups = {crumbly=3, dig_sand=3}, + _sound_def = { + key = "node_sound_dirt_defaults", + }, }) building_blocks_stairs("building_blocks:hardwood", { tiles = {"building_blocks_hardwood.png"}, is_ground_content = true, description = S("Hardwood"), - groups = {choppy=1,flammable=1}, - sounds = default.node_sound_wood_defaults(), + groups = {choppy=1,flammable=1, dig_tree=1}, + _sound_def = { + key = "node_sound_wood_defaults", + }, }) building_blocks_stairs("building_blocks:Roofing", { tiles = {"building_blocks_Roofing.png"}, is_ground_content = true, description = S("Roof block"), - groups = {snappy=3}, - sounds = default.node_sound_stone_defaults(), + groups = {snappy=3, dig_generic=4}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) building_blocks_stairs("building_blocks:Tar", { description = S("Tar"), tiles = {"building_blocks_tar.png"}, is_ground_content = true, - groups = {crumbly=1, tar_block = 1}, - sounds = default.node_sound_stone_defaults(), + groups = {crumbly=1, tar_block = 1, dig_generic=4}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) building_blocks_stairs("building_blocks:Marble", { description = S("Marble"), tiles = {"building_blocks_marble.png"}, is_ground_content = true, - groups = {cracky=3, marble = 1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, marble = 1, dig_stone=2}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) minetest.register_node("building_blocks:brobble_spread", { @@ -103,34 +123,37 @@ minetest.register_node("building_blocks:brobble_spread", { walkable = false, selection_box = { type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, sunlight_propagates = true, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, dig_generic=4}, }) if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopblocks") then + local graveltex = "[combine:16x16^[noalpha^[colorize:#3a3b3c" + if minetest.get_modpath("default") then + graveltex = "default_gravel.png" + end minetest.register_node("building_blocks:gravel_spread", { drawtype = "raillike", description = S("Gravel Spread"), - tiles = {"default_gravel.png"}, + tiles = {graveltex}, inventory_image = "building_blocks_gravel_spread_inv.png", paramtype = "light", walkable = false, selection_box = { type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, sunlight_propagates = true, is_ground_content = true, - groups = {crumbly=2}, - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_gravel_footstep", gain=0.5}, - dug = {name="default_gravel_footstep", gain=1.0}, - }), + groups = {crumbly=2, dig_generic=4}, + _sound_def = { + key = "node_sound_dirt_defaults", + }, }) end @@ -143,13 +166,15 @@ minetest.register_node("building_blocks:Tarmac_spread", { walkable = false, selection_box = { type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, sunlight_propagates = true, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_dirt_defaults(), + groups = {cracky=3, dig_generic=4}, + _sound_def = { + key = "node_sound_dirt_defaults", + }, }) minetest.register_node("building_blocks:terrycloth_towel", { drawtype = "raillike", @@ -160,12 +185,12 @@ minetest.register_node("building_blocks:terrycloth_towel", { walkable = false, selection_box = { type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, sunlight_propagates = true, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, dig_generic=4}, }) minetest.register_node("building_blocks:BWtile", { @@ -188,7 +213,7 @@ minetest.register_node("building_blocks:BWtile", { }, sunlight_propagates = true, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, dig_generic=4}, }) minetest.register_node("building_blocks:Fireplace", { @@ -201,9 +226,11 @@ minetest.register_node("building_blocks:Fireplace", { }, paramtype = "light", paramtype2 = "facedir", - light_source = default.LIGHT_MAX, + light_source = minetest.LIGHT_MAX, sunlight_propagates = true, is_ground_content = true, - groups = {cracky=2}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=2, dig_generic=4}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) diff --git a/building_blocks/recipes.lua b/building_blocks/recipes.lua index e0d601fc..862c9bdd 100644 --- a/building_blocks/recipes.lua +++ b/building_blocks/recipes.lua @@ -20,15 +20,15 @@ end minetest.register_craft({ output = 'building_blocks:Adobe 3', recipe = { - {"default:sand"}, - {"default:clay"}, + {homedecor.materials.sand}, + {homedecor.materials.clay_lump}, {"group:stick"}, } }) minetest.register_craft({ output = 'building_blocks:brobble_spread 4', recipe = { - {"default:brick", "default:cobble", "default:brick"}, + {homedecor.materials.brick, homedecor.materials.cobble, homedecor.materials.brick}, } }) minetest.register_craft({ @@ -42,20 +42,20 @@ minetest.register_craft({ output = 'building_blocks:fakegrass 2', recipe = { {'group:leaves'}, - {"default:dirt"}, + {homedecor.materials.dirt}, } }) minetest.register_craft({ output = 'building_blocks:Fireplace 1', recipe = { - {"default:steel_ingot", "building_blocks:sticks", "default:steel_ingot"}, + {homedecor.materials.steel_ingot, "building_blocks:sticks", homedecor.materials.steel_ingot}, } }) minetest.register_craft({ output = 'building_blocks:grate 1', recipe = { - {"default:steel_ingot", "default:steel_ingot"}, - {"default:glass", "default:glass"}, + {homedecor.materials.steel_ingot, homedecor.materials.steel_ingot}, + {homedecor.materials.glass_block, homedecor.materials.glass_block}, } }) @@ -63,25 +63,27 @@ if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopbloc minetest.register_craft({ output = 'building_blocks:gravel_spread 4', recipe = { - {"default:gravel", "default:gravel", "default:gravel"}, + {homedecor.materials.gravel, homedecor.materials.gravel, homedecor.materials.gravel}, } }) end -minetest.register_craft({ - output = 'building_blocks:hardwood 2', - recipe = { - {"default:wood", "default:junglewood"}, - {"default:junglewood", "default:wood"}, - } -}) -minetest.register_craft({ - output = 'building_blocks:hardwood 2', - recipe = { - {"default:junglewood", "default:wood"}, - {"default:wood", "default:junglewood"}, - } -}) +if minetest.get_modpath("default") then + minetest.register_craft({ + output = 'building_blocks:hardwood 2', + recipe = { + {"default:wood", "default:junglewood"}, + {"default:junglewood", "default:wood"}, + } + }) + minetest.register_craft({ + output = 'building_blocks:hardwood 2', + recipe = { + {"default:junglewood", "default:wood"}, + {"default:wood", "default:junglewood"}, + } + }) +end minetest.register_craft({ output = 'building_blocks:knife 1', recipe = { @@ -92,9 +94,9 @@ minetest.register_craft({ minetest.register_craft({ output = "building_blocks:Marble 9", recipe = { - {"default:clay", "group:tar_block", "default:clay"}, - {"group:tar_block","default:clay", "group:tar_block"}, - {"default:clay", "group:tar_block","default:clay"}, + {homedecor.materials.clay_lump, "group:tar_block", homedecor.materials.clay_lump}, + {"group:tar_block",homedecor.materials.clay_lump, "group:tar_block"}, + {homedecor.materials.clay_lump, "group:tar_block",homedecor.materials.clay_lump}, } }) minetest.register_craft({ @@ -113,15 +115,15 @@ minetest.register_craft({ minetest.register_craft({ output = 'building_blocks:tar_base 4', recipe = { - {"default:coal_lump", "default:gravel"}, - {"default:gravel", "default:coal_lump"} + {homedecor.materials.coal_lump, homedecor.materials.gravel}, + {homedecor.materials.gravel, homedecor.materials.coal_lump} } }) minetest.register_craft({ output = 'building_blocks:tar_base 4', recipe = { - {"default:gravel", "default:coal_lump"}, - {"default:coal_lump", "default:gravel"} + {homedecor.materials.gravel, homedecor.materials.coal_lump}, + {homedecor.materials.coal_lump, homedecor.materials.gravel} } }) minetest.register_craft({ @@ -140,14 +142,14 @@ minetest.register_craft({ output = 'building_blocks:woodglass 1', recipe = { {"group:wood"}, - {"default:glass"}, + {homedecor.materials.glass_block}, } }) minetest.register_craft({ type = "cooking", output = "building_blocks:smoothglass", - recipe = "default:glass" + recipe = homedecor.materials.glass_block }) minetest.register_craft({ type = "cooking", diff --git a/homedecor_common/materials.lua b/homedecor_common/materials.lua index 0c7951d9..15ed2722 100644 --- a/homedecor_common/materials.lua +++ b/homedecor_common/materials.lua @@ -41,6 +41,8 @@ homedecor.materials = { glass_block = "default_glass", glass_bottle = "vessels:glass_bottle", coal_lump = "default:coal_lump", + cobble = "default:cobble", + brick = "default:brick", } if minetest.get_modpath("moreores") then @@ -110,7 +112,9 @@ elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then slab_wood = "fl_trees:apple_plank_slab", glass_block = "fl_glass:framed_glass", glass_bottle = "fl_bottles:bottle", - coal_lump = "fl_ores:coal_ore" + coal_lump = "fl_ores:coal_ore", + cobble = "fl_stone:stone_rubble", + brick = "", } elseif minetest.get_modpath("hades_core") then homedecor.materials = {