make API register stairs and slabs

This commit is contained in:
cora 2022-08-10 04:46:33 +02:00
parent cc8b8acd81
commit 715c3b8044
4 changed files with 22 additions and 33 deletions

View File

@ -16,6 +16,7 @@ local propagule_allowed_nodes = {
"mcl_mud:mud", "mcl_mud:mud",
} }
local propagule_water_nodes = {"mcl_mud:mud","mcl_core:dirt","mcl_core:coarse_dirt","mcl_core:clay"} local propagule_water_nodes = {"mcl_mud:mud","mcl_core:dirt","mcl_core:coarse_dirt","mcl_core:clay"}
--mcl_wood.register_wood("mangrove")
--"mcl_lush_caves:moss","mcl_lush_caves:rooted_dirt --"mcl_lush_caves:moss","mcl_lush_caves:rooted_dirt
--[[] --[[]
local function get_drops(fortune_level) local function get_drops(fortune_level)

View File

@ -5,31 +5,6 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local woods = {
{ "wood", "default_wood.png", S("Oak Wood Stairs"), S("Oak Wood Slab"), S("Double Oak Wood Slab") },
{ "junglewood", "default_junglewood.png", S("Jungle Wood Stairs"), S("Jungle Wood Slab"), S("Double Jungle Wood Slab") },
{ "acaciawood", "default_acacia_wood.png", S("Acacia Wood Stairs"), S("Acacia Wood Slab"), S("Double Acacia Wood Slab") },
{ "sprucewood", "mcl_core_planks_spruce.png", S("Spruce Wood Stairs"), S("Spruce Wood Slab"), S("Double Spruce Wood Slab") },
{ "birchwood", "mcl_core_planks_birch.png", S("Birch Wood Stairs"), S("Birch Wood Slab"), S("Double Birch Wood Slab") },
{ "darkwood", "mcl_core_planks_big_oak.png", S("Dark Oak Wood Stairs"), S("Dark Oak Wood Slab"), S("Double Dark Oak Wood Slab") },
}
for w=1, #woods do
local wood = woods[w]
mcl_stairs.register_stair(wood[1], "mcl_core:"..wood[1],
{handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{wood[2]},
wood[3],
mcl_sounds.node_sound_wood_defaults(), 3, 2,
"woodlike")
mcl_stairs.register_slab(wood[1], "mcl_core:"..wood[1],
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{wood[2]},
wood[4],
mcl_sounds.node_sound_wood_defaults(), 3, 2,
wood[5])
end
mcl_stairs.register_stair_and_slab_simple("stone_rough", "mcl_core:stone", S("Stone Stairs"), S("Stone Slab"), S("Double Stone Slab")) mcl_stairs.register_stair_and_slab_simple("stone_rough", "mcl_core:stone", S("Stone Stairs"), S("Stone Slab"), S("Double Stone Slab"))
mcl_stairs.register_slab("stone", "mcl_core:stone_smooth", mcl_stairs.register_slab("stone", "mcl_core:stone_smooth",

View File

@ -11,7 +11,7 @@ end
-- Register tree trunk (wood) and bark -- Register tree trunk (wood) and bark
local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant) local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
minetest.register_node("mcl_wood:"..subname, { minetest.register_node(":mcl_wood:"..subname, {
description = description_trunk, description = description_trunk,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -27,7 +27,7 @@ local function register_tree_trunk(subname, description_trunk, description_bark,
_mcl_stripped_variant = stripped_variant, _mcl_stripped_variant = stripped_variant,
}) })
minetest.register_node("mcl_wood:"..subname.."_bark", { minetest.register_node(":mcl_wood:"..subname.."_bark", {
description = description_bark, description = description_bark,
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."), _doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {tile_bark}, tiles = {tile_bark},
@ -54,7 +54,7 @@ end
-- Register stripped trunk and stripped wood -- Register stripped trunk and stripped wood
local function register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark) local function register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark)
minetest.register_node("mcl_wood:"..subname, { minetest.register_node(":mcl_wood:"..subname, {
description = description_stripped_trunk, description = description_stripped_trunk,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -69,7 +69,7 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc
_mcl_hardness = 2, _mcl_hardness = 2,
}) })
minetest.register_node("mcl_wood:"..subname.."_bark", { minetest.register_node(":mcl_wood:"..subname.."_bark", {
description = description_stripped_bark, description = description_stripped_bark,
_doc_items_longdesc = longdesc_wood, _doc_items_longdesc = longdesc_wood,
tiles = {tile_stripped_bark}, tiles = {tile_stripped_bark},
@ -94,7 +94,7 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc
end end
local function register_wooden_planks(subname, description, tiles) local function register_wooden_planks(subname, description, tiles)
minetest.register_node("mcl_wood:"..subname, { minetest.register_node(":mcl_wood:"..subname, {
description = description, description = description,
_doc_items_longdesc = doc.sub.items.temp.build, _doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -142,7 +142,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
return drop return drop
end end
minetest.register_node("mcl_wood:"..subname, { minetest.register_node(":mcl_wood:"..subname, {
description = description, description = description,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -169,7 +169,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d
end end
local function register_sapling(subname, description, longdesc, tt_help, texture, selbox) local function register_sapling(subname, description, longdesc, tt_help, texture, selbox)
minetest.register_node("mcl_wood:"..subname, { minetest.register_node(":mcl_wood:"..subname, {
description = description, description = description,
_tt_help = tt_help, _tt_help = tt_help,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
@ -229,4 +229,17 @@ function mcl_wood.register_wood(name)
register_sapling("sapling_"..name, S(rname.." Sapling"),S("When placed on soil (such as dirt) and exposed to light, an "..name.." sapling will grow into an "..name.." after some time."),S("Needs soil and light to grow"),"mcl_wood_sapling_"..name..".png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16}) register_sapling("sapling_"..name, S(rname.." Sapling"),S("When placed on soil (such as dirt) and exposed to light, an "..name.." sapling will grow into an "..name.." after some time."),S("Needs soil and light to grow"),"mcl_wood_sapling_"..name..".png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16})
register_leaves("leaves_"..name, S(rname.." Leaves"), S(rname.." leaves are grown from "..name.." trees."), {"mcl_wood_leaves_"..name..".png"}, "mcl_wood:sapling_"..name, true, {20, 16, 12, 10}) register_leaves("leaves_"..name, S(rname.." Leaves"), S(rname.." leaves are grown from "..name.." trees."), {"mcl_wood_leaves_"..name..".png"}, "mcl_wood:sapling_"..name, true, {20, 16, 12, 10})
mcl_stairs.register_stair(name, "mcl_wood:"..name,
{handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{"mcl_wood_planks_"..name..".png"},
S("Oak Wood Stairs"),
mcl_sounds.node_sound_wood_defaults(), 3, 2,
"woodlike")
mcl_stairs.register_slab(name, "mcl_wood:"..name,
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{"mcl_wood_planks_"..name..".png"},
S(rname.." Wood Slab"),
mcl_sounds.node_sound_wood_defaults(), 3, 2,
S("Double "..rname.." Wood Slab"))
end end

View File

@ -1,4 +1,4 @@
name = mcl_wood name = mcl_wood
author = cora author = cora
depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting, mcl_colors depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting, mcl_colors, mcl_stairs
optional_depends = doc, screwdriver optional_depends = doc, screwdriver