Merge pull request 'Hollow logs fixes' (#4268) from hollow_logs into master
Reviewed-on: MineClone2/MineClone2#4268
|
@ -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")
|
||||
```
|
|
@ -0,0 +1,112 @@
|
|||
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
|
||||
error("Incomplete definition provided")
|
||||
end
|
||||
|
||||
for i = 1, 4 do
|
||||
if type(defs[i]) ~= "string" then
|
||||
error("defs["..i.."] must be a string")
|
||||
end
|
||||
end
|
||||
if defs[5] and type(defs[5]) ~= "boolean" then
|
||||
error("defs[5] must be a boolean if present")
|
||||
end
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
|
||||
if #defs > 5 then
|
||||
minetest.log("warning", "[vl_hollow_logs] unused vars passed, dumping the table")
|
||||
minetest.log("warning", "from mod " .. modname .. ": " .. dump(defs))
|
||||
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(modname .. ":"..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",
|
||||
use_texture_alpha = "clip",
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
sunlight_propagates = true,
|
||||
tiles = {modname .. "_"..name..".png"},
|
||||
_mcl_blast_resistance = 2,
|
||||
_mcl_hardness = 2,
|
||||
_mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow"
|
||||
})
|
||||
|
||||
minetest.register_node(modname .. ":"..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",
|
||||
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
|
||||
|
||||
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")
|
|
@ -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=
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,54 @@
|
|||
# Blender 3.6.7
|
||||
# www.blender.org
|
||||
o hollow_log
|
||||
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.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.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.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
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.380952 0.000000
|
||||
vt 0.380952 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.619048 0.000000
|
||||
vt 0.619048 1.000000
|
||||
vt 0.928571 0.187500
|
||||
vt 0.928571 0.812500
|
||||
vt 1.000000 1.000000
|
||||
vt 1.000000 -0.000000
|
||||
vt 0.690476 0.187500
|
||||
vt 0.690476 0.812500
|
||||
s 0
|
||||
f 10/1/1 11/2/1 12/3/1 9/4/1
|
||||
f 9/1/2 12/2/2 14/3/2 13/4/2
|
||||
f 13/1/3 14/2/3 16/3/3 15/4/3
|
||||
f 15/1/4 16/2/4 11/3/4 10/4/4
|
||||
f 7/5/4 8/6/4 4/2/4 3/1/4
|
||||
f 5/5/1 6/6/1 8/2/1 7/1/1
|
||||
f 3/7/5 1/8/5 10/9/5 9/10/5
|
||||
f 2/8/6 4/7/6 12/10/6 11/9/6
|
||||
f 7/11/5 3/7/5 9/10/5 13/5/5
|
||||
f 4/7/6 8/11/6 14/5/6 12/10/6
|
||||
f 5/12/5 7/11/5 13/5/5 15/6/5
|
||||
f 8/11/6 6/12/6 16/6/6 14/5/6
|
||||
f 1/8/5 5/12/5 15/6/5 10/9/5
|
||||
f 6/12/6 2/8/6 11/9/6 16/6/6
|
||||
f 3/5/3 4/6/3 2/2/3 1/1/3
|
||||
f 1/5/2 2/6/2 6/2/2 5/1/2
|
|
@ -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"
|
||||
})
|
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 745 B |
After Width: | Height: | Size: 848 B |
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 874 B |
After Width: | Height: | Size: 910 B |
After Width: | Height: | Size: 979 B |
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 463 B |
After Width: | Height: | Size: 916 B |
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 983 B |
After Width: | Height: | Size: 997 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 790 B |
After Width: | Height: | Size: 635 B |