Un-hardcode blast resistance, hardness for walls,

now only based on their material
This commit is contained in:
seventeenthShulker 2023-09-17 13:47:18 +02:00 committed by the-real-herowl
parent 570caf47eb
commit e43a8e267d
6 changed files with 47 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
})

View File

@ -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

View File

@ -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({

View File

@ -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")
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)