0
0
Fork 0

Hollow logs (#4267)

Reviewed-on: MineClone2/MineClone2#4267
Co-authored-by: JoseDouglas26 <josedouglas20002014@gmail.com>
Co-committed-by: JoseDouglas26 <josedouglas20002014@gmail.com>
This commit is contained in:
JoseDouglas26 2024-04-30 00:24:12 +00:00 committed by the-real-herowl
parent 538c206985
commit 1161d5cd36
27 changed files with 435 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# ```vl_hollow_logs```
This mod registers hollow logs derived from normal logs.
Hollow logs mostly have a decorative function, but some of them can be used in recipes. Changes may appear soon.
## Functions:
### ```vl_hollow_logs.register_hollow_log(defs)```
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.
Examples:
```lua
-- Flammable
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
-- Not flammable
{"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true}
```
### ```vl_hollow_logs.register_craft(material, result)```
This function records the crafting recipe for a hollow log based on its non-hollow variant.
This function also defines a recipe for the stonecutter. The <span style="color:firebrick"> material </span> and <span style="color:firebrick"> result </span> parameters must be, respectively, the <span style="color:firebrick"> complete itemstring </span> of the source material and the (partial) <span style="color:firebrick"> itemstring </span> of the result. See the following examples:
```lua
vl_hollow_logs.register_craft("mcl_core:tree", "tree")
vl_hollow_logs.register_craft("mcl_crimson:stripped_crimson_hyphae", "stripped_crimson_hyphae")
```

View File

@ -0,0 +1,106 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname())
vl_hollow_logs = {}
--- Function to register a hollow log. See API.md to learn how to use this function.
---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil}
function vl_hollow_logs.register_hollow_log(defs)
if not defs or #defs < 4 then
return
end
for i = 1, #defs do
if i == 5 then
if type(defs[i]) ~= "boolean" and type(defs[i]) ~= "nil" then
return
end
else
if type(defs[i]) ~= "string" then
return
end
end
end
local name = defs[1]
local stripped_name = defs[2]
local desc = defs[3]
local stripped_desc = defs[4]
local collisionbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375},
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
}
}
local groups = {axey = 1, building_block = 1, handy = 1, hollow_log = 1}
if not defs[5] then
groups = table.insert(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1})
end
minetest.register_node("vl_hollow_logs:"..name.."_hollow", {
collision_box = collisionbox,
description = S(desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"vl_hollow_logs_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "vl_hollow_logs:stripped_"..name.."_hollow"
})
minetest.register_node("vl_hollow_logs:"..stripped_name.."_hollow", {
collision_box = collisionbox,
description = S(stripped_desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"vl_hollow_logs_stripped_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
vl_hollow_logs.logs = {
{"acaciatree", "stripped_acacia", "Hollow Acacia Log", "Stripped Hollow Acacia Log"},
{"birchtree", "stripped_birch", "Hollow Birch Log", "Stripped Hollow Birch Log"},
{"darktree", "stripped_dark_oak", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"},
{"jungletree", "stripped_jungle", "Hollow Jungle Log", "Stripped Hollow Jungle Log"},
{"sprucetree", "stripped_spruce", "Hollow Spruce Log", "Stripped Hollow Spruce Log"},
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
}
if minetest.get_modpath("mcl_cherry_blossom") then
table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"})
end
if minetest.get_modpath("mcl_mangrove") then
table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"})
end
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, {"warped_hyphae", "stripped_warped_hyphae", "Hollow Warped Stem", "Stripped Hollow Warped Stem", true})
end
for _, defs in pairs(vl_hollow_logs.logs) do
vl_hollow_logs.register_hollow_log(defs)
end
dofile(modpath.."/recipes.lua")

View File

@ -0,0 +1,21 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=
Hollow Birch Log=
Hollow Cherry Log=
Hollow Dark Oak Log=
Hollow Jungle Log=
Hollow Mangrove Log=
Hollow Oak Log=
Hollow Spruce Log=
Hollow Crimson Stem=
Hollow Warped Stem=
Stripped Hollow Acacia Log=
Stripped Hollow Birch Log=
Stripped Hollow Cherry Log=
Stripped Hollow Dark Oak Log=
Stripped Hollow Jungle Log=
Stripped Hollow Mangrove Log=
Stripped Hollow Oak Log=
Stripped Hollow Spruce Log=
Stripped Hollow Crimson Stem=
Stripped Hollow Warped Stem=

View File

@ -0,0 +1,21 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=Tronco Oco de Acácia
Hollow Birch Log=Tronco Oco de Bétula
Hollow Cherry Log=Tronco Oco de Cerejeira
Hollow Dark Oak Log=Tronco Oco de Carvalho Escuro
Hollow Jungle Log=Tronco Oco da Selva
Hollow Mangrove Log=Tronco Oco de Mangue
Hollow Oak Log=Tronco Oco de Carvalho
Hollow Spruce Log=Tronco Oco de Pinheiro
Hollow Crimson Stem=Caule Oco Carmesim
Hollow Warped Stem=Caule Oco Distorcido
Stripped Hollow Acacia Log=Tronco Oco Descascado de Acácia
Stripped Hollow Birch Log=Tronco Oco Descascado de Bétula
Stripped Hollow Cherry Log=Tronco Oco Descascado de Cerejeira
Stripped Hollow Dark Oak Log=Tronco Oco Descascado de Carvalho Escuro
Stripped Hollow Jungle Log=Tronco Oco Descascado da Selva
Stripped Hollow Mangrove Log=Tronco Oco Descascado de Mangue
Stripped Hollow Oak Log=Tronco Oco Descascado de Carvalho
Stripped Hollow Spruce Log=Tronco Oco Descascado de Pinheiro
Stripped Hollow Crimson Stem=Caule Oco Descascado Carmesim
Stripped Hollow Warped Stem=Caule Oco Descascado Distorcido

View File

@ -0,0 +1,4 @@
name = vl_hollow_logs
depends = mcl_core, mcl_sounds, mcl_util
optional_depends = mcl_cherry_blossom, mcl_crimson, mcl_mangrove
author = JoseDouglas26

View File

@ -0,0 +1,207 @@
# Blender 3.6.4
# www.blender.org
mtllib mcl_hollowed_logs_log.mtl
o Cubo.006
v 0.312500 -0.500000 0.312500
v 0.312500 0.500000 0.312500
v 0.312500 -0.500000 0.500000
v 0.312500 0.500000 0.500000
v -0.312500 -0.500000 0.312500
v -0.312500 0.500000 0.312500
v -0.312500 -0.500000 0.500000
v -0.312500 0.500000 0.500000
v -0.312500 -0.500000 0.312500
v -0.312500 0.500000 0.312500
v -0.312500 -0.500000 0.500000
v -0.312500 0.500000 0.500000
v -0.500000 -0.500000 0.312500
v -0.500000 0.500000 0.312500
v -0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 -0.500000 -0.312500
v 0.500000 0.500000 -0.312500
v 0.312500 -0.500000 -0.500000
v 0.312500 0.500000 -0.500000
v 0.312500 -0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v -0.312500 -0.500000 -0.500000
v -0.312500 0.500000 -0.500000
v -0.312500 -0.500000 -0.312500
v -0.312500 0.500000 -0.312500
v -0.500000 -0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v -0.500000 -0.500000 -0.312500
v -0.500000 0.500000 -0.312500
v 0.500000 -0.500000 0.312500
v 0.500000 0.500000 0.312500
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
v 0.312500 -0.500000 0.312500
v 0.312500 0.500000 0.312500
v 0.312500 -0.500000 0.500000
v 0.312500 0.500000 0.500000
v -0.312500 -0.500000 -0.312500
v -0.312500 0.500000 -0.312500
v -0.312500 -0.500000 0.312500
v -0.312500 0.500000 0.312500
v -0.500000 -0.500000 -0.312500
v -0.500000 0.500000 -0.312500
v -0.500000 -0.500000 0.312500
v -0.500000 0.500000 0.312500
v 0.500000 -0.500000 -0.312500
v 0.500000 0.500000 -0.312500
v 0.500000 -0.500000 0.312500
v 0.500000 0.500000 0.312500
v 0.312500 -0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v 0.312500 -0.500000 0.312500
v 0.312500 0.500000 0.312500
v 0.312500 -0.500000 -0.500000
v 0.312500 0.500000 -0.500000
v 0.312500 -0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v -0.312500 -0.500000 -0.500000
v -0.312500 0.500000 -0.500000
v -0.312500 -0.500000 -0.312500
v -0.312500 0.500000 -0.312500
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.135417 0.500000
vt 0.135417 1.000000
vt 0.031250 1.000000
vt 0.031250 0.500000
vt 0.375000 0.500000
vt 0.625000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.135417 0.000000
vt 0.031250 0.000000
vt 0.635417 1.000000
vt 0.531250 1.000000
vt 0.531250 0.906250
vt 0.635417 0.906250
vt 0.468750 1.000000
vt 0.364583 1.000000
vt 0.364583 0.906250
vt 0.468750 0.906250
vt 0.000000 1.000000
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.968750 1.000000
vt 0.968750 0.500000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.666667 0.906250
vt 0.666667 1.000000
vt 0.500000 1.000000
vt 0.500000 0.906250
vt 0.333333 0.500000
vt 0.333333 1.000000
vt 0.302083 1.000000
vt 0.302083 0.500000
vt 0.697917 0.500000
vt 0.697917 1.000000
vt 0.666667 0.500000
vt 0.666667 0.593750
vt 0.635417 0.593750
vt 0.635417 0.500000
vt 0.364583 0.593750
vt 0.333333 0.593750
vt 0.364583 0.500000
vt 0.864583 0.500000
vt 0.864583 1.000000
vt 0.833333 1.000000
vt 0.833333 0.500000
vt 0.802083 1.000000
vt 0.802083 0.500000
vt 0.531250 0.593750
vt 0.500000 0.593750
vt 0.500000 0.500000
vt 0.531250 0.500000
vt 0.468750 0.593750
vt 0.468750 0.500000
vt 0.500000 0.500000
vt 0.197917 0.500000
vt 0.197917 1.000000
vt 0.166667 1.000000
vt 0.166667 0.500000
vt 0.166667 0.500000
vt 0.166667 1.000000
vt 0.135417 1.000000
vt 0.135417 0.500000
vt 0.333333 0.906250
vt 0.968750 0.000000
vt 0.864583 0.000000
vt 0.197917 1.000000
vt 0.197917 0.500000
vt 0.302083 0.000000
vt 0.197917 0.500000
vt 0.197917 0.000000
vt 0.364583 0.906250
vt 0.333333 0.906250
vt 0.802083 0.000000
vt 0.697917 0.000000
vt 0.364583 0.593750
vt 0.364583 0.500000
vt 0.468750 0.500000
s 0
usemtl Materiais
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 8/7/2 7/8/2
f 7/9/3 8/10/3 6/11/3 5/12/3
f 5/13/4 6/5/4 2/8/4 1/14/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 8/19/6 4/20/6 2/21/6 6/22/6
f 9/1/1 10/2/1 12/3/1 11/4/1
f 11/8/2 12/7/2 16/23/2 15/24/2
f 15/25/3 16/26/3 14/27/3 13/28/3
f 13/12/4 14/11/4 10/29/4 9/30/4
f 11/31/5 15/32/5 13/15/5 9/18/5
f 16/33/6 12/19/6 10/22/6 14/34/6
f 17/35/1 18/36/1 20/37/1 19/38/1
f 19/4/2 20/3/2 24/10/2 23/9/2
f 23/9/3 24/10/3 22/11/3 21/12/3
f 21/39/4 22/40/4 18/32/4 17/41/4
f 19/42/5 23/43/5 21/44/5 17/41/5
f 24/45/6 20/46/6 18/35/6 22/47/6
f 25/1/1 26/2/1 28/3/1 27/4/1
f 27/4/2 28/3/2 32/10/2 31/9/2
f 31/48/3 32/49/3 30/50/3 29/51/3
f 29/51/4 30/50/4 26/52/4 25/53/4
f 27/54/5 31/55/5 29/56/5 25/57/5
f 32/55/6 28/58/6 26/59/6 30/60/6
f 33/61/1 34/62/1 36/63/1 35/64/1
f 35/65/2 36/66/2 40/67/2 39/68/2
f 39/9/3 40/10/3 38/11/3 37/12/3
f 37/12/4 38/11/4 34/29/4 33/30/4
f 35/33/5 39/34/5 37/17/5 33/16/5
f 40/20/6 36/36/6 34/69/6 38/21/6
f 41/70/1 42/28/1 44/48/1 43/71/1
f 43/4/2 44/3/2 48/10/2 47/9/2
f 47/28/3 48/27/3 46/49/3 45/48/3
f 45/12/4 46/11/4 42/29/4 41/30/4
f 43/17/5 47/34/5 45/55/5 41/54/5
f 48/34/6 44/22/6 42/58/6 46/55/6
f 49/38/1 50/37/1 52/72/1 51/73/1
f 51/4/2 52/3/2 56/10/2 55/9/2
f 55/74/3 56/38/3 54/75/3 53/76/3
f 53/12/4 54/11/4 50/29/4 49/30/4
f 51/31/5 55/18/5 53/43/5 49/42/5
f 56/77/6 52/78/6 50/46/6 54/45/6
f 57/1/1 58/2/1 60/3/1 59/4/1
f 59/79/2 60/53/2 64/39/2 63/80/2
f 63/9/3 64/10/3 62/11/3 61/12/3
f 61/53/4 62/52/4 58/40/4 57/39/4
f 59/43/5 63/54/5 61/57/5 57/44/5
f 64/58/6 60/81/6 58/82/6 62/83/6

View File

@ -0,0 +1,48 @@
function vl_hollow_logs.register_craft(material, result)
minetest.register_craft({
output = "vl_hollow_logs:"..result.."_hollow 4",
recipe = {
{"", material, ""},
{material, "", material},
{"", material, ""}
},
type = "shaped"
})
mcl_stonecutter.register_recipe(material, "vl_hollow_logs:"..result.."_hollow", 1)
end
for _, defs in pairs(vl_hollow_logs.logs) do
local mod, material, stripped_material
local name = defs[1]
local stripped_name = defs[2]
if name:find("cherry") then
mod = "mcl_cherry_blossom:"
elseif name:find("mangrove") then
mod = "mcl_mangrove:"
elseif name:find("hyphae") then
mod = "mcl_crimson:"
else
mod = "mcl_core:"
end
material = mod..name
stripped_material = mod..stripped_name
vl_hollow_logs.register_craft(material, name)
vl_hollow_logs.register_craft(stripped_material, stripped_name)
end
minetest.register_craft({
burntime = 10,
recipe = "group:hollow_log_burnable",
type = "fuel",
})
minetest.register_craft({
cooktime = 5,
output = "mcl_core:charcoal_lump",
recipe = "group:hollow_log_burnable",
type = "cooking"
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB