Simplify wall registration

This commit is contained in:
Wuzzy 2018-12-03 17:30:09 +01:00
parent 6fdf57d44f
commit 367469cf90
2 changed files with 25 additions and 19 deletions

View File

@ -86,13 +86,13 @@ local full_blocks = {
--[[ Adds a new wall type.
* nodename: Itemstring of base node to add. Must not contain an underscore
* description: Item description (tooltip), visible to user
* craft_material: Material for the default crafting recipe (optional)
* source: Source block to craft this thing, for graphics, tiles and crafting (optional)
* tiles: Wall textures table
* inventory_image: Inventory image (optional)
* groups: Base group memberships (optional, default is {pickaxey=1})
* sounds: Sound table (optional, default is stone)
]]
function mcl_walls.register_wall(nodename, description, craft_material, tiles, inventory_image, groups, sounds)
function mcl_walls.register_wall(nodename, description, source, tiles, inventory_image, groups, sounds)
local base_groups = groups
if not base_groups then
@ -112,6 +112,12 @@ function mcl_walls.register_wall(nodename, description, craft_material, tiles, i
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
end
end
for i = 0, 15 do
local need = {}
local need_pillar = false
@ -242,12 +248,12 @@ function mcl_walls.register_wall(nodename, description, craft_material, tiles, i
_mcl_blast_resistance = 30,
_mcl_hardness = 2,
})
if craft_material then
if source then
minetest.register_craft({
output = nodename .. " 6",
recipe = {
{craft_material, craft_material, craft_material},
{craft_material, craft_material, craft_material},
{source, source, source},
{source, source, source},
}
})
end

View File

@ -1,14 +1,14 @@
mcl_walls.register_wall("mcl_walls:cobble", "Cobblestone Wall", "mcl_core:cobble", {"default_cobble.png"})
mcl_walls.register_wall("mcl_walls:mossycobble", "Mossy Cobblestone Wall", "mcl_core:mossycobble", {"default_mossycobble.png"})
mcl_walls.register_wall("mcl_walls:andesite", "Andesite Wall", "mcl_core:andesite", {"mcl_core_andesite.png"})
mcl_walls.register_wall("mcl_walls:granite", "Granite Wall", "mcl_core:granite", {"mcl_core_granite.png"})
mcl_walls.register_wall("mcl_walls:diorite", "Diorite Wall", "mcl_core:diorite", {"mcl_core_diorite.png"})
mcl_walls.register_wall("mcl_walls:brick", "Brick Wall", "mcl_core:brick_block", {"default_brick.png"})
mcl_walls.register_wall("mcl_walls:sandstone", "Sandstone Wall", "mcl_core:sandstone", {"mcl_core_sandstone_top.png", "mcl_core_sandstone_bottom.png", "mcl_core_sandstone_normal.png"})
mcl_walls.register_wall("mcl_walls:redsandstone", "Red Sandstone Wall", "mcl_core:redsandstone", {"mcl_core_red_sandstone_top.png", "mcl_core_red_sandstone_bottom.png", "mcl_core_red_sandstone_normal.png"})
mcl_walls.register_wall("mcl_walls:stonebrick", "Stone Brick Wall", "mcl_core:stonebrick", {"default_stone_brick.png"})
mcl_walls.register_wall("mcl_walls:stonebrickmossy", "Mossy Stone Brick Wall", "mcl_core:stonebrickmossy", {"mcl_core_stonebrick_mossy.png"})
mcl_walls.register_wall("mcl_walls:prismarine", "Prismarine Wall", "mcl_ocean:prismarine", {{name="mcl_ocean_prismarine_anim.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=45.0}}})
mcl_walls.register_wall("mcl_walls:endbricks", "End Stone Brick Wall", "mcl_end:end_bricks", {"mcl_end_end_bricks.png"})
mcl_walls.register_wall("mcl_walls:netherbrick", "Nether Brick Wall", "mcl_nether:nether_brick", {"mcl_nether_nether_brick.png"})
mcl_walls.register_wall("mcl_walls:rednetherbrick", "Red Nether Brick Wall", "mcl_nether:red_nether_brick", {"mcl_nether_red_nether_brick.png"})
mcl_walls.register_wall("mcl_walls:cobble", "Cobblestone Wall", "mcl_core:cobble")
mcl_walls.register_wall("mcl_walls:mossycobble", "Mossy Cobblestone Wall", "mcl_core:mossycobble")
mcl_walls.register_wall("mcl_walls:andesite", "Andesite Wall", "mcl_core:andesite")
mcl_walls.register_wall("mcl_walls:granite", "Granite Wall", "mcl_core:granite")
mcl_walls.register_wall("mcl_walls:diorite", "Diorite Wall", "mcl_core:diorite")
mcl_walls.register_wall("mcl_walls:brick", "Brick Wall", "mcl_core:brick_block")
mcl_walls.register_wall("mcl_walls:sandstone", "Sandstone Wall", "mcl_core:sandstone")
mcl_walls.register_wall("mcl_walls:redsandstone", "Red Sandstone Wall", "mcl_core:redsandstone")
mcl_walls.register_wall("mcl_walls:stonebrick", "Stone Brick Wall", "mcl_core:stonebrick")
mcl_walls.register_wall("mcl_walls:stonebrickmossy", "Mossy Stone Brick Wall", "mcl_core:stonebrickmossy")
mcl_walls.register_wall("mcl_walls:prismarine", "Prismarine Wall", "mcl_ocean:prismarine")
mcl_walls.register_wall("mcl_walls:endbricks", "End Stone Brick Wall", "mcl_end:end_bricks")
mcl_walls.register_wall("mcl_walls:netherbrick", "Nether Brick Wall", "mcl_nether:nether_brick")
mcl_walls.register_wall("mcl_walls:rednetherbrick", "Red Nether Brick Wall", "mcl_nether:red_nether_brick")