VoxeLibre/mods/ITEMS/mcl_hollow_logs/init.lua
José Douglas da Silva Souza d6b329d657 Global definition removed
2024-03-08 22:38:03 +00:00

144 lines
5.4 KiB
Lua

local modpath = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname())
mcl_hollow_logs.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(mcl_hollow_logs.logs, {"cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"})
end
if minetest.get_modpath("mcl_mangrove") then
table.insert(mcl_hollow_logs.logs, {"mangrove_tree", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"})
end
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},
}
}
for i = 1, #mcl_hollow_logs.logs do
local name = mcl_hollow_logs.logs[i][1]
local normal_desc = mcl_hollow_logs.logs[i][2]
local stripped_desc = mcl_hollow_logs.logs[i][3]
minetest.register_node("mcl_hollow_logs:"..name.."_hollow", {
collision_box = collisionbox,
description = S(normal_desc),
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_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_hollow_logs:stripped_"..name.."_hollow"
})
minetest.register_node("mcl_hollow_logs:stripped_"..name.."_hollow", {
collision_box = collisionbox,
description = S(stripped_desc),
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_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
if minetest.get_modpath("mcl_crimson") then
minetest.register_node("mcl_hollow_logs:crimson_hyphae_hollow", {
collision_box = collisionbox,
description = S("Hollow Crimson Stem"),
drawtype = "mesh",
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",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"mcl_hollow_logs_crimson.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_hollow_logs:stripped_crimson_hyphae_hollow"
})
minetest.register_node("mcl_hollow_logs:stripped_crimson_hyphae_hollow", {
collision_box = collisionbox,
description = S("Stripped Hollow Crimson Stem"),
drawtype = "mesh",
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",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"mcl_hollow_logs_stripped_crimson.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
minetest.register_node("mcl_hollow_logs:warped_hyphae_hollow", {
collision_box = collisionbox,
description = S("Hollow Warped Stem"),
drawtype = "mesh",
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",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"mcl_hollow_logs_warped.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_hollow_logs:stripped_warped_hyphae_hollow"
})
minetest.register_node("mcl_hollow_logs:stripped_warped_hyphae_hollow", {
collision_box = collisionbox,
description = S("Stripped Hollow Warped Stem"),
drawtype = "mesh",
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",
paramtype2 = "facedir",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {"mcl_hollow_logs_stripped_warped.png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
dofile(modpath.."/recipes.lua")