From 570caf47eb813138e02d591d79385a7f12361b45 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sat, 16 Sep 2023 22:57:15 +0200 Subject: [PATCH 1/5] All wood-type and nether-type fences now match material's blast resistance --- mods/ITEMS/mcl_bamboo/bamboo_items.lua | 21 +++++++++++++++++---- mods/ITEMS/mcl_cherry_blossom/nodes.lua | 13 ++++++++++--- mods/ITEMS/mcl_fences/init.lua | 21 +++++++++++++++++++-- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_items.lua b/mods/ITEMS/mcl_bamboo/bamboo_items.lua index 412ec92cb..95d4999fc 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_items.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_items.lua @@ -192,10 +192,23 @@ if minetest.get_modpath("mcl_fences") then local wood_groups = { handy = 1, axey = 1, flammable = 2, fence_wood = 1, fire_encouragement = 5, fire_flammability = 20 } local wood_connect = { "group:fence_wood" } - local fence_id = mcl_fences.register_fence(id, S("Bamboo Fence"), "mcl_bamboo_fence_bamboo.png", wood_groups, - 2, 15, wood_connect, node_sound) - local gate_id = mcl_fences.register_fence_gate(id, S("Bamboo Fence Gate"), "mcl_bamboo_fence_gate_bamboo.png", - wood_groups, 2, 15, node_sound) -- note: about missing params.. will use defaults. + local fence_id = mcl_fences.register_fence( + id, + S("Bamboo Fence"), + "mcl_bamboo_fence_bamboo.png", + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + wood_connect, node_sound) + + local gate_id = mcl_fences.register_fence_gate( + id, + S("Bamboo Fence Gate"), + "mcl_bamboo_fence_gate_bamboo.png", + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + node_sound) -- note: about missing params.. will use defaults. mcl_bamboo.mcl_log(dump(fence_id)) mcl_bamboo.mcl_log(dump(gate_id)) diff --git a/mods/ITEMS/mcl_cherry_blossom/nodes.lua b/mods/ITEMS/mcl_cherry_blossom/nodes.lua index 4b6803123..403982872 100644 --- a/mods/ITEMS/mcl_cherry_blossom/nodes.lua +++ b/mods/ITEMS/mcl_cherry_blossom/nodes.lua @@ -66,9 +66,16 @@ mcl_signs.register_sign_custom("mcl_cherry_blossom", "_cherrywood", "mcl_cherry_blossom_sign_inv.png", "mcl_cherry_blossom_sign_inv.png", S("Cherry Sign")) -- Fences & Gates -mcl_fences.register_fence_and_fence_gate("cherry_fence", S("Cherry Fence"), S("Cherry Gate"), - "mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, 2, 15, - {"group:fence_wood"}, mcl_sounds.node_sound_wood_defaults()) +mcl_fences.register_fence_and_fence_gate( + "cherry_fence", + S("Cherry Fence"), + S("Cherry Gate"), + "mcl_cherry_blossom_planks.png", + {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + {"group:fence_wood"}, + mcl_sounds.node_sound_wood_defaults()) -- Redstone mesecon.register_pressure_plate( diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index b14d103d2..5555fbfc0 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -269,7 +269,16 @@ for w=1, #woods do id = wood[1].."_fence" id_gate = wood[1].."_fence_gate" end - mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds) + mcl_fences.register_fence_and_fence_gate( + id, + wood[2], + wood[3], + wood[4], + wood_groups, + minetest.registered_nodes["mcl_core:wood"]._mcl_hardness, + minetest.registered_nodes["mcl_core:wood"]._mcl_blast_resistance, + wood_connect, + wood_sounds) minetest.register_craft({ output = "mcl_fences:"..id.." 3", @@ -289,7 +298,15 @@ end -- Nether Brick Fence (without fence gate!) -mcl_fences.register_fence("nether_brick_fence", S("Nether Brick Fence"), "mcl_fences_fence_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults()) +mcl_fences.register_fence( + "nether_brick_fence", + S("Nether Brick Fence"), + "mcl_fences_fence_nether_brick.png", + {pickaxey=1, deco_block=1, fence_nether_brick=1}, + minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, + minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance, + {"group:fence_nether_brick"}, + mcl_sounds.node_sound_stone_defaults()) minetest.register_craft({ output = "mcl_fences:nether_brick_fence 6", From e43a8e267d52399638e7a82501ba78db01c420b2 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 13:47:18 +0200 Subject: [PATCH 2/5] Un-hardcode blast resistance, hardness for walls, now only based on their material --- mods/ITEMS/mcl_blackstone/init.lua | 10 +++++++++- mods/ITEMS/mcl_deepslate/init.lua | 10 +++++++++- mods/ITEMS/mcl_ocean/prismarine.lua | 4 ++-- mods/ITEMS/mcl_walls/API.md | 4 +++- mods/ITEMS/mcl_walls/init.lua | 18 ++++++++--------- mods/ITEMS/mcl_walls/register.lua | 30 ++++++++++++++--------------- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index fd05465d3..6677ba0fe 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -199,7 +199,15 @@ mcl_stairs.register_stair_and_slab_simple("blackstone_chiseled_polished", "mcl_b mcl_stairs.register_stair_and_slab_simple("blackstone_brick_polished", "mcl_blackstone:blackstone_brick_polished", S("Polished Blackstone Brick Stair"), S("Polished Blackstone Brick Slab"), S("Double Polished Blackstone Brick Slab")) --Wall -mcl_walls.register_wall("mcl_blackstone:wall", S("Blackstone Wall"), "mcl_blackstone:blackstone") +mcl_walls.register_wall( + "mcl_blackstone:wall", + S("Blackstone Wall"), + "mcl_blackstone:blackstone", + nil, + nil, + nil, + minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_hardness, + minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_blast_resistance) --lavacooling diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index a1182246a..03f5843e2 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -218,7 +218,15 @@ local function register_deepslate_variant(item, desc, longdesc) end if item ~= "chiseled" then mcl_stairs.register_stair_and_slab_simple("deepslate_"..item, "mcl_deepslate:deepslate_"..item, S(desc.." Stairs"), S(desc.." Slab"), S("Double "..desc.." Slab")) - mcl_walls.register_wall("mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), "mcl_deepslate:deepslate_"..item) + mcl_walls.register_wall( + "mcl_deepslate:deepslate"..item.."wall", + S(desc.." Wall"), + "mcl_deepslate:deepslate_"..item, + nil, + nil, + nil, + minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_hardness, + minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_blast_resistance) end end diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index 32d17538d..71ffb94ce 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 1.5,--ffffixme _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 1.5,--fixmetoo _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index e6956ac47..bacb343bb 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to MineClone 2. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, hardness, blast_resistance, sounds)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -24,6 +24,8 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `tiles`: Wall textures table, same syntax as for `minetest.register_node` (optional if `source` is set) * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) +* `hardness`: Hardness of node (optional, default is 2) +* `blast_resistance`: Blast resistance of node (optional, default is 6 like most stone walls) * `sounds`: Sound table (optional, by default default uses stone sounds) The following groups will automatically be added to the nodes (where applicable), you do not need to add them diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 14b512ffd..7b2933c4b 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -98,7 +98,7 @@ local full_blocks = { * groups: Base group memberships (optional, default is {pickaxey=1}) * sounds: Sound table (optional, default is stone) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, hardness, blast_resistance, sounds) local base_groups = groups if not base_groups then @@ -169,8 +169,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = take }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help @@ -197,8 +197,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[1]} }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -223,8 +223,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[2]} }, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) -- Add entry alias for the Help if minetest.get_modpath("doc") then @@ -255,8 +255,8 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2}, on_construct = update_wall, sounds = sounds, - _mcl_blast_resistance = 6, - _mcl_hardness = 2, + _mcl_blast_resistance = blast_resistance, + _mcl_hardness = hardness, }) if source then minetest.register_craft({ diff --git a/mods/ITEMS/mcl_walls/register.lua b/mods/ITEMS/mcl_walls/register.lua index 96a1b9b9f..6f3b9f1d9 100644 --- a/mods/ITEMS/mcl_walls/register.lua +++ b/mods/ITEMS/mcl_walls/register.lua @@ -1,17 +1,17 @@ local S = minetest.get_translator(minetest.get_current_modname()) -mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}) -mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}) -mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite") -mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite") -mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite") -mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block") -mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone") -mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone") -mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick") -mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy") -mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine") -mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks") -mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick") -mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick") -mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks") \ No newline at end of file +mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:cobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:cobble"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite", nil, nil, nil, minetest.registered_nodes["mcl_core:andesite"]._mcl_hardness, minetest.registered_nodes["mcl_core:andesite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite", nil, nil, nil, minetest.registered_nodes["mcl_core:granite"]._mcl_hardness, minetest.registered_nodes["mcl_core:granite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite", nil, nil, nil, minetest.registered_nodes["mcl_core:diorite"]._mcl_hardness, minetest.registered_nodes["mcl_core:diorite"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block", nil, nil, nil, minetest.registered_nodes["mcl_core:brick_block"]._mcl_hardness, minetest.registered_nodes["mcl_core:brick_block"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:sandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:sandstone"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine", nil, nil, nil, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_hardness, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks", nil, nil, nil, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_blast_resistance) +mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks", nil, nil, nil, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_blast_resistance) \ No newline at end of file From e2ed1ab4a6623179b499fed6ca4347fbae02f565 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 13:49:00 +0200 Subject: [PATCH 3/5] Fix prismarine bricks and dark variant blast res. Should be 6 like regular prismarine --- mods/ITEMS/mcl_ocean/prismarine.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index 71ffb94ce..fff07cb7e 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -52,7 +52,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5,--ffffixme + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -64,7 +64,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 1.5,--fixmetoo + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) From 8099a4bd17811bc2e47439732e1ff5cdaa02a63c Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 16:14:36 +0200 Subject: [PATCH 4/5] Walls use `source` parameter for default hardness and blast resistance If no `source` given, fallbacks are 2 and 6 respectively --- mods/ITEMS/mcl_deepslate/init.lua | 7 +----- mods/ITEMS/mcl_walls/API.md | 6 +++--- mods/ITEMS/mcl_walls/init.lua | 36 ++++++++++++++++++++++--------- mods/ITEMS/mcl_walls/register.lua | 30 +++++++++++++------------- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/mods/ITEMS/mcl_deepslate/init.lua b/mods/ITEMS/mcl_deepslate/init.lua index 03f5843e2..b4549159f 100644 --- a/mods/ITEMS/mcl_deepslate/init.lua +++ b/mods/ITEMS/mcl_deepslate/init.lua @@ -221,12 +221,7 @@ local function register_deepslate_variant(item, desc, longdesc) mcl_walls.register_wall( "mcl_deepslate:deepslate"..item.."wall", S(desc.." Wall"), - "mcl_deepslate:deepslate_"..item, - nil, - nil, - nil, - minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_hardness, - minetest.registered_nodes["mcl_deepslate:deepslate"]._mcl_blast_resistance) + "mcl_deepslate:deepslate_"..item) end end diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md index bacb343bb..5c21ce98d 100644 --- a/mods/ITEMS/mcl_walls/API.md +++ b/mods/ITEMS/mcl_walls/API.md @@ -2,7 +2,7 @@ This API allows you to add more walls (like the cobblestone wall) to MineClone 2. -## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, hardness, blast_resistance, sounds)` +## `mcl_walls.register_wall(nodename, description, craft_material, tiles, invtex, groups, sounds, hardness, blast_resistance)` Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. @@ -24,9 +24,9 @@ If `craft_material` is not `nil` it also adds a crafting recipe of the following * `tiles`: Wall textures table, same syntax as for `minetest.register_node` (optional if `source` is set) * `inventory_image`: Inventory image (optional if `source` is set) * `groups`: Base group memberships (optional, default is `{pickaxey=1}`) -* `hardness`: Hardness of node (optional, default is 2) -* `blast_resistance`: Blast resistance of node (optional, default is 6 like most stone walls) * `sounds`: Sound table (optional, by default default uses stone sounds) +* `hardness`: Hardness of node (optional, default matches `source` node or fallback value 2) +* `blast_resistance`: Blast resistance of node (optional, default matches `source` node or fallback value 6) The following groups will automatically be added to the nodes (where applicable), you do not need to add them to the `groups` table: diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index 7b2933c4b..caf8b34fe 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -97,8 +97,10 @@ local full_blocks = { * inventory_image: Inventory image (optional) * groups: Base group memberships (optional, default is {pickaxey=1}) * sounds: Sound table (optional, default is stone) +* hardness: Hardness of node (optional, default matches `source` node or fallback value 2) +* blast_resistance: Blast resistance of node (optional, default matches `source` node or fallback value 6) ]] -function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, hardness, blast_resistance, sounds) +function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds, hardness, blast_resistance) local base_groups = groups if not base_groups then @@ -112,15 +114,29 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory local main_node_groups = table.copy(base_groups) main_node_groups.deco_block = 1 - -- TODO: Stop hardcoding blast resistance - - if not sounds then - sounds = mcl_sounds.node_sound_stone_defaults() - end - - if (not tiles) and source then - if minetest.registered_nodes[source] then - tiles = minetest.registered_nodes[source].tiles + if source then + -- Default values from `source` node + if not hardness then + hardness = minetest.registered_nodes[source]._mcl_hardness + end + if not blast_resistance then + blast_resistance = minetest.registered_nodes[source]._mcl_blast_resistance + end + if not sounds then + sounds = minetest.registered_nodes[source].sounds + end + if not tiles then + if minetest.registered_nodes[source] then + tiles = minetest.registered_nodes[source].tiles + end + end + else + -- Fallback in case no `source` given + if not hardness then + hardness = 2 + end + if not blast_resistance then + blast_resistance = 6 end end diff --git a/mods/ITEMS/mcl_walls/register.lua b/mods/ITEMS/mcl_walls/register.lua index 6f3b9f1d9..96a1b9b9f 100644 --- a/mods/ITEMS/mcl_walls/register.lua +++ b/mods/ITEMS/mcl_walls/register.lua @@ -1,17 +1,17 @@ local S = minetest.get_translator(minetest.get_current_modname()) -mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:cobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:cobble"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}, nil, nil, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_hardness, minetest.registered_nodes["mcl_core:mossycobble"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite", nil, nil, nil, minetest.registered_nodes["mcl_core:andesite"]._mcl_hardness, minetest.registered_nodes["mcl_core:andesite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite", nil, nil, nil, minetest.registered_nodes["mcl_core:granite"]._mcl_hardness, minetest.registered_nodes["mcl_core:granite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite", nil, nil, nil, minetest.registered_nodes["mcl_core:diorite"]._mcl_hardness, minetest.registered_nodes["mcl_core:diorite"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block", nil, nil, nil, minetest.registered_nodes["mcl_core:brick_block"]._mcl_hardness, minetest.registered_nodes["mcl_core:brick_block"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:sandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:sandstone"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone", nil, nil, nil, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_hardness, minetest.registered_nodes["mcl_core:redsandstone"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy", nil, nil, nil, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_hardness, minetest.registered_nodes["mcl_core:stonebrickmossy"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine", nil, nil, nil, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_hardness, minetest.registered_nodes["mcl_ocean:prismarine"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks", nil, nil, nil, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_end:end_bricks"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:nether_brick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick", nil, nil, nil, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_hardness, minetest.registered_nodes["mcl_nether:red_nether_brick"]._mcl_blast_resistance) -mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks", nil, nil, nil, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_hardness, minetest.registered_nodes["mcl_mud:mud_bricks"]._mcl_blast_resistance) \ No newline at end of file +mcl_walls.register_wall("mcl_walls:cobble", S("Cobblestone Wall"), "mcl_core:cobble", {"mcl_walls_cobble_wall_top.png", "default_cobble.png", "mcl_walls_cobble_wall_side.png"}) +mcl_walls.register_wall("mcl_walls:mossycobble", S("Mossy Cobblestone Wall"), "mcl_core:mossycobble", {"mcl_walls_cobble_mossy_wall_top.png", "default_mossycobble.png", "mcl_walls_cobble_mossy_wall_side.png"}) +mcl_walls.register_wall("mcl_walls:andesite", S("Andesite Wall"), "mcl_core:andesite") +mcl_walls.register_wall("mcl_walls:granite", S("Granite Wall"), "mcl_core:granite") +mcl_walls.register_wall("mcl_walls:diorite", S("Diorite Wall"), "mcl_core:diorite") +mcl_walls.register_wall("mcl_walls:brick", S("Brick Wall"), "mcl_core:brick_block") +mcl_walls.register_wall("mcl_walls:sandstone", S("Sandstone Wall"), "mcl_core:sandstone") +mcl_walls.register_wall("mcl_walls:redsandstone", S("Red Sandstone Wall"), "mcl_core:redsandstone") +mcl_walls.register_wall("mcl_walls:stonebrick", S("Stone Brick Wall"), "mcl_core:stonebrick") +mcl_walls.register_wall("mcl_walls:stonebrickmossy", S("Mossy Stone Brick Wall"), "mcl_core:stonebrickmossy") +mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean:prismarine") +mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks") +mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick") +mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick") +mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks") \ No newline at end of file From bc3bde4cf82f9d215133f16cc60ac904107b7bad Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Sun, 17 Sep 2023 17:11:35 +0200 Subject: [PATCH 5/5] Forgot about blackstone --- mods/ITEMS/mcl_blackstone/init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_blackstone/init.lua b/mods/ITEMS/mcl_blackstone/init.lua index 6677ba0fe..138e02191 100644 --- a/mods/ITEMS/mcl_blackstone/init.lua +++ b/mods/ITEMS/mcl_blackstone/init.lua @@ -202,12 +202,8 @@ mcl_stairs.register_stair_and_slab_simple("blackstone_brick_polished", "mcl_blac mcl_walls.register_wall( "mcl_blackstone:wall", S("Blackstone Wall"), - "mcl_blackstone:blackstone", - nil, - nil, - nil, - minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_hardness, - minetest.registered_nodes["mcl_blackstone:blackstone"]._mcl_blast_resistance) + "mcl_blackstone:blackstone" +) --lavacooling