Use dynamic translation for mcl_trees

And document how to use it from the calling mods.

Add a description override mechanism for bark stairs/slabs (a bit
convoluted to remain compatible with existing usage in mcl_crimson),
pressure plates, and buttos. Also clean up fences and fence gates.

Interestingly mcl_core/nodes_trees now uses only translation strings
generated by mcl_trees (into the mcl_core textdomain).
This commit is contained in:
Jürgen Rühle 2024-10-10 19:02:09 +02:00
parent 1bada3bbea
commit 698549eee6
7 changed files with 136 additions and 93 deletions

View File

@ -12,7 +12,7 @@ mcl_util.generate_on_place_plant_function(function(pos)
end) end)
mcl_trees.register_wood("bamboo",{ mcl_trees.register_wood("bamboo",{
readable_name = S("Bamboo"), readable_name = "Bamboo",
sign_color="#FCE6BC", sign_color="#FCE6BC",
sapling = false, sapling = false,
potted_sapling = false, potted_sapling = false,

View File

@ -4,7 +4,7 @@ local S = minetest.get_translator(modname)
local PARTICLE_DISTANCE = 25 local PARTICLE_DISTANCE = 25
mcl_trees.register_wood("cherry_blossom",{ mcl_trees.register_wood("cherry_blossom",{
readable_name = S("Cherry"), readable_name = "Cherry",
sign_color="#F29889", sign_color="#F29889",
tree_schems= { tree_schems= {
{file=modpath.."/schematics/mcl_cherry_blossom_tree_1.mts"}, {file=modpath.."/schematics/mcl_cherry_blossom_tree_1.mts"},

View File

@ -1,10 +1,11 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(minetest.get_current_modname()) -- All required translation strings are currently generated in mcl_trees
-- local S = minetest.get_translator(minetest.get_current_modname())
mcl_trees.register_wood("oak",{ mcl_trees.register_wood("oak",{
readable_name = S("Oak"), readable_name = "Oak",
sign_color="#917056", sign_color="#917056",
tree_schems= { tree_schems= {
{ file = modpath.."/schematics/mcl_core_oak_balloon.mts"}, { file = modpath.."/schematics/mcl_core_oak_balloon.mts"},
@ -45,7 +46,7 @@ mcl_trees.register_wood("oak",{
}) })
mcl_trees.register_wood("dark_oak",{ mcl_trees.register_wood("dark_oak",{
readable_name = S("Dark Oak"), readable_name = "Dark Oak",
sign_color="#625048", sign_color="#625048",
tree_schems_2x2 = { tree_schems_2x2 = {
{ file = modpath.."/schematics/mcl_core_dark_oak.mts"}, { file = modpath.."/schematics/mcl_core_dark_oak.mts"},
@ -74,7 +75,7 @@ mcl_trees.register_wood("dark_oak",{
}) })
mcl_trees.register_wood("jungle",{ mcl_trees.register_wood("jungle",{
readable_name = S("Jungle"), readable_name = "Jungle",
sign_color="#845A43", sign_color="#845A43",
tree_schems = { tree_schems = {
{ file = modpath.."/schematics/mcl_core_jungle_tree.mts"}, { file = modpath.."/schematics/mcl_core_jungle_tree.mts"},
@ -106,7 +107,7 @@ mcl_trees.register_wood("jungle",{
}) })
mcl_trees.register_wood("spruce",{ mcl_trees.register_wood("spruce",{
readable_name = S("Spruce"), readable_name = "Spruce",
sign_color="#604335", sign_color="#604335",
tree_schems = { tree_schems = {
{ file = modpath.."/schematics/mcl_core_spruce_1.mts"}, { file = modpath.."/schematics/mcl_core_spruce_1.mts"},
@ -144,7 +145,7 @@ mcl_trees.register_wood("spruce",{
}) })
mcl_trees.register_wood("acacia",{ mcl_trees.register_wood("acacia",{
readable_name = S("Acacia"), readable_name = "Acacia",
sign_color="#965638", sign_color="#965638",
tree_schems ={ tree_schems ={
{ file = modpath.."/schematics/mcl_core_acacia_1.mts"}, { file = modpath.."/schematics/mcl_core_acacia_1.mts"},
@ -173,7 +174,7 @@ mcl_trees.register_wood("acacia",{
}) })
mcl_trees.register_wood("birch",{ mcl_trees.register_wood("birch",{
readable_name = S("Birch"), readable_name = "Birch",
sign_color="#AA907A", sign_color="#AA907A",
tree_schems = { tree_schems = {
{ file = modpath.."/schematics/mcl_core_birch.mts"}, { file = modpath.."/schematics/mcl_core_birch.mts"},

View File

@ -89,7 +89,7 @@ end
local nether_wood_groups = { handy = 1, axey = 1, material_wood = 1, building_block = 1} local nether_wood_groups = { handy = 1, axey = 1, material_wood = 1, building_block = 1}
mcl_trees.register_wood("crimson",{ mcl_trees.register_wood("crimson",{
readable_name=S("Crimson"), readable_name="Crimson",
sign = {_mcl_burntime = 0 }, sign = {_mcl_burntime = 0 },
sign_color="#810000", sign_color="#810000",
boat=false, boat=false,
@ -152,7 +152,7 @@ mcl_trees.register_wood("crimson",{
}) })
mcl_trees.register_wood("warped",{ mcl_trees.register_wood("warped",{
readable_name=S("Warped"), readable_name="Warped",
sign = {_mcl_burntime = 0 }, sign = {_mcl_burntime = 0 },
sign_color="#0E4C4C", sign_color="#0E4C4C",
boat=false, boat=false,

View File

@ -3,7 +3,7 @@ local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
mcl_trees.register_wood("mangrove",{ mcl_trees.register_wood("mangrove",{
readable_name=S("Mangrove"), readable_name="Mangrove",
sign_color="#8E3731", sign_color="#8E3731",
sapling=false, sapling=false,
saplingdrop="mcl_mangrove:propagule", saplingdrop="mcl_mangrove:propagule",

View File

@ -98,3 +98,23 @@ All features can be disabled by setting them to false, nil will assume default v
}, },
}) })
``` ```
Localization notes:
By default the API will create translatable strings for the node and item
descriptions and some documentation entries automatically by combining the
(untranslated) `readable_name` of the wood definition with the base
descriptions. This automatic generation of translation strings can be bypassed
by passing explicit (already translated) strings in the `description` or
`_doc_items_longdesc` fields of the respective subdefinitions. For bark stairs
and slabs use a `bark` subtable of the `stair` and `slab` subdefinitions (note
that `_doc_items_longdesc` and all other fields *except `description`* are
inherited from the `stair` or `slab` subdefinition), for boat and chest boat use
an `item` subtable of the `boat` or `chestboat` subdefinitions.
For mcla mods the automatically generated strings will be added to the
translation template of the calling mod during the translation update work
flow. Third party mods can either adapt mcla's translation work flow to
automatically generate the translation strings or explicitly provide the
translated strings through the subdefinition fields mentioned above and just use
minetest's standard mod translation update tooling.

View File

@ -1,5 +1,6 @@
-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves, Stripped Wood -- Tree nodes: Wood, Wooden Planks, Sapling, Leaves, Stripped Wood
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local D = mcl_util.get_dynamic_translator()
local bark_stairs = minetest.settings:get_bool("mcl_extra_nodes",true) local bark_stairs = minetest.settings:get_bool("mcl_extra_nodes",true)
local wood_groups = { local wood_groups = {
@ -380,20 +381,22 @@ function mcl_trees.register_wood(name, p)
mcl_trees.woods[name] = p mcl_trees.woods[name] = p
end end
if p.tree == nil or type(p.tree) == "table" then if p.tree == nil or type(p.tree) == "table" then
minetest.register_node(":mcl_trees:".."tree_"..name,table.merge(tpl_log,{ local def = table.merge(tpl_log,{
description = S("@1 Log", rname),
_doc_items_longdesc = S("The trunk of a @1 tree.", rname),
tiles = { minetest.get_current_modname().."_log_"..name.."_top.png", "mcl_core_log_"..name.."_top.png", "mcl_core_log_"..name..".png"}, tiles = { minetest.get_current_modname().."_log_"..name.."_top.png", "mcl_core_log_"..name.."_top.png", "mcl_core_log_"..name..".png"},
_mcl_stripped_variant = "mcl_trees:stripped_"..name, _mcl_stripped_variant = "mcl_trees:stripped_"..name,
},p.tree or {})) },p.tree or {})
def.description = def.description or D(rname .. " Log")
def._doc_items_longdesc = def._doc_items_longdesc or D("The trunk of a " .. rname .. " tree.")
minetest.register_node(":mcl_trees:".."tree_"..name,def)
end end
if p.wood == nil or type(p.wood) == "table" then if p.wood == nil or type(p.wood) == "table" then
minetest.register_node(":mcl_trees:wood_"..name, table.merge(tpl_wood,{ local def = table.merge(tpl_wood,{
description = S("@1 Planks", rname),
_doc_items_longdesc = doc.sub.items.temp.build, _doc_items_longdesc = doc.sub.items.temp.build,
tiles = { minetest.get_current_modname().."_planks_"..name..".png"}, tiles = { minetest.get_current_modname().."_planks_"..name..".png"},
},p.wood or {})) },p.wood or {})
def.description = def.description or D(rname .. " Planks")
minetest.register_node(":mcl_trees:wood_"..name, def)
minetest.register_craft({ minetest.register_craft({
output = "mcl_trees:wood_"..name.." 4", output = "mcl_trees:wood_"..name.." 4",
recipe = { recipe = {
@ -403,13 +406,14 @@ function mcl_trees.register_wood(name, p)
end end
if p.bark == nil or type(p.bark) == "table" then if p.bark == nil or type(p.bark) == "table" then
minetest.register_node(":mcl_trees:bark_"..name,table.merge(tpl_log, { local def = table.merge(tpl_log, {
description = S("@1 Bark", rname),
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."), _doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = p.tree and p.tree.tiles and {p.tree.tiles[3]} or { minetest.get_current_modname().."_log_"..name..".png"}, tiles = p.tree and p.tree.tiles and {p.tree.tiles[3]} or { minetest.get_current_modname().."_log_"..name..".png"},
is_ground_content = false, is_ground_content = false,
_mcl_stripped_variant = "mcl_trees:bark_stripped_"..name, _mcl_stripped_variant = "mcl_trees:bark_stripped_"..name,
}, p.bark or {})) }, p.bark or {})
def.description = def.description or D(rname .. " Bark")
minetest.register_node(":mcl_trees:bark_"..name,def)
minetest.register_craft({ minetest.register_craft({
output = "mcl_trees:bark_"..name.." 3", output = "mcl_trees:bark_"..name.." 3",
recipe = { recipe = {
@ -420,68 +424,70 @@ function mcl_trees.register_wood(name, p)
end end
if p.stripped == nil or type(p.stripped) == "table" then if p.stripped == nil or type(p.stripped) == "table" then
minetest.register_node(":mcl_trees:stripped_"..name, table.merge(tpl_log, { local def = table.merge(tpl_log, {
description = S("Stripped @1 Log", rname),
_doc_items_longdesc = S("The stripped trunk of an @1 tree.", rname),
_doc_items_hidden = false, _doc_items_hidden = false,
tiles = { minetest.get_current_modname().."_stripped_"..name.."_top.png", "mcl_core_stripped_"..name.."_top.png", "mcl_core_stripped_"..name.."_side.png"}, tiles = { minetest.get_current_modname().."_stripped_"..name.."_top.png", "mcl_core_stripped_"..name.."_top.png", "mcl_core_stripped_"..name.."_side.png"},
}, p.stripped or {})) }, p.stripped or {})
def.description = def.description or D("Stripped " .. rname .. " Log")
def._doc_items_longdesc = def._doc_items_longdesc or D("The stripped trunk of an ".. rname .. " tree.")
minetest.register_node(":mcl_trees:stripped_"..name, def)
end end
if p.stripped_bark == nil or type(p.stripped_bark) == "table" then if p.stripped_bark == nil or type(p.stripped_bark) == "table" then
minetest.register_node(":mcl_trees:bark_stripped_"..name, table.merge(tpl_log, { local def = table.merge(tpl_log, {
description = S("Stripped @1 Wood", rname),
_doc_items_longdesc = S("The stripped wood of an @1 tree.", rname),
tiles = { minetest.get_current_modname().."_stripped_"..name.."_side.png"}, tiles = { minetest.get_current_modname().."_stripped_"..name.."_side.png"},
is_ground_content = false, is_ground_content = false,
}, p.stripped_bark or {})) }, p.stripped_bark or {})
def.description = def.description or D("Stripped " .. rname .. " Wood")
def._doc_items_longdesc = def._doc_items_longdesc or D("The stripped wood of an " .. rname .. " tree.")
minetest.register_node(":mcl_trees:bark_stripped_"..name, def)
end end
if p.sapling == nil or type(p.sapling) == "table" then if p.sapling == nil or type(p.sapling) == "table" then
minetest.register_node(":mcl_trees:sapling_"..name, table.merge(tpl_sapling, { local def = table.merge(tpl_sapling, {
description = S("@1 Sapling", rname),
tiles = { minetest.get_current_modname().."_sapling_"..name..".png"}, tiles = { minetest.get_current_modname().."_sapling_"..name..".png"},
inventory_image = minetest.get_current_modname().."_sapling_"..name..".png", inventory_image = minetest.get_current_modname().."_sapling_"..name..".png",
wield_image = minetest.get_current_modname().."_sapling_"..name..".png", wield_image = minetest.get_current_modname().."_sapling_"..name..".png",
}, p.sapling or {})) }, p.sapling or {})
def.description = def.description or D(rname .. " Sapling")
minetest.register_node(":mcl_trees:sapling_"..name, def)
end end
if p.leaves == nil or type(p.leaves) == "table" then if p.leaves == nil or type(p.leaves) == "table" then
register_leaves("leaves_"..name, local def = table.merge({
table.merge({
description = S("@1 Leaves", rname),
_doc_items_longdesc = S("@1 leaves are grown from @2 trees.", rname, rname),
tiles = { minetest.get_current_modname().."_leaves_"..name..".png"}, tiles = { minetest.get_current_modname().."_leaves_"..name..".png"},
}, p.leaves or {} ), }, p.leaves or {})
def.description = def.description or D(rname .. " Leaves")
def._doc_items_longdesc = def._doc_items_longdesc or D(rname .. " leaves are grown from " .. rname .. " trees.")
register_leaves("leaves_"..name, def,
p.saplingdrop or ( "mcl_trees:sapling_"..name ), p.saplingdrop or ( "mcl_trees:sapling_"..name ),
p.drop_apples or false, p.drop_apples or false,
p.sapling_chances or {20, 16, 12, 10} p.sapling_chances or {20, 16, 12, 10}
) )
end end
if p.fence == nil or type(p.fence) == "table" then if p.fence == nil or type(p.fence) == "table" then
p.fence = p.fence or {} local def = table.merge({
mcl_fences.register_fence_def(name.."_fence", table.merge({ tiles = { "mcl_fences_fence_"..name..".png" },
description = p.fence.description or S("@1 Fence", rname), groups = table.merge(wood_groups, { fence_wood = 1 }),
tiles = p.fence.tiles or { "mcl_fences_fence_"..name..".png" }, connects_to = { "group:fence_wood", "group:solid" },
groups = p.fence.groups or table.merge(wood_groups, { fence_wood = 1 }), sounds = wood_sounds,
connects_to = p.fence.connects_to or { "group:fence_wood", "group:solid" }, _mcl_blast_resistance = 3,
sounds = p.fence.sounds or wood_sounds, _mcl_hardness = 2,
_mcl_blast_resistance = p.fence._mcl_blast_resistance or 3, _mcl_burntime = 15,
_mcl_hardness = p.fence._mcl_hardness or 2,
_mcl_burntime = p.fence._mcl_burntime or 15,
_mcl_fences_baseitem = "mcl_trees:wood_"..name _mcl_fences_baseitem = "mcl_trees:wood_"..name
}, p.fence)) }, p.fence or {})
def.description = def.description or D(rname .. " Fence")
mcl_fences.register_fence_def(name.."_fence", def)
end end
if p.fence_gate == nil or type(p.fence_gate) == "table" then if p.fence_gate == nil or type(p.fence_gate) == "table" then
p.fence_gate = p.fence_gate or {} p.fence_gate = p.fence_gate or {}
mcl_fences.register_fence_gate_def(name.."_fence", table.merge({ local def = table.merge({
description = p.fence_gate.description or S("@1 Fence Gate", rname), tiles = { "mcl_fences_fence_"..name..".png" },
tiles = p.fence_gate.tiles or { "mcl_fences_fence_"..name..".png" }, groups = table.merge(wood_groups,{fence_wood = 1}),
groups = p.fence_gate.groups or table.merge(wood_groups,{fence_wood = 1}), _mcl_blast_resistance = 3,
_mcl_blast_resistance = p.fence_gate._mcl_blast_resistance or 3, _mcl_hardness = 2,
_mcl_hardness = p.fence_gate._mcl_hardness or 2, sounds = wood_sounds,
sounds = p.fence_gate.sounds or wood_sounds,
_mcl_fences_sounds = { _mcl_fences_sounds = {
open = { open = {
spec = p.fence_gate.sound_open, spec = p.fence_gate.sound_open,
@ -492,16 +498,20 @@ function mcl_trees.register_wood(name, p)
gain = p.fence_gate.sound_gain_close gain = p.fence_gate.sound_gain_close
} }
}, },
_mcl_burntime = p.fence_gate._mcl_burntime or 15, _mcl_burntime = 15,
_mcl_fences_baseitem = "mcl_trees:wood_"..name}, p.fence_gate)) _mcl_fences_baseitem = "mcl_trees:wood_"..name
}, p.fence_gate)
def.description = def.description or D(rname .. " Fence Gate")
mcl_fences.register_fence_gate_def(name.."_fence", def)
end end
if p.door == nil or type(p.door) == "table" then if p.door == nil or type(p.door) == "table" then
mcl_doors:register_door("mcl_doors:door_"..name,table.merge(tpl_door, { local def = table.merge(tpl_door, {
description = S("@1 Door", rname),
inventory_image = "mcl_doors_door_"..name..".png", inventory_image = "mcl_doors_door_"..name..".png",
tiles_bottom = {"mcl_doors_door_"..name.."_lower.png", "mcl_doors_door_"..name.."_side_lower.png"}, tiles_bottom = {"mcl_doors_door_"..name.."_lower.png", "mcl_doors_door_"..name.."_side_lower.png"},
tiles_top = {"mcl_doors_door_"..name.."_upper.png", "mcl_doors_door_"..name.."_side_upper.png"} tiles_top = {"mcl_doors_door_"..name.."_upper.png", "mcl_doors_door_"..name.."_side_upper.png"}
}, p.door or {})) }, p.door or {})
def.description = def.description or D(rname .. " Door")
mcl_doors:register_door("mcl_doors:door_"..name,def)
minetest.register_craft({ minetest.register_craft({
output = "mcl_doors:door_"..name.." 3", output = "mcl_doors:door_"..name.." 3",
recipe = { recipe = {
@ -512,12 +522,13 @@ function mcl_trees.register_wood(name, p)
}) })
end end
if p.trapdoor == nil or type(p.trapdoor) == "table" then if p.trapdoor == nil or type(p.trapdoor) == "table" then
mcl_doors:register_trapdoor("mcl_doors:trapdoor_"..name,table.merge(tpl_trapdoor, { local def = table.merge(tpl_trapdoor, {
description = S("@1 Trapdoor", rname),
tile_front = "mcl_doors_trapdoor_"..name..".png", tile_front = "mcl_doors_trapdoor_"..name..".png",
tile_side = "mcl_doors_trapdoor_"..name.."_side.png", tile_side = "mcl_doors_trapdoor_"..name.."_side.png",
wield_image = "mcl_doors_trapdoor_"..name..".png", wield_image = "mcl_doors_trapdoor_"..name..".png",
}, p.trapdoor or {})) }, p.trapdoor or {})
def.description = def.description or D(rname .. " Trapdoor")
mcl_doors:register_trapdoor("mcl_doors:trapdoor_"..name,def)
minetest.register_craft({ minetest.register_craft({
output = "mcl_doors:trapdoor_"..name.." 2", output = "mcl_doors:trapdoor_"..name.." 2",
recipe = { recipe = {
@ -529,55 +540,64 @@ function mcl_trees.register_wood(name, p)
if p.stairs == nil or type(p.stairs) == "table" then if p.stairs == nil or type(p.stairs) == "table" then
p.stairs = p.stairs or {} p.stairs = p.stairs or {}
mcl_stairs.register_stair(name, table.merge({ local def = table.merge({
baseitem="mcl_trees:wood_"..name, baseitem="mcl_trees:wood_"..name,
description = S("@1 Stairs", rname),
groups = { wood_stairs = 1 }, groups = { wood_stairs = 1 },
overrides = { overrides = {
_mcl_burntime = 15 _mcl_burntime = 15
}, },
}, p.stairs)) }, p.stairs or {})
def.description = def.description or D(rname .. " Stairs")
mcl_stairs.register_stair(name, def)
if p.bark == nil or type(p.bark) == "table" then if p.bark == nil or type(p.bark) == "table" then
mcl_stairs.register_stair(name.."_bark", table.merge({ local copy = table.copy(p.stairs)
copy.description = nil
def = table.merge({
baseitem="mcl_trees:bark_"..name, baseitem="mcl_trees:bark_"..name,
description = S("@1 Bark Stairs", rname),
groups = { bark_stairs = 1 }, groups = { bark_stairs = 1 },
recipeitem=bark_stairs and "mcl_trees:bark_"..name or "", recipeitem=bark_stairs and "mcl_trees:bark_"..name or "",
overrides = { overrides = {
_mcl_burntime = 15 _mcl_burntime = 15
}, },
}, p.stairs)) }, copy, p.stairs.bark or {})
def.description = def.description or D(rname .. " Bark Stairs")
mcl_stairs.register_stair(name.."_bark", def)
end end
end end
if p.slab == nil or type(p.slab) == "table" then if p.slab == nil or type(p.slab) == "table" then
p.slab = p.slab or {} p.slab = p.slab or {}
mcl_stairs.register_slab(name, table.merge({ local def = table.merge({
baseitem="mcl_trees:wood_"..name, baseitem="mcl_trees:wood_"..name,
description = S("@1 Slab", rname),
groups = { wood_slab = 1 }, groups = { wood_slab = 1 },
register_stair_and_slab = false, register_stair_and_slab = false,
overrides = { overrides = {
_mcl_burntime = 7.5, _mcl_burntime = 7.5,
}, },
}, p.slab)) }, p.slab)
def.description = def.description or D(rname .. " Slab")
mcl_stairs.register_slab(name, def)
if p.bark == nil or type(p.bark) == "table" then if p.bark == nil or type(p.bark) == "table" then
mcl_stairs.register_slab(name.."_bark", table.merge({ local copy = table.copy(p.slab)
copy.description = nil
def = table.merge({
baseitem="mcl_trees:bark_"..name, baseitem="mcl_trees:bark_"..name,
description = S("@1 Bark Slab", rname),
groups = { bark_slab = 1 }, groups = { bark_slab = 1 },
recipeitem=bark_stairs and "mcl_trees:bark_"..name or "", recipeitem=bark_stairs and "mcl_trees:bark_"..name or "",
overrides = { overrides = {
_mcl_burntime = 7.5, _mcl_burntime = 7.5,
}, },
}, p.slab)) }, copy, p.slab.bark or {})
def.description = def.description or D(rname .. " Bark Slab")
mcl_stairs.register_slab(name.."_bark", def)
end end
end end
if p.sign_color and ( p.sign == nil or type(p.sign) == "table" ) then if p.sign_color and ( p.sign == nil or type(p.sign) == "table" ) then
mcl_signs.register_sign(name,p.sign_color,table.merge({ local def = table.merge({
description = S("@1 Sign", rname),
_mcl_burntime = 10 _mcl_burntime = 10
}, p.sign or {})) }, p.sign or {})
def.description = def.description or D(rname .. " Sign")
mcl_signs.register_sign(name,p.sign_color,def)
minetest.register_craft({ minetest.register_craft({
output = "mcl_signs:wall_sign_"..name.." 3", output = "mcl_signs:wall_sign_"..name.." 3",
recipe = { recipe = {
@ -589,9 +609,10 @@ function mcl_trees.register_wood(name, p)
end end
if p.pressure_plate == nil or type(p.pressure_plate) == "table" then if p.pressure_plate == nil or type(p.pressure_plate) == "table" then
p.pressure_plate = p.pressure_plate or {}
mcl_redstone.register_pressure_plate( mcl_redstone.register_pressure_plate(
"mcl_pressureplates:pressure_plate_"..name, "mcl_pressureplates:pressure_plate_"..name,
S("@1 Pressure Plate", rname), p.pressure_plate.description or D(rname .. " Pressure Plate"),
p.wood and p.wood.tiles or { minetest.get_current_modname().."_planks_"..name..".png"}, p.wood and p.wood.tiles or { minetest.get_current_modname().."_planks_"..name..".png"},
p.wood and p.wood.tiles or { minetest.get_current_modname().."_planks_"..name..".png"}, p.wood and p.wood.tiles or { minetest.get_current_modname().."_planks_"..name..".png"},
p.wood and p.wood.tiles[1] or "mcl_core_planks_"..name..".png", p.wood and p.wood.tiles[1] or "mcl_core_planks_"..name..".png",
@ -601,12 +622,13 @@ function mcl_trees.register_wood(name, p)
{axey=1, material_wood=1}, {axey=1, material_wood=1},
nil, nil,
S("A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."), S("A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."),
p.pressure_plate and p.pressure_plate._mcl_burntime or 15 p.pressure_plate._mcl_burntime or 15
) )
end end
if p.button == nil or type(p.button) == "table" then if p.button == nil or type(p.button) == "table" then
p.button = p.button or {}
mcl_buttons.register_button(name, { mcl_buttons.register_button(name, {
description = S("@1 Button", rname), description = p.button.description or D(rname .. " Button"),
texture = p.wood and p.wood.tiles[1] or "mcl_core_planks_"..name..".png", texture = p.wood and p.wood.tiles[1] or "mcl_core_planks_"..name..".png",
recipeitem = "mcl_trees:wood_"..name, recipeitem = "mcl_trees:wood_"..name,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -615,30 +637,30 @@ function mcl_trees.register_wood(name, p)
push_by_arrow = true, push_by_arrow = true,
longdesc = S("A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows."), longdesc = S("A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows."),
push_sound = "mesecons_button_push_wood", push_sound = "mesecons_button_push_wood",
burntime = p.button and p.button._mcl_burntime or 5, burntime = p.button._mcl_burntime or 5,
}) })
end end
if (p.sapling == nil or type(p.sapling) == "table") and (p.potted_sapling == nil or type(p.potted_sapling) == "table") then if (p.sapling == nil or type(p.sapling) == "table") and (p.potted_sapling == nil or type(p.potted_sapling) == "table") then
mcl_flowerpots.register_potted_flower("mcl_trees:sapling_"..name, table.merge({ local def = table.merge({
name = "sapling_"..name, name = "sapling_"..name,
desc = S("@1 Sapling", rname),
image = minetest.get_current_modname().."_sapling_"..name..".png", image = minetest.get_current_modname().."_sapling_"..name..".png",
},p.potted_sapling or {})) },p.potted_sapling or {})
def.desc = def.desc or D(rname .. " Sapling")
mcl_flowerpots.register_potted_flower("mcl_trees:sapling_"..name, def)
end end
if p.boat == nil or type(p.boat) == "table" then if p.boat == nil or type(p.boat) == "table" then
p.boat = p.boat or {} p.boat = p.boat or {}
mcl_boats.register_boat(name,table.merge({ local def = table.copy(p.boat.item or {})
description = S("@1 Boat", rname), def.description = def.description or D(rname .. " Boat")
}, p.boat.item or {}), p.boat.object or {}, p.boat.entity or {}) mcl_boats.register_boat(name,def, p.boat.object or {}, p.boat.entity or {})
end end
if p.chest_boat == nil or type(p.chest_boat) == "table" then if p.chest_boat == nil or type(p.chest_boat) == "table" then
p.chest_boat = p.chest_boat or {} p.chest_boat = p.chest_boat or {}
mcl_boats.register_boat(name.."_chest",table.merge({ local def = table.copy(p.chest_boat.item or {})
description = S("@1 Chest Boat", rname), def.description = def.description or D(rname .. " Chest Boat")
}, p.chest_boat.item or {}), p.chest_boat.object or {}, p.chest_boat.entity or {}) mcl_boats.register_boat(name.."_chest", def, p.chest_boat.object or {}, p.chest_boat.entity or {})
end end
end end