From 715c3b80444218c38d23f181451813a70d4de358 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 04:46:33 +0200 Subject: [PATCH] make API register stairs and slabs --- mods/ITEMS/mcl_mangrove/init.lua | 1 + mods/ITEMS/mcl_stairs/register.lua | 25 ------------------------- mods/ITEMS/mcl_wood/api.lua | 27 ++++++++++++++++++++------- mods/ITEMS/mcl_wood/mod.conf | 2 +- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index 27955c5b6..5764c8c95 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -16,6 +16,7 @@ local propagule_allowed_nodes = { "mcl_mud:mud", } 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 --[[] local function get_drops(fortune_level) diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index eee4c5dc2..8f4283da7 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -5,31 +5,6 @@ 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_slab("stone", "mcl_core:stone_smooth", diff --git a/mods/ITEMS/mcl_wood/api.lua b/mods/ITEMS/mcl_wood/api.lua index c1661be0a..b4366ff07 100644 --- a/mods/ITEMS/mcl_wood/api.lua +++ b/mods/ITEMS/mcl_wood/api.lua @@ -11,7 +11,7 @@ end -- Register tree trunk (wood) and bark 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, _doc_items_longdesc = longdesc, _doc_items_hidden = false, @@ -27,7 +27,7 @@ local function register_tree_trunk(subname, description_trunk, description_bark, _mcl_stripped_variant = stripped_variant, }) - minetest.register_node("mcl_wood:"..subname.."_bark", { + minetest.register_node(":mcl_wood:"..subname.."_bark", { description = description_bark, _doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."), tiles = {tile_bark}, @@ -54,7 +54,7 @@ end -- 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) - minetest.register_node("mcl_wood:"..subname, { + minetest.register_node(":mcl_wood:"..subname, { description = description_stripped_trunk, _doc_items_longdesc = longdesc, _doc_items_hidden = false, @@ -69,7 +69,7 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc _mcl_hardness = 2, }) - minetest.register_node("mcl_wood:"..subname.."_bark", { + minetest.register_node(":mcl_wood:"..subname.."_bark", { description = description_stripped_bark, _doc_items_longdesc = longdesc_wood, tiles = {tile_stripped_bark}, @@ -94,7 +94,7 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc end local function register_wooden_planks(subname, description, tiles) - minetest.register_node("mcl_wood:"..subname, { + minetest.register_node(":mcl_wood:"..subname, { description = description, _doc_items_longdesc = doc.sub.items.temp.build, _doc_items_hidden = false, @@ -142,7 +142,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d return drop end - minetest.register_node("mcl_wood:"..subname, { + minetest.register_node(":mcl_wood:"..subname, { description = description, _doc_items_longdesc = longdesc, _doc_items_hidden = false, @@ -169,7 +169,7 @@ local function register_leaves(subname, description, longdesc, tiles, sapling, d end 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, _tt_help = tt_help, _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_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 diff --git a/mods/ITEMS/mcl_wood/mod.conf b/mods/ITEMS/mcl_wood/mod.conf index d2318e097..a424dfd60 100644 --- a/mods/ITEMS/mcl_wood/mod.conf +++ b/mods/ITEMS/mcl_wood/mod.conf @@ -1,4 +1,4 @@ name = mcl_wood 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