Add support for MineClone 5 wood types and fix infinite curtains

current fix is just comment on_place. yeah.
This commit is contained in:
Mikita Wiśniewski 2022-04-24 16:47:33 +07:00
parent ceeb4366c3
commit 6a431599d4
5 changed files with 75 additions and 41 deletions

View File

@ -19,7 +19,7 @@ Armchairs are 1x1 size blocks, on which you can sit by right-click! Uses wool an
![Screenshot](https://i.ibb.co/3YhDML4/Webp-net-gifmaker-2.gif "Crafting")
### Chairs
Chairs are small blocks made out of wood, on which you can sit by right-click! Uses sticks and wood planks for crafting. 6 types available!
Chairs are small blocks made out of wood, on which you can sit by right-click! Uses sticks and wood planks for crafting. 6 *(+2 with MCL5)* types available!
**Screenshot:**

40
api.lua
View File

@ -106,7 +106,13 @@ end
function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material, tiles)
function mcl_decor.register_chair_and_table(name, desc, desc2, material, tiles, groups)
if group == nil then
group = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1}
else
group = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1}
end
-- chair part
minetest.register_node("mcl_decor:"..name.."_chair", {
description = desc,
@ -132,7 +138,7 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 },
},
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
groups = group,
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
sounds = mcl_sounds.node_sound_wood_defaults(),
@ -161,7 +167,7 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
})
-- table part
minetest.register_node("mcl_decor:"..name2.."_table", {
minetest.register_node("mcl_decor:"..name.."_table", {
description = desc2,
drawtype = "nodebox",
node_box = {
@ -183,13 +189,13 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
paramtype = "light",
stack_max = 64,
sunlight_propagates = true,
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
groups = group,
_mcl_hardness = 2,
_mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "mcl_decor:"..name2.."_table".." 2",
output = "mcl_decor:"..name.."_table".." 2",
recipe = {
{material, material, material},
{"mcl_core:stick", "", "mcl_core:stick"},
@ -198,12 +204,17 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_decor:"..name2.."_table",
recipe = "mcl_decor:"..name.."_table",
burntime = 10,
})
end
function mcl_decor.register_slab_table(name, desc, material, tiles)
function mcl_decor.register_slab_table(name, desc, material, tiles, group)
if group == nil then
group = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1}
else
group = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1}
end
minetest.register_node("mcl_decor:"..name.."_stable", {
description = desc,
drawtype = "nodebox",
@ -219,7 +230,7 @@ function mcl_decor.register_slab_table(name, desc, material, tiles)
paramtype = "light",
stack_max = 64,
sunlight_propagates = true,
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
groups = group,
_mcl_hardness = 2,
_mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(),
@ -317,7 +328,6 @@ function mcl_decor.register_dyed_planks(color, desc, hexcolor, dye, colorgroup)
)
end
-- FIXME: curtains can be placed infinitely just like in creative mode
function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgroup)
minetest.register_node("mcl_decor:curtain_"..color, {
description = desc,
@ -344,8 +354,12 @@ function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgrou
},
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
-- taken from mcl_signs (partially)
--[[
function below should stop players from placing curtains on floor and ceiling, BUT it makes them infinite (bug)
will be uncommented and fixed one day... maybe...
---
on_place = function(itemstack, placer, pointed_thing)
-- taken from mcl_signs (partially)
local above = pointed_thing.above
local under = pointed_thing.under
@ -360,9 +374,8 @@ function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgrou
local dir = vector.subtract(under, above)
local wdir = minetest.dir_to_wallmounted(dir)
if wdir == 0 then
return itemstack
elseif wdir == 1 then
-- FIXME: curtains can be placed infinitely just like in creative mode
if wdir == 0 or wdir == 1 then
return itemstack
else
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
@ -375,6 +388,7 @@ function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgrou
end
end
end,
]]
on_rightclick = function(pos, node, _, itemstack)
minetest.set_node(pos, {name="mcl_decor:curtain_"..color.."_closed", param2=node.param2})
return itemstack

View File

@ -19,18 +19,24 @@ Birch Chair=Берёзовый стул
Dark Oak Chair=Стул из тёмного дуба
Jungle Chair=Стул из тропического дерева
Spruce Chair=Еловый стул
Crimson Chair=Багровый стул
Warped Chair=Искажённый стул
Oak Table=Дубовый стол
Acacia Table=Стол из акации
Birch Table=Берёзовый стол
Dark Oak Table=Стол из тёмного дуба
Jungle Table=Стол из тропического дерева
Spruce Table=Еловый стол
Crimson Table=Багровый стол
Warped Table=Искажённый стол
Oak Slab Table=Дубовый полублочный стол
Dark Oak Slab Table=Полублочный стол из тёмного дуба
Jungle Slab Table=Полублочный стол из тропического дерева
Spruce Slab Table=Еловый полублочный стол
Acacia Slab Table=Полублочный стол из акации
Birch Slab Table=Берёзовый полублочный стол
Crimson Slab Table=Багровый полублочный стол
Warped Slab Table=Искажённый полублочный стол
White Planks=Белые доски
Grey Planks=Серые доски
Light Grey Planks=Светло-серые доски

View File

@ -19,18 +19,24 @@ Birch Chair=
Dark Oak Chair=
Jungle Chair=
Spruce Chair=
Crimson Chair=
Warped Chair=
Oak Table=
Acacia Table=
Birch Table=
Dark Oak Table=
Jungle Table=
Spruce Table=
Crimson Table=
Warped Table=
Oak Slab Table=
Dark Oak Slab Table=
Jungle Slab Table=
Spruce Slab Table=
Acacia Slab Table=
Birch Slab Table=
Crimson Slab Table=
Warped Slab Table=
White Planks=
Grey Planks=
Light Grey Planks=

View File

@ -127,12 +127,12 @@ minetest.register_craft({
--- Tables and Chairs ---
mcl_decor.register_chair_and_table("wooden", S("Oak Chair"), "wooden", S("Oak Table"), "mcl_core:wood", "default_wood.png")
mcl_decor.register_chair_and_table("dark_oak", S("Dark Oak Chair"), "dark_oak", S("Dark Oak Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png")
mcl_decor.register_chair_and_table("jungle", S("Jungle Chair"), "jungle", S("Jungle Table"), "mcl_core:junglewood", "default_junglewood.png")
mcl_decor.register_chair_and_table("spruce", S("Spruce Chair"), "spruce", S("Spruce Table"), "mcl_core:sprucewood", "mcl_core_planks_spruce.png")
mcl_decor.register_chair_and_table("acacia", S("Acacia Chair"), "acacia", S("Acacia Table"), "mcl_core:acaciawood", "default_acacia_wood.png")
mcl_decor.register_chair_and_table("birch", S("Birch Chair"), "birch", S("Birch Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png")
mcl_decor.register_chair_and_table("wooden", S("Oak Chair"), S("Oak Table"), "mcl_core:wood", "default_wood.png")
mcl_decor.register_chair_and_table("dark_oak", S("Dark Oak Chair"), S("Dark Oak Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png")
mcl_decor.register_chair_and_table("jungle", S("Jungle Chair"), S("Jungle Table"), "mcl_core:junglewood", "default_junglewood.png")
mcl_decor.register_chair_and_table("spruce", S("Spruce Chair"), S("Spruce Table"), "mcl_core:sprucewood", "mcl_core_planks_spruce.png")
mcl_decor.register_chair_and_table("acacia", S("Acacia Chair"), S("Acacia Table"), "mcl_core:acaciawood", "default_acacia_wood.png")
mcl_decor.register_chair_and_table("birch", S("Birch Chair"), S("Birch Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png")
mcl_decor.register_slab_table("wooden", S("Oak Slab Table"), "mcl_core:wood", "default_wood.png")
mcl_decor.register_slab_table("dark_oak", S("Dark Oak Slab Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png")
@ -141,6 +141,14 @@ mcl_decor.register_slab_table("spruce", S("Spruce Slab Table"), "mcl_core:spruce
mcl_decor.register_slab_table("acacia", S("Acacia Slab Table"), "mcl_core:acaciawood", "default_acacia_wood.png")
mcl_decor.register_slab_table("birch", S("Birch Slab Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png")
-- support for MineClone 5
if minetest.get_modpath("mcl_mushroom") then
mcl_decor.register_chair_and_table("crimson", S("Crimson Chair"), S("Crimson Table"), "mcl_mushroom:crimson_hyphae_wood", "crimson_hyphae_wood.png", "1")
mcl_decor.register_chair_and_table("warped", S("Warped Chair"), S("Warped Table"), "mcl_mushroom:warped_hyphae_wood", "warped_hyphae_wood.png", "1")
mcl_decor.register_slab_table("crimson", S("Crimson Slab Table"), "mcl_mushroom:crimson_hyphae_wood", "crimson_hyphae_wood.png", "1")
mcl_decor.register_slab_table("warped", S("Warped Slab Table"), "mcl_mushroom:warped_hyphae_wood", "warped_hyphae_wood.png", "1")
end
--- Armchairs ---