Add cool_trees support to the chainsaw (#511)

Make list of timber node names less repetitive
This commit is contained in:
coil 2019-09-07 11:02:21 +00:00 committed by SmallJoker
parent 768fbecc64
commit e66bb281a4

View File

@ -7,158 +7,153 @@ local chainsaw_charge_per_node = 12
-- if this is disabled. -- if this is disabled.
local chainsaw_leaves = true local chainsaw_leaves = true
-- First value is node name; second is whether the node is considered even if chainsaw_leaves is false.
local nodes = {
-- The default trees -- The default trees
local timber_nodenames = { {"default:acacia_tree", true},
["default:acacia_tree"] = true, {"default:aspen_tree", true},
["default:aspen_tree"] = true, {"default:jungletree", true},
["default:jungletree"] = true, {"default:papyrus", true},
["default:papyrus"] = true, {"default:cactus", true},
["default:cactus"] = true, {"default:tree", true},
["default:tree"] = true, {"default:apple", true},
["default:apple"] = true, {"default:pine_tree", true},
["default:pine_tree"] = true, {"default:acacia_leaves", false},
} {"default:aspen_leaves", false},
{"default:leaves", false},
{"default:jungleleaves", false},
{"default:pine_needles", false},
if chainsaw_leaves then -- Rubber trees from moretrees or technic_worldgen if moretrees isn't installed
timber_nodenames["default:acacia_leaves"] = true {"moretrees:rubber_tree_trunk_empty", true},
timber_nodenames["default:aspen_leaves"] = true {"moretrees:rubber_tree_trunk", true},
timber_nodenames["default:leaves"] = true {"moretrees:rubber_tree_leaves", false},
timber_nodenames["default:jungleleaves"] = true
timber_nodenames["default:pine_needles"] = true
end
-- technic_worldgen defines rubber trees if moretrees isn't installed -- Support moretrees
if minetest.get_modpath("technic_worldgen") or {"moretrees:acacia_trunk", true},
minetest.get_modpath("moretrees") then {"moretrees:apple_tree_trunk", true},
timber_nodenames["moretrees:rubber_tree_trunk_empty"] = true {"moretrees:beech_trunk", true},
timber_nodenames["moretrees:rubber_tree_trunk"] = true {"moretrees:birch_trunk", true},
if chainsaw_leaves then {"moretrees:fir_trunk", true},
timber_nodenames["moretrees:rubber_tree_leaves"] = true {"moretrees:oak_trunk", true},
end {"moretrees:palm_trunk", true},
end {"moretrees:pine_trunk", true},
{"moretrees:sequoia_trunk", true},
-- Support moretrees if it is there {"moretrees:spruce_trunk", true},
if minetest.get_modpath("moretrees") then {"moretrees:willow_trunk", true},
timber_nodenames["moretrees:acacia_trunk"] = true {"moretrees:jungletree_trunk", true},
timber_nodenames["moretrees:apple_tree_trunk"] = true {"moretrees:poplar_trunk", true},
timber_nodenames["moretrees:beech_trunk"] = true {"moretrees:acacia_leaves", false},
timber_nodenames["moretrees:birch_trunk"] = true {"moretrees:apple_tree_leaves", false},
timber_nodenames["moretrees:fir_trunk"] = true {"moretrees:oak_leaves", false},
timber_nodenames["moretrees:oak_trunk"] = true {"moretrees:fir_leaves", false},
timber_nodenames["moretrees:palm_trunk"] = true {"moretrees:fir_leaves_bright", false},
timber_nodenames["moretrees:pine_trunk"] = true {"moretrees:sequoia_leaves", false},
timber_nodenames["moretrees:sequoia_trunk"] = true {"moretrees:birch_leaves", false},
timber_nodenames["moretrees:spruce_trunk"] = true {"moretrees:birch_leaves", false},
timber_nodenames["moretrees:willow_trunk"] = true {"moretrees:palm_leaves", false},
timber_nodenames["moretrees:jungletree_trunk"] = true {"moretrees:spruce_leaves", false},
timber_nodenames["moretrees:poplar_trunk"] = true {"moretrees:spruce_leaves", false},
{"moretrees:pine_leaves", false},
if chainsaw_leaves then {"moretrees:willow_leaves", false},
timber_nodenames["moretrees:acacia_leaves"] = true {"moretrees:jungletree_leaves_green", false},
timber_nodenames["moretrees:apple_tree_leaves"] = true {"moretrees:jungletree_leaves_yellow", false},
timber_nodenames["moretrees:oak_leaves"] = true {"moretrees:jungletree_leaves_red", false},
timber_nodenames["moretrees:fir_leaves"] = true {"moretrees:acorn", false},
timber_nodenames["moretrees:fir_leaves_bright"] = true {"moretrees:coconut", false},
timber_nodenames["moretrees:sequoia_leaves"] = true {"moretrees:spruce_cone", false},
timber_nodenames["moretrees:birch_leaves"] = true {"moretrees:pine_cone", false},
timber_nodenames["moretrees:birch_leaves"] = true {"moretrees:fir_cone", false},
timber_nodenames["moretrees:palm_leaves"] = true {"moretrees:apple_blossoms", false},
timber_nodenames["moretrees:spruce_leaves"] = true {"moretrees:poplar_leaves", false},
timber_nodenames["moretrees:spruce_leaves"] = true
timber_nodenames["moretrees:pine_leaves"] = true
timber_nodenames["moretrees:willow_leaves"] = true
timber_nodenames["moretrees:jungletree_leaves_green"] = true
timber_nodenames["moretrees:jungletree_leaves_yellow"] = true
timber_nodenames["moretrees:jungletree_leaves_red"] = true
timber_nodenames["moretrees:acorn"] = true
timber_nodenames["moretrees:coconut"] = true
timber_nodenames["moretrees:spruce_cone"] = true
timber_nodenames["moretrees:pine_cone"] = true
timber_nodenames["moretrees:fir_cone"] = true
timber_nodenames["moretrees:apple_blossoms"] = true
timber_nodenames["moretrees:poplar_leaves"] = true
end
end
-- Support growing_trees -- Support growing_trees
if minetest.get_modpath("growing_trees") then {"growing_trees:trunk", true},
timber_nodenames["growing_trees:trunk"] = true {"growing_trees:medium_trunk", true},
timber_nodenames["growing_trees:medium_trunk"] = true {"growing_trees:big_trunk", true},
timber_nodenames["growing_trees:big_trunk"] = true {"growing_trees:trunk_top", true},
timber_nodenames["growing_trees:trunk_top"] = true {"growing_trees:trunk_sprout", true},
timber_nodenames["growing_trees:trunk_sprout"] = true {"growing_trees:branch_sprout", true},
timber_nodenames["growing_trees:branch_sprout"] = true {"growing_trees:branch", true},
timber_nodenames["growing_trees:branch"] = true {"growing_trees:branch_xmzm", true},
timber_nodenames["growing_trees:branch_xmzm"] = true {"growing_trees:branch_xpzm", true},
timber_nodenames["growing_trees:branch_xpzm"] = true {"growing_trees:branch_xmzp", true},
timber_nodenames["growing_trees:branch_xmzp"] = true {"growing_trees:branch_xpzp", true},
timber_nodenames["growing_trees:branch_xpzp"] = true {"growing_trees:branch_zz", true},
timber_nodenames["growing_trees:branch_zz"] = true {"growing_trees:branch_xx", true},
timber_nodenames["growing_trees:branch_xx"] = true {"growing_trees:leaves", false},
if chainsaw_leaves then -- Support cool_trees
timber_nodenames["growing_trees:leaves"] = true {"bamboo:trunk", true},
end {"bamboo:leaves", false},
end {"birch:trunk", true},
{"birch:leaves", false},
{"cherrytree:trunk", true},
{"cherrytree:blossom_leaves", false},
{"cherrytree:leaves", false},
{"chestnuttree:trunk", true},
{"chestnuttree:leaves", false},
{"clementinetree:trunk", true},
{"clementinetree:leaves", false},
{"ebony:trunk", true},
{"ebony:creeper", false},
{"ebony:creeper_leaves", false},
{"ebony:leaves", false},
{"jacaranda:trunk", true},
{"jacaranda:blossom_leaves", false},
{"larch:trunk", true},
{"larch:leaves", false},
{"lemontree:trunk", true},
{"lemontree:leaves", false},
{"mahogany:trunk", true},
{"mahogany:leaves", false},
{"palm:trunk", true},
{"palm:leaves", false},
-- Support growing_cactus -- Support growing_cactus
if minetest.get_modpath("growing_cactus") then {"growing_cactus:sprout", true},
timber_nodenames["growing_cactus:sprout"] = true {"growing_cactus:branch_sprout_vertical", true},
timber_nodenames["growing_cactus:branch_sprout_vertical"] = true {"growing_cactus:branch_sprout_vertical_fixed", true},
timber_nodenames["growing_cactus:branch_sprout_vertical_fixed"] = true {"growing_cactus:branch_sprout_xp", true},
timber_nodenames["growing_cactus:branch_sprout_xp"] = true {"growing_cactus:branch_sprout_xm", true},
timber_nodenames["growing_cactus:branch_sprout_xm"] = true {"growing_cactus:branch_sprout_zp", true},
timber_nodenames["growing_cactus:branch_sprout_zp"] = true {"growing_cactus:branch_sprout_zm", true},
timber_nodenames["growing_cactus:branch_sprout_zm"] = true {"growing_cactus:trunk", true},
timber_nodenames["growing_cactus:trunk"] = true {"growing_cactus:branch_trunk", true},
timber_nodenames["growing_cactus:branch_trunk"] = true {"growing_cactus:branch", true},
timber_nodenames["growing_cactus:branch"] = true {"growing_cactus:branch_xp", true},
timber_nodenames["growing_cactus:branch_xp"] = true {"growing_cactus:branch_xm", true},
timber_nodenames["growing_cactus:branch_xm"] = true {"growing_cactus:branch_zp", true},
timber_nodenames["growing_cactus:branch_zp"] = true {"growing_cactus:branch_zm", true},
timber_nodenames["growing_cactus:branch_zm"] = true {"growing_cactus:branch_zz", true},
timber_nodenames["growing_cactus:branch_zz"] = true {"growing_cactus:branch_xx", true},
timber_nodenames["growing_cactus:branch_xx"] = true
end
-- Support farming_plus -- Support farming_plus
if minetest.get_modpath("farming_plus") then {"farming_plus:banana_leaves", false},
if chainsaw_leaves then {"farming_plus:banana", false},
timber_nodenames["farming_plus:banana_leaves"] = true {"farming_plus:cocoa_leaves", false},
timber_nodenames["farming_plus:banana"] = true {"farming_plus:cocoa", false},
timber_nodenames["farming_plus:cocoa_leaves"] = true
timber_nodenames["farming_plus:cocoa"] = true
end
end
-- Support nature -- Support nature
if minetest.get_modpath("nature") then {"nature:blossom", false},
if chainsaw_leaves then
timber_nodenames["nature:blossom"] = true
end
end
-- Support snow -- Support snow
if minetest.get_modpath("snow") then {"snow:needles", false},
if chainsaw_leaves then {"snow:needles_decorated", false},
timber_nodenames["snow:needles"] = true {"snow:star", false},
timber_nodenames["snow:needles_decorated"] = true
timber_nodenames["snow:star"] = true
end
end
-- Support vines (also generated by moretrees if available) -- Support vines (also generated by moretrees if available)
if minetest.get_modpath("vines") then {"vines:vines", false},
if chainsaw_leaves then
timber_nodenames["vines:vines"] = true
end
end
if minetest.get_modpath("trunks") then {"trunks:moss", false},
if chainsaw_leaves then {"trunks:moss_fungus", false},
timber_nodenames["trunks:moss"] = true {"trunks:treeroot", false},
timber_nodenames["trunks:moss_fungus"] = true }
timber_nodenames["trunks:treeroot"] = true
local timber_nodenames = {}
for _, node in pairs(nodes) do
if chainsaw_leaves or node[2] then
timber_nodenames[node[1]] = true
end end
end end