1
0
Fork 0

Spaces to tabs

This commit is contained in:
the-real-herowl 2024-04-30 02:29:12 +02:00
parent 1161d5cd36
commit 7ad4ca2dbe
1 changed files with 73 additions and 73 deletions

View File

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