Some updates in the code

This commit is contained in:
JoseDouglas26 2024-03-07 21:08:25 -03:00
parent 97d5865d13
commit 671438e802
21 changed files with 107 additions and 274 deletions

View File

@ -1,7 +1,22 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname())
local core_logs = {"acacia", "birch", "dark_oak", "jungle", "oak", "spruce"}
logs = {
{"acaciatree", "Hollow Acacia Log", "Stripped Hollow Acacia Log"},
{"birchtree", "Hollow Birch Log", "Stripped Hollow Birch Log"},
{"darktree", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"},
{"jungletree", "Hollow Jungle Log", "Stripped Hollow Jungle Log"},
{"sprucetree", "Hollow Spruce Log", "Stripped Hollow Spruce Log"},
{"tree", "Hollow Oak Log", "Stripped Hollow Oak Log"}
}
if minetest.get_modpath("mcl_cherry_blossom") then
table.insert(logs, {"cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"})
end
if minetest.get_modpath("mcl_mangrove") then
table.insert(logs, {"mangrove_tree", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"})
end
local collisionbox = {
type = "fixed",
@ -13,19 +28,14 @@ local collisionbox = {
}
}
local function set_desc(name)
return (name:gsub("_", " "):gsub("(%a)([%w_']*)", function (first, rest)
return first:upper()..rest:lower()
end))
end
for i = 1, #logs do
local name = logs[i][1]
local normal_desc = logs[i][2]
local stripped_desc = logs[i][3]
for i = 1, #core_logs do
local name = core_logs[i]
local desc = set_desc(name)
minetest.register_node(":mcl_core:"..name.."_log_hollow", {
minetest.register_node("mcl_hollow_logs:"..name.."_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S(desc.." Log")),
description = S(normal_desc),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
@ -40,12 +50,12 @@ for i = 1, #core_logs do
tiles = {"mcl_hollow_logs_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_core:stripped_"..name.."_log_hollow"
_mcl_stripped_variant = "mcl_hollow_logs:stripped_"..name.."_hollow"
})
minetest.register_node(":mcl_core:stripped_"..name.."_log_hollow", {
minetest.register_node("mcl_hollow_logs:stripped_"..name.."_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S(desc.." Log")),
description = S(stripped_desc),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
@ -63,53 +73,12 @@ for i = 1, #core_logs do
})
end
if minetest.get_modpath("mcl_cherry_blossom") then
minetest.register_node(":mcl_cherry_blossom:cherry_log_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S("Cherry Log")),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
handy = 1, hollow_log = 1
},
mesh = "mcl_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 = {"mcl_hollow_logs_cherry.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_cherry_blossom:stripped_cherry_log_hollow"
})
minetest.register_node(":mcl_cherry_blossom:stripped_cherry_log_hollow", {
collision_box = collisionbox,
description = S("Stripped @1", S("Hollow @1", S("Cherry Log"))),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
handy = 1, hollow_log = 1
},
mesh = "mcl_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 = {"mcl_hollow_logs_stripped_cherry.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
if minetest.get_modpath("mcl_crimson") then
minetest.register_node(":mcl_crimson:crimson_stem_hollow", {
minetest.register_node("mcl_hollow_logs:crimson_hyphae_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S("Crimson Stem")),
description = S("Hollow Crimson Stem"),
drawtype = "mesh",
groups = {axey = 1, building_block = 1, handy = 1},
groups = {axey = 1, building_block = 1, handy = 1, hollow_stem = 1},
mesh = "mcl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
@ -119,14 +88,14 @@ if minetest.get_modpath("mcl_crimson") then
tiles = {"mcl_hollow_logs_crimson.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_crimson:stripped_crimson_stem_hollow"
_mcl_stripped_variant = "mcl_hollow_logs:stripped_crimson_hyphae_hollow"
})
minetest.register_node(":mcl_crimson:stripped_crimson_stem_hollow", {
minetest.register_node("mcl_hollow_logs:stripped_crimson_hyphae_hollow", {
collision_box = collisionbox,
description = S("Stripped @1", S("Hollow @1", S("Crimson Stem"))),
description = S("Stripped Hollow Crimson Stem"),
drawtype = "mesh",
groups = {axey = 1, building_block = 1, handy = 1},
groups = {axey = 1, building_block = 1, handy = 1, hollow_stem = 1},
mesh = "mcl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
@ -138,11 +107,11 @@ if minetest.get_modpath("mcl_crimson") then
_mcl_hardness = 2
})
minetest.register_node(":mcl_crimson:warped_stem_hollow", {
minetest.register_node("mcl_hollow_logs:warped_hyphae_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S("Warped Stem")),
description = S("Hollow Warped Stem"),
drawtype = "mesh",
groups = {axey = 1, building_block = 1, handy = 1},
groups = {axey = 1, building_block = 1, handy = 1, hollow_stem = 1},
mesh = "mcl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
@ -152,14 +121,14 @@ if minetest.get_modpath("mcl_crimson") then
tiles = {"mcl_hollow_logs_warped.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_crimson:stripped_warped_stem_hollow"
_mcl_stripped_variant = "mcl_hollow_logs:stripped_warped_hyphae_hollow"
})
minetest.register_node(":mcl_crimson:stripped_warped_stem_hollow", {
minetest.register_node("mcl_hollow_logs:stripped_warped_hyphae_hollow", {
collision_box = collisionbox,
description = S("Stripped @1", S("Hollow @1", S("Warped Stem"))),
description = S("Stripped Hollow Warped Stem"),
drawtype = "mesh",
groups = {axey = 1, building_block = 1, handy = 1},
groups = {axey = 1, building_block = 1, handy = 1, hollow_stem = 1},
mesh = "mcl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
@ -172,45 +141,4 @@ if minetest.get_modpath("mcl_crimson") then
})
end
if minetest.get_modpath("mcl_mangrove") then
minetest.register_node(":mcl_mangrove:mangrove_log_hollow", {
collision_box = collisionbox,
description = S("Hollow @1", S("Mangrove Log")),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
handy = 1, hollow_log = 1
},
mesh = "mcl_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 = {"mcl_hollow_logs_mangrove.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_mangrove:stripped_mangrove_log_hollow"
})
minetest.register_node(":mcl_mangrove:stripped_mangrove_log_hollow", {
collision_box = collisionbox,
description = S("Stipped @1", S("Hollow @1", S("Mangrove Log"))),
drawtype = "mesh",
groups = {
axey = 1, building_block = 1, fire_encouragement = 5, fire_flammability = 5, flammable = 2,
handy = 1, hollow_log = 1
},
mesh = "mcl_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 = {"mcl_hollow_logs_stripped_mangrove.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
dofile(modpath.."/recipes.lua")

View File

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

View File

@ -1,14 +1,21 @@
# textdomain: mcl_hollow_logs
Hollow @1=
Stripped @1=
Acacia Log=
Birch Log=
Cherry Log=
Crimson Stem=
Dark Oak Log=
Jungle Log=
Mangrove Log=
Oak Log=
Spruce Log=
Warped Stem=
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

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

View File

@ -1,134 +1,44 @@
minetest.register_craft({
output = "mcl_core:acacia_log_hollow 4",
recipe = {
{"", "mcl_core:acaciatree", ""},
{"mcl_core:acaciatree", "", "mcl_core:acaciatree"},
{"", "mcl_core:acaciatree", ""}
}
})
for i = 1, #logs do
local mod, material, stripped_material
local name = logs[i][1]
minetest.register_craft({
output = "mcl_core:stripped_acacia_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_acacia", ""},
{"mcl_core:stripped_acacia", "", "mcl_core:stripped_acacia"},
{"", "mcl_core:stripped_acacia", ""}
}
})
if name:find("cherry") then
mod = "mcl_cherry_blossom:"
elseif name:find("mangrove") then
mod = "mcl_mangrove:"
else
mod = "mcl_core:"
end
minetest.register_craft({
output = "mcl_core:birch_log_hollow 4",
recipe = {
{"", "mcl_core:birchtree", ""},
{"mcl_core:birchtree", "", "mcl_core:birchtree"},
{"", "mcl_core:birchtree", ""}
}
})
material = mod..name
stripped_material = mod.."stripped_"..name
minetest.register_craft({
output = "mcl_core:stripped_birch_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_birch", ""},
{"mcl_core:stripped_birch", "", "mcl_core:stripped_birch"},
{"", "mcl_core:stripped_birch", ""}
}
})
if name:find("mangrove") then
stripped_material = "mcl_mangrove:mangrove_stripped"
end
minetest.register_craft({
output = "mcl_core:dark_oak_log_hollow 4",
recipe = {
{"", "mcl_core:darktree", ""},
{"mcl_core:darktree", "", "mcl_core:darktree"},
{"", "mcl_core:darktree", ""}
}
})
minetest.register_craft({
output = "mcl_core:stripped_dark_oak_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_dark_oak", ""},
{"mcl_core:stripped_dark_oak", "", "mcl_core:stripped_dark_oak"},
{"", "mcl_core:stripped_dark_oak", ""}
}
})
minetest.register_craft({
output = "mcl_core:jungle_log_hollow 4",
recipe = {
{"", "mcl_core:jungletree", ""},
{"mcl_core:jungletree", "", "mcl_core:jungletree"},
{"", "mcl_core:jungletree", ""}
}
})
minetest.register_craft({
output = "mcl_core:stripped_jungle_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_jungle", ""},
{"mcl_core:stripped_jungle", "", "mcl_core:stripped_jungle"},
{"", "mcl_core:stripped_jungle", ""}
}
})
minetest.register_craft({
output = "mcl_core:spruce_log_hollow 4",
recipe = {
{"", "mcl_core:sprucetree", ""},
{"mcl_core:sprucetree", "", "mcl_core:sprucetree"},
{"", "mcl_core:sprucetree", ""}
}
})
minetest.register_craft({
output = "mcl_core:stripped_spruce_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_spruce", ""},
{"mcl_core:stripped_spruce", "", "mcl_core:stripped_spruce"},
{"", "mcl_core:stripped_spruce", ""}
}
})
minetest.register_craft({
output = "mcl_core:oak_log_hollow 4",
recipe = {
{"", "mcl_core:tree", ""},
{"mcl_core:tree", "", "mcl_core:tree"},
{"", "mcl_core:tree", ""}
}
})
minetest.register_craft({
output = "mcl_core:stripped_oak_log_hollow 4",
recipe = {
{"", "mcl_core:stripped_oak", ""},
{"mcl_core:stripped_oak", "", "mcl_core:stripped_oak"},
{"", "mcl_core:stripped_oak", ""}
}
})
if minetest.get_modpath("mcl_cherry_blossom") then
minetest.register_craft({
output = "mcl_cherry_blossom:cherry_log_hollow 4",
output = "mcl_hollow_logs:"..logs[i][1].."_hollow 4",
recipe = {
{"", "mcl_cherry_blossom:cherrytree", ""},
{"mcl_cherry_blossom:cherrytree", "", "mcl_cherry_blossom:cherrytree"},
{"", "mcl_cherry_blossom:cherrytree", ""}
{"", material, ""},
{material, "", material},
{"", material, ""}
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:stripped_cherry_log_hollow 4",
output = "mcl_hollow_logs:stripped_"..logs[i][1].."_hollow 4",
recipe = {
{"", "mcl_cherry_blossom:stripped_cherrytree", ""},
{"mcl_cherry_blossom:stripped_cherrytree", "", "mcl_cherry_blossom:stripped_cherrytree"},
{"", "mcl_cherry_blossom:stripped_cherrytree", ""}
{"", stripped_material, ""},
{stripped_material, "", stripped_material},
{"", stripped_material, ""}
}
})
end
if minetest.get_modpath("mcl_crimson") then
minetest.register_craft({
output = "mcl_crimson:crimson_stem_hollow 4",
output = "mcl_crimson:crimson_hyphae_hollow 4",
recipe = {
{"", "mcl_crimson:crimson_hyphae", ""},
{"mcl_crimson:crimson_hyphae", "", "mcl_crimson:crimson_hyphae"},
@ -137,7 +47,7 @@ if minetest.get_modpath("mcl_crimson") then
})
minetest.register_craft({
output = "mcl_crimson:stripped_crimson_stem_hollow 4",
output = "mcl_crimson:stripped_crimson_hyphae_hollow 4",
recipe = {
{"", "mcl_crimson:stripped_crimson_hyphae", ""},
{"mcl_crimson:stripped_crimson_hyphae", "", "mcl_crimson:stripped_crimson_hyphae"},
@ -146,7 +56,7 @@ if minetest.get_modpath("mcl_crimson") then
})
minetest.register_craft({
output = "mcl_crimson:warped_stem_hollow 4",
output = "mcl_crimson:warped_hyphae_hollow 4",
recipe = {
{"", "mcl_crimson:warped_hyphae", ""},
{"mcl_crimson:warped_hyphae", "", "mcl_crimson:warped_hyphae"},
@ -155,7 +65,7 @@ if minetest.get_modpath("mcl_crimson") then
})
minetest.register_craft({
output = "mcl_crimson:stripped_warped_stem_hollow 4",
output = "mcl_crimson:stripped_warped_hyphae_hollow 4",
recipe = {
{"", "mcl_crimson:stripped_warped_hyphae", ""},
{"mcl_crimson:stripped_warped_hyphae", "", "mcl_crimson:stripped_warped_hyphae"},
@ -164,26 +74,6 @@ if minetest.get_modpath("mcl_crimson") then
})
end
if minetest.get_modpath("mcl_mangrove") then
minetest.register_craft({
output = "mcl_mangrove:mangrove_log_hollow 4",
recipe = {
{"", "mcl_mangrove:mangrove_tree", ""},
{"mcl_mangrove:mangrove_tree", "", "mcl_mangrove:mangrove_tree"},
{"", "mcl_mangrove:mangrove_tree", ""}
}
})
minetest.register_craft({
output = "mcl_mangrove:stripped_mangrove_log_hollow 4",
recipe = {
{"", "mcl_mangrove:mangrove_stripped", ""},
{"mcl_mangrove:mangrove_stripped", "", "mcl_mangrove:mangrove_stripped"},
{"", "mcl_mangrove:mangrove_stripped", ""}
}
})
end
minetest.register_craft({
burntime = 10,
recipe = "group:hollow_log",

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB