forked from rudzik8/mcl_decor
API refactoring: make chairs/tables registation simplier
and get rid of the iron ones because they look silly and i don't think anybody would use 'em in their buildings
This commit is contained in:
parent
1b28bc08eb
commit
d429d73ae0
71
api.lua
71
api.lua
|
@ -52,9 +52,9 @@ end
|
|||
|
||||
|
||||
|
||||
function mcl_decor:register_chair(name, def)
|
||||
function mcl_decor.register_chair(name, desc, material, tiles)
|
||||
minetest.register_node(name, {
|
||||
description = def.description,
|
||||
description = desc,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -67,7 +67,7 @@ function mcl_decor:register_chair(name, def)
|
|||
{-0.25, -0.5, -0.25, -0.125, -0.125, -0.125}, -- 4th leg
|
||||
}
|
||||
},
|
||||
tiles = def.tiles,
|
||||
tiles = {tiles},
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -77,23 +77,38 @@ function mcl_decor:register_chair(name, def)
|
|||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 },
|
||||
},
|
||||
--[[
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 },
|
||||
},
|
||||
]]
|
||||
groups = def.groups,
|
||||
_mcl_hardness = def._mcl_hardness,
|
||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||
sounds = def.sounds,
|
||||
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(),
|
||||
on_rightclick = mcl_decor.sit
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{material, material, material},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
{"mcl_core:stick", "", ""},
|
||||
{material, material, material},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = name,
|
||||
burntime = 8,
|
||||
})
|
||||
end
|
||||
|
||||
function mcl_decor:register_table(name, def)
|
||||
function mcl_decor.register_table(name, desc, material, tiles)
|
||||
minetest.register_node(name, {
|
||||
description = def.description,
|
||||
description = desc,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -107,17 +122,29 @@ function mcl_decor:register_table(name, def)
|
|||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, -- default 1x1 selection box (to override that weird selection of just the nodebox itself)
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
},
|
||||
tiles = def.tiles,
|
||||
tiles = {tiles},
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
stack_max = 64,
|
||||
sunlight_propagates = true,
|
||||
groups = def.groups,
|
||||
_mcl_hardness = def._mcl_hardness,
|
||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||
sounds = def.sounds,
|
||||
-- TODO: make tables connect with each other???
|
||||
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,
|
||||
recipe = {
|
||||
{material, material, material},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = name,
|
||||
burntime = 10,
|
||||
})
|
||||
end
|
||||
|
|
|
@ -9,11 +9,9 @@ Birch Chair=Берёзовый стул
|
|||
Dark Oak Chair=Стул из тёмного дуба
|
||||
Jungle Chair=Стул из тропического дерева
|
||||
Spruce Chair=Еловый стул
|
||||
Iron Chair=Железный стул
|
||||
Oak Table=Дубовый стол
|
||||
Acacia Table=Стол из акации
|
||||
Birch Table=Берёзовый стол
|
||||
Dark Oak Table=Стол из тёмного дуба
|
||||
Jungle Table=Стол из тропического дерева
|
||||
Spruce Table=Еловый стол
|
||||
Iron Table=Железый стол
|
||||
|
|
|
@ -9,11 +9,9 @@ Birch Chair=
|
|||
Dark Oak Chair=
|
||||
Jungle Chair=
|
||||
Spruce Chair=
|
||||
Iron Chair=
|
||||
Oak Table=
|
||||
Acacia Table=
|
||||
Birch Table=
|
||||
Dark Oak Table=
|
||||
Jungle Table=
|
||||
Spruce Table=
|
||||
Iron Table=
|
||||
|
|
325
register.lua
325
register.lua
|
@ -102,316 +102,17 @@ minetest.register_craft({
|
|||
|
||||
|
||||
|
||||
--- Oak Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:wooden_chair", {
|
||||
description = S("Oak Chair"),
|
||||
tiles = {"default_wood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:wooden_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:wood", "mcl_core:wood", "mcl_core:wood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:wooden_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
--- Tables and Chairs ---
|
||||
mcl_decor.register_chair("mcl_decor:wooden_chair", S("Oak Chair"), "mcl_core:wood", "default_wood.png")
|
||||
mcl_decor.register_chair("mcl_decor:dark_oak_chair", S("Dark Oak Chair"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png")
|
||||
mcl_decor.register_chair("mcl_decor:jungle_chair", S("Jungle Chair"), "mcl_core:junglewood", "default_junglewood.png")
|
||||
mcl_decor.register_chair("mcl_decor:spruce_chair", S("Spruce Chair"), "mcl_core:sprucewood", "mcl_core_planks_spruce.png")
|
||||
mcl_decor.register_chair("mcl_decor:acacia_chair", S("Acacia Chair"), "mcl_core:acaciawood", "default_acacia_wood.png")
|
||||
mcl_decor.register_chair("mcl_decor:birch_chair", S("Birch Chair"), "mcl_core:birchwood", "mcl_core_planks_birch.png")
|
||||
|
||||
--- Acacia Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:acacia_chair", {
|
||||
description = S("Acacia Chair"),
|
||||
tiles = {"default_acacia_wood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:acacia_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:acaciawood", "mcl_core:acaciawood", "mcl_core:acaciawood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:acacia_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
--- Birch Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:birch_chair", {
|
||||
description = S("Birch Chair"),
|
||||
tiles = {"mcl_core_planks_birch.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:birch_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:birchwood", "mcl_core:birchwood", "mcl_core:birchwood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:birch_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
--- Dark Oak Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:dark_oak_chair", {
|
||||
description = S("Dark Oak Chair"),
|
||||
tiles = {"mcl_core_planks_big_oak.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:dark_oak_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:darkwood", "mcl_core:darkwood", "mcl_core:darkwood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:dark_oak_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
--- Jungle Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:jungle_chair", {
|
||||
description = S("Jungle Chair"),
|
||||
tiles = {"default_junglewood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:jungle_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:junglewood", "mcl_core:junglewood", "mcl_core:junglewood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:jungle_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
--- Spruce Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:spruce_chair", {
|
||||
description = S("Spruce Chair"),
|
||||
tiles = {"mcl_core_planks_spruce.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:spruce_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:sprucewood", "mcl_core:sprucewood", "mcl_core:sprucewood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:spruce_chair",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
--- Iron Chair ---
|
||||
mcl_decor:register_chair("mcl_decor:iron_chair", {
|
||||
description = S("Iron Chair"),
|
||||
tiles = {"default_steel_block.png"},
|
||||
groups = {pickaxey=2, attached_node=1, deco_block=1},
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 5,
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:iron_chair 2",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
--- Oak Table ---
|
||||
mcl_decor:register_table("mcl_decor:wooden_table", {
|
||||
description = S("Oak Table"),
|
||||
tiles = {"default_wood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:wooden_table",
|
||||
recipe = {
|
||||
{"mcl_core:wood", "mcl_core:wood", "mcl_core:wood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:wooden_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Acacia Table ---
|
||||
mcl_decor:register_table("mcl_decor:acacia_table", {
|
||||
description = S("Acacia Table"),
|
||||
tiles = {"default_acacia_wood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:acacia_table",
|
||||
recipe = {
|
||||
{"mcl_core:acaciawood", "mcl_core:acaciawood", "mcl_core:acaciawood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:acacia_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Birch Table ---
|
||||
mcl_decor:register_table("mcl_decor:birch_table", {
|
||||
description = S("Birch Table"),
|
||||
tiles = {"mcl_core_planks_birch.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:birch_table",
|
||||
recipe = {
|
||||
{"mcl_core:birchwood", "mcl_core:birchwood", "mcl_core:birchwood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:birch_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Dark Oak Table ---
|
||||
mcl_decor:register_table("mcl_decor:dark_oak_table", {
|
||||
description = S("Dark Oak Table"),
|
||||
tiles = {"mcl_core_planks_big_oak.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:dark_oak_table",
|
||||
recipe = {
|
||||
{"mcl_core:darkwood", "mcl_core:darkwood", "mcl_core:darkwood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:dark_oak_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Jungle Table ---
|
||||
mcl_decor:register_table("mcl_decor:jungle_table", {
|
||||
description = S("Jungle Table"),
|
||||
tiles = {"default_junglewood.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:jungle_table",
|
||||
recipe = {
|
||||
{"mcl_core:junglewood", "mcl_core:junglewood", "mcl_core:junglewood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:jungle_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Spruce Table ---
|
||||
mcl_decor:register_table("mcl_decor:spruce_table", {
|
||||
description = S("Spruce Table"),
|
||||
tiles = {"mcl_core_planks_spruce.png"},
|
||||
groups = {handy=1, axey=1, attached_node=1, material_wood=1, deco_block=1, flammable=-1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 3,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:spruce_table",
|
||||
recipe = {
|
||||
{"mcl_core:sprucewood", "mcl_core:sprucewood", "mcl_core:sprucewood"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mcl_decor:spruce_table",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
--- Iron Table ---
|
||||
mcl_decor:register_table("mcl_decor:iron_table", {
|
||||
description = S("Iron Table"),
|
||||
tiles = {"default_steel_block.png"},
|
||||
groups = {pickaxey=2, attached_node=1, deco_block=1},
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 5,
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_decor:iron_table",
|
||||
recipe = {
|
||||
{"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"},
|
||||
{"mcl_core:stick", "", "mcl_core:stick"}
|
||||
}
|
||||
})
|
||||
mcl_decor.register_table("mcl_decor:wooden_table", S("Oak Table"), "mcl_core:wood", "default_wood.png")
|
||||
mcl_decor.register_table("mcl_decor:dark_oak_table", S("Dark Oak Table"), "mcl_core:darkwood", "mcl_core_planks_big_oak.png")
|
||||
mcl_decor.register_table("mcl_decor:jungle_table", S("Jungle Table"), "mcl_core:junglewood", "default_junglewood.png")
|
||||
mcl_decor.register_table("mcl_decor:spruce_table", S("Spruce Table"), "mcl_core:sprucewood", "default_wood.png")
|
||||
mcl_decor.register_table("mcl_decor:acacia_table", S("Acacia Table"), "mcl_core:acaciawood", "default_acacia_wood.png")
|
||||
mcl_decor.register_table("mcl_decor:birch_table", S("Birch Table"), "mcl_core:birchwood", "mcl_core_planks_birch.png")
|
||||
|
|
Loading…
Reference in New Issue