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") ![Screenshot](https://i.ibb.co/3YhDML4/Webp-net-gifmaker-2.gif "Crafting")
### Chairs ### 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:** **Screenshot:**

82
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 -- chair part
minetest.register_node("mcl_decor:"..name.."_chair", { minetest.register_node("mcl_decor:"..name.."_chair", {
description = desc, description = desc,
@ -132,7 +138,7 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }, 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_hardness = 1,
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
sounds = mcl_sounds.node_sound_wood_defaults(), 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 -- table part
minetest.register_node("mcl_decor:"..name2.."_table", { minetest.register_node("mcl_decor:"..name.."_table", {
description = desc2, description = desc2,
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -183,13 +189,13 @@ function mcl_decor.register_chair_and_table(name, desc, name2, desc2, material,
paramtype = "light", paramtype = "light",
stack_max = 64, stack_max = 64,
sunlight_propagates = true, 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_hardness = 2,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_decor:"..name2.."_table".." 2", output = "mcl_decor:"..name.."_table".." 2",
recipe = { recipe = {
{material, material, material}, {material, material, material},
{"mcl_core:stick", "", "mcl_core:stick"}, {"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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "mcl_decor:"..name2.."_table", recipe = "mcl_decor:"..name.."_table",
burntime = 10, burntime = 10,
}) })
end 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", { minetest.register_node("mcl_decor:"..name.."_stable", {
description = desc, description = desc,
drawtype = "nodebox", drawtype = "nodebox",
@ -219,7 +230,7 @@ function mcl_decor.register_slab_table(name, desc, material, tiles)
paramtype = "light", paramtype = "light",
stack_max = 64, stack_max = 64,
sunlight_propagates = true, 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_hardness = 2,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -317,7 +328,6 @@ function mcl_decor.register_dyed_planks(color, desc, hexcolor, dye, colorgroup)
) )
end end
-- FIXME: curtains can be placed infinitely just like in creative mode
function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgroup) function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgroup)
minetest.register_node("mcl_decor:curtain_"..color, { minetest.register_node("mcl_decor:curtain_"..color, {
description = desc, description = desc,
@ -344,37 +354,41 @@ function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgrou
}, },
_mcl_blast_resistance = 0.2, _mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
-- taken from mcl_signs (partially) --[[
on_place = function(itemstack, placer, pointed_thing) function below should stop players from placing curtains on floor and ceiling, BUT it makes them infinite (bug)
local above = pointed_thing.above will be uncommented and fixed one day... maybe...
local under = pointed_thing.under ---
on_place = function(itemstack, placer, pointed_thing)
-- taken from mcl_signs (partially)
local above = pointed_thing.above
local under = pointed_thing.under
-- use pointed node's on_rightclick function first, if present -- use pointed node's on_rightclick function first, if present
local node_under = minetest.get_node(under) local node_under = minetest.get_node(under)
if placer and not placer:get_player_control().sneak then if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack
end
end end
end
local dir = vector.subtract(under, above) local dir = vector.subtract(under, above)
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
if wdir == 0 then -- FIXME: curtains can be placed infinitely just like in creative mode
return itemstack if wdir == 0 or wdir == 1 then
elseif wdir == 1 then
return itemstack
else
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
if not success then
return itemstack return itemstack
else
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
if not success then
return itemstack
end
-- V this one SHOULD fix infinite curtains problem, but it doesn't V
if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item()
end
end end
-- V this one SHOULD fix infinite curtains problem, but it doesn't V end,
if not minetest.is_creative_enabled(placer:get_player_name()) then ]]
itemstack:take_item()
end
end
end,
on_rightclick = function(pos, node, _, itemstack) on_rightclick = function(pos, node, _, itemstack)
minetest.set_node(pos, {name="mcl_decor:curtain_"..color.."_closed", param2=node.param2}) minetest.set_node(pos, {name="mcl_decor:curtain_"..color.."_closed", param2=node.param2})
return itemstack return itemstack

View File

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

View File

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

View File

@ -127,12 +127,12 @@ minetest.register_craft({
--- Tables and Chairs --- --- 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("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"), "dark_oak", S("Dark Oak Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.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"), "jungle", S("Jungle Table"), "mcl_core:junglewood", "default_junglewood.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"), "spruce", S("Spruce Table"), "mcl_core:sprucewood", "mcl_core_planks_spruce.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"), "acacia", S("Acacia Table"), "mcl_core:acaciawood", "default_acacia_wood.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"), "birch", S("Birch Table"), "mcl_core:birchwood", "mcl_core_planks_birch.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("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") 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("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") 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 --- --- Armchairs ---