Compare commits

...

2 Commits

2 changed files with 25 additions and 32 deletions

View File

@ -6,15 +6,15 @@ Hollow logs mostly have a decorative function, but some of them can be used in r
## Functions: ## Functions:
### ```vl_hollow_logs.register_hollow_log(defs)``` ### ```vl_hollow_logs.register_hollow_log(defs)```
This is the function that registers the hollow trunk. This is the function that registers the hollow trunk.
For a hollow log to be registered, the <span style="color:firebrick"> defs </span> parameter must be a table that contains up to 5 values, which are, in this order, the <span style="color:firebrick"> itemstring </span> of the hollow log, the <span style="color:firebrick"> itemstring </span> of the stripped hollow log, the <span style="color:firebrick"> description </span> of the hollow log, the <span style="color:firebrick"> description </span> of the stripped hollow log and, optionally, a <span style="color:turquoise"> boolean </span> to inform whether this trunk is NOT flammable. If the hollow log is defined as flammable, it becomes part of the <span style="color:springgreen"> hollow_log_flammable </span> group, which allows the log to be used as fuel for furnaces and also allows it to be an ingredient for chacoal. For a hollow log to be registered, the <span style="color:firebrick"> defs </span> parameter must be a table that contains up to 5 values, which are, in this order, the <span style="color:firebrick"> itemstring </span> of the hollow log, the <span style="color:firebrick"> itemstring </span> of the stripped hollow log, the <span style="color:firebrick"> description </span> of the hollow log, the <span style="color:firebrick"> description </span> of the stripped hollow log and, optionally, a <span style="color:turquoise"> boolean </span> to inform whether this trunk is NOT flammable. If the hollow log is defined as flammable, it becomes part of the <span style="color:springgreen"> hollow_log_burnable </span> group, which allows the log to be used as fuel for furnaces and also allows it to be an ingredient for chacoal.
Examples: Examples:
```lua ```lua
-- Flammable -- Flammable
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"} {"tree", "stripped_oak", S("Hollow Oak Log"), S("Stripped Hollow Oak Log")}
-- Not flammable -- Not flammable
{"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true} {"crimson_hyphae", "stripped_crimson_hyphae", S("Hollow Crimson Stem"), S("Stripped Hollow Crimson Stem"), true}
``` ```
### ```vl_hollow_logs.register_craft(material, result)``` ### ```vl_hollow_logs.register_craft(material, result)```

View File

@ -46,9 +46,9 @@ function vl_hollow_logs.register_hollow_log(defs)
table.update(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1}) table.update(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1})
end end
minetest.register_node(modname .. ":"..name.."_hollow", { local hollow_log_def = {
collision_box = collisionbox, collision_box = collisionbox,
description = S(desc), description = desc,
drawtype = "mesh", drawtype = "mesh",
groups = groups, groups = groups,
mesh = "vl_hollow_logs_log.obj", mesh = "vl_hollow_logs_log.obj",
@ -58,51 +58,44 @@ function vl_hollow_logs.register_hollow_log(defs)
use_texture_alpha = "clip", use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true, sunlight_propagates = true,
climbable = true,
tiles = {modname .. "_"..name..".png"}, tiles = {modname .. "_"..name..".png"},
_mcl_blast_resistance = 2, _mcl_blast_resistance = 2,
_mcl_hardness = 2, _mcl_hardness = 2,
_mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow" _mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow"
}) }
minetest.register_node(modname .. ":"..stripped_name.."_hollow", { local stripped_hollow_log_def = table.copy(hollow_log_def)
collision_box = collisionbox, stripped_hollow_log_def.description = stripped_desc
description = S(stripped_desc), stripped_hollow_log_def.tiles = {modname .. "_stripped_"..name..".png"}
drawtype = "mesh", stripped_hollow_log_def._mcl_stripped_variant = nil
groups = groups,
mesh = "vl_hollow_logs_log.obj", minetest.register_node(modname .. ":"..name.."_hollow", hollow_log_def)
on_place = mcl_util.rotate_axis,
paramtype = "light", minetest.register_node(modname .. ":"..stripped_name.."_hollow", stripped_hollow_log_def)
paramtype2 = "facedir",
use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {modname .. "_stripped_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end end
vl_hollow_logs.logs = { vl_hollow_logs.logs = {
{"acaciatree", "stripped_acacia", "Hollow Acacia Log", "Stripped Hollow Acacia Log"}, {"acaciatree", "stripped_acacia", S("Hollow Acacia Log"), S("Stripped Hollow Acacia Log")},
{"birchtree", "stripped_birch", "Hollow Birch Log", "Stripped Hollow Birch Log"}, {"birchtree", "stripped_birch", S("Hollow Birch Log"), S("Stripped Hollow Birch Log")},
{"darktree", "stripped_dark_oak", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"}, {"darktree", "stripped_dark_oak", S("Hollow Dark Oak Log"), S("Stripped Hollow Dark Oak Log")},
{"jungletree", "stripped_jungle", "Hollow Jungle Log", "Stripped Hollow Jungle Log"}, {"jungletree", "stripped_jungle", S("Hollow Jungle Log"), S("Stripped Hollow Jungle Log")},
{"sprucetree", "stripped_spruce", "Hollow Spruce Log", "Stripped Hollow Spruce Log"}, {"sprucetree", "stripped_spruce", S("Hollow Spruce Log"), S("Stripped Hollow Spruce Log")},
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"} {"tree", "stripped_oak", S("Hollow Oak Log"), S("Stripped Hollow Oak Log")}
} }
if minetest.get_modpath("mcl_cherry_blossom") then if minetest.get_modpath("mcl_cherry_blossom") then
table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"}) table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", S("Hollow Cherry Log"), S("Stripped Hollow Cherry Log")})
end end
if minetest.get_modpath("mcl_mangrove") then if minetest.get_modpath("mcl_mangrove") then
table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"}) table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", S("Hollow Mangrove Log"), S("Stripped Hollow Mangrove Log")})
end end
if minetest.get_modpath("mcl_crimson") then if minetest.get_modpath("mcl_crimson") then
table.insert(vl_hollow_logs.logs, {"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true}) table.insert(vl_hollow_logs.logs, {"crimson_hyphae", "stripped_crimson_hyphae", S("Hollow Crimson Stem"), S("Stripped Hollow Crimson Stem"), true})
table.insert(vl_hollow_logs.logs, {"warped_hyphae", "stripped_warped_hyphae", "Hollow Warped Stem", "Stripped Hollow Warped Stem", true}) table.insert(vl_hollow_logs.logs, {"warped_hyphae", "stripped_warped_hyphae", S("Hollow Warped Stem"), S("Stripped Hollow Warped Stem"), true})
end end
for _, defs in pairs(vl_hollow_logs.logs) do for _, defs in pairs(vl_hollow_logs.logs) do