From 114f3a24feae17ab83a89d401bea9dd88522347b Mon Sep 17 00:00:00 2001 From: rudzik8 Date: Wed, 23 Mar 2022 12:23:35 +0700 Subject: [PATCH] Add slab tables and fix previous commit --- api.lua | 45 +++++++++++++++++++++++++++++++++++++++++- init.lua | 3 ++- locale/mcl_decor.ru.tr | 6 ++++++ locale/template.txt | 6 ++++++ register.lua | 7 +++++++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 3ca7e69..6c28338 100644 --- a/api.lua +++ b/api.lua @@ -135,13 +135,55 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material, sounds = mcl_sounds.node_sound_wood_defaults(), }) minetest.register_craft({ - output = name, + output = name2.." 2", recipe = { {material, material, material}, {"mcl_core:stick", "", "mcl_core:stick"}, {"mcl_core:stick", "", "mcl_core:stick"} } }) + minetest.register_craft({ + type = "fuel", + recipe = name2, + burntime = 10, + }) +end + +function mcl_decor.register_slab_table(name, desc, material, tiles) + minetest.register_node(name, { + description = desc, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.125, -0.5, -0.125, 0.125, 0, 0.125}, + {-0.5, 0, -0.5, 0.5, 0.5, 0.5}, + } + }, + --[[ + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + }, + ]] + tiles = {tiles}, + is_ground_content = false, + paramtype = "light", + stack_max = 64, + sunlight_propagates = true, + groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1}, + _mcl_hardness = 2, + _mcl_blast_resistance = 3, + sounds = mcl_sounds.node_sound_wood_defaults(), + }) + minetest.register_craft({ + output = name.." 3", + recipe = { + {material, material, material}, + {"", "mcl_core:stick", ""}, + {"", "mcl_core:stick", ""} + } + }) minetest.register_craft({ type = "fuel", recipe = name, @@ -227,5 +269,6 @@ function mcl_decor.register_dyed_planks(name, desc, hexcolor, dye, colorgroup) recipe = "mcl_decor:"..name, burntime = 12, }) + -- maybe descriptions of slabs/stairs after that workaround will be VERY CRAPPY (especially with translations via locales), but at least it works mcl_stairs.register_stair_and_slab_simple(name, "mcl_decor:"..name, desc..S(" Stair"), desc..S(" Slab"), S("Double")..desc..S(" Slab")) end diff --git a/init.lua b/init.lua index 85fa90b..4f331db 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,8 @@ -- mcl_decor/init.lua mcl_decor = {} - local modpath = minetest.get_modpath(minetest.get_current_modname()) + +-- load files dofile(modpath.."/api.lua") dofile(modpath.."/register.lua") diff --git a/locale/mcl_decor.ru.tr b/locale/mcl_decor.ru.tr index efc88ce..a663afa 100644 --- a/locale/mcl_decor.ru.tr +++ b/locale/mcl_decor.ru.tr @@ -19,6 +19,12 @@ Birch Table=Берёзовый стол Dark Oak Table=Стол из тёмного дуба Jungle Table=Стол из тропического дерева Spruce Table=Еловый стол +Oak Slab Table=Дубовый полублочный стол +Dark Oak Slab Table=Полублочный стол из тёмного дуба +Jungle Slab Table=Полублочный стол из тропического дерева +Spruce Slab Table=Еловый полублочный стол +Acacia Slab Table=Полублочный стол из акации +Birch Slab Table=Берёзовый полублочный стол White Planks=Белые доски Grey Planks=Серые доски Light Grey Planks=Светло-серые доски diff --git a/locale/template.txt b/locale/template.txt index a5e105a..d0f9ccb 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -19,6 +19,12 @@ Birch Table= Dark Oak Table= Jungle Table= Spruce Table= +Oak Slab Table= +Dark Oak Slab Table= +Jungle Slab Table= +Spruce Slab Table= +Acacia Slab Table= +Birch Slab Table= White Planks= Grey Planks= Light Grey Planks= diff --git a/register.lua b/register.lua index 3016ccf..c6f443e 100644 --- a/register.lua +++ b/register.lua @@ -149,6 +149,13 @@ mcl_decor.register_chair_and_table("mcl_decor:spruce_chair", S("Spruce Chair"), mcl_decor.register_chair_and_table("mcl_decor:acacia_chair", S("Acacia Chair"), "mcl_decor:acacia_table", S("Acacia Table"), "mcl_core:acaciawood", "default_acacia_wood.png") mcl_decor.register_chair_and_table("mcl_decor:birch_chair", S("Birch Chair"), "mcl_decor:birch_table", S("Birch Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png") +mcl_decor.register_slab_table("mcl_decor:wooden_stable", S("Oak Slab Table"), "mcl_core:wood", "default_wood.png") +mcl_decor.register_slab_table("mcl_decor:dark_oak_stable", S("Dark Oak Slab Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png") +mcl_decor.register_slab_table("mcl_decor:jungle_stable", S("Jungle Slab Table"), "mcl_core:junglewood", "default_junglewood.png") +mcl_decor.register_slab_table("mcl_decor:spruce_stable", S("Spruce Slab Table"), "mcl_core:sprucewood", "mcl_core_planks_spruce.png") +mcl_decor.register_slab_table("mcl_decor:acacia_stable", S("Acacia Slab Table"), "mcl_core:acaciawood", "default_acacia_wood.png") +mcl_decor.register_slab_table("mcl_decor:birch_stable", S("Birch Slab Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png") + --- Armchairs ---