mirror of
https://github.com/mt-mods/moretrees.git
synced 2024-11-05 09:50:34 +01:00
Multiple changes, see below:
Fix replacement of default trees so that it works correctly. Beeches now use default tree nodes, but L-systems models. This redefines the default tree, wood, leaves, and saplings so that they use moretrees' textures "Beech" in their descriptions, but only if replacement of default trees is enabled. Added backward-compat aliases for this change. Moved tree replacement mapgen->air aliases to a more logical spot in the code. Also, changed out all leaf decay dig_node() calls for nodeupdate(), since the former calls the latter anyway, and the latter is what does the job. Increased the palm leaf decay radius to 12.
This commit is contained in:
parent
d877bd51bb
commit
4c198fad78
13
init.lua
13
init.lua
|
@ -1,4 +1,4 @@
|
||||||
-- More trees! 2013-02-11
|
-- More trees! 2013-04-07
|
||||||
--
|
--
|
||||||
-- This mod adds more types of trees to the game
|
-- This mod adds more types of trees to the game
|
||||||
--
|
--
|
||||||
|
@ -18,18 +18,21 @@
|
||||||
|
|
||||||
moretrees = {}
|
moretrees = {}
|
||||||
|
|
||||||
-- These first two dofile() calls must precede any others, and must remain in
|
|
||||||
-- this order, otherwise variables and node names will get skipped.
|
|
||||||
|
|
||||||
dofile(minetest.get_modpath("moretrees").."/settings.lua")
|
dofile(minetest.get_modpath("moretrees").."/settings.lua")
|
||||||
dofile(minetest.get_modpath("moretrees").."/node_defs.lua")
|
dofile(minetest.get_modpath("moretrees").."/node_defs.lua")
|
||||||
|
|
||||||
dofile(minetest.get_modpath("moretrees").."/tree_models.lua")
|
dofile(minetest.get_modpath("moretrees").."/tree_models.lua")
|
||||||
dofile(minetest.get_modpath("moretrees").."/biome_defs.lua")
|
dofile(minetest.get_modpath("moretrees").."/biome_defs.lua")
|
||||||
dofile(minetest.get_modpath("moretrees").."/crafts.lua")
|
dofile(minetest.get_modpath("moretrees").."/crafts.lua")
|
||||||
dofile(minetest.get_modpath("moretrees").."/leafdecay.lua")
|
dofile(minetest.get_modpath("moretrees").."/leafdecay.lua")
|
||||||
dofile(minetest.get_modpath("moretrees").."/saplings.lua")
|
dofile(minetest.get_modpath("moretrees").."/saplings.lua")
|
||||||
|
|
||||||
|
if moretrees.enable_replace_default_trees then
|
||||||
|
minetest.register_alias("mapgen_tree", "air")
|
||||||
|
minetest.register_alias("mapgen_leaves", "air")
|
||||||
|
minetest.register_alias("mapgen_apple", "air")
|
||||||
|
plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
|
||||||
|
end
|
||||||
|
|
||||||
-- tree spawning setup
|
-- tree spawning setup
|
||||||
|
|
||||||
if moretrees.enable_apple_tree then
|
if moretrees.enable_apple_tree then
|
||||||
|
|
|
@ -11,7 +11,7 @@ if moretrees.enable_leafdecay then
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:"..treename.."_trunk") then
|
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:"..treename.."_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
minetest.env:dig_node(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -25,7 +25,7 @@ if moretrees.enable_leafdecay then
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, {"default:jungletree", "moretrees:jungletree_trunk"}) then
|
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, {"default:jungletree", "moretrees:jungletree_trunk"}) then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
minetest.env:dig_node(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -37,7 +37,7 @@ if moretrees.enable_leafdecay then
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:fir_trunk") then
|
if not minetest.env:find_node_near(pos, moretrees.leafdecay_radius, "moretrees:fir_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
minetest.env:dig_node(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -49,19 +49,13 @@ if moretrees.enable_leafdecay then
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if not minetest.env:find_node_near(pos, moretrees.palm_leafdecay_radius, "moretrees:palm_trunk") then
|
if not minetest.env:find_node_near(pos, moretrees.palm_leafdecay_radius, "moretrees:palm_trunk") then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
minetest.env:dig_node(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if moretrees.enable_replace_default_trees then
|
if moretrees.enable_default_leafdecay then
|
||||||
minetest.register_alias("mapgen_tree", "air")
|
|
||||||
minetest.register_alias("mapgen_leaves", "air")
|
|
||||||
minetest.register_alias("mapgen_apple", "air")
|
|
||||||
plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
|
|
||||||
|
|
||||||
elseif moretrees.enable_default_leafdecay then
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = "default:leaves",
|
nodenames = "default:leaves",
|
||||||
interval = moretrees.default_leafdecay_delay,
|
interval = moretrees.default_leafdecay_delay,
|
||||||
|
@ -69,7 +63,7 @@ elseif moretrees.enable_default_leafdecay then
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if not minetest.env:find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then
|
if not minetest.env:find_node_near(pos, moretrees.default_leafdecay_radius, {"default:tree"}) then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
minetest.env:dig_node(pos)
|
nodeupdate(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
moretrees.avoidnodes = {}
|
moretrees.avoidnodes = {}
|
||||||
|
|
||||||
moretrees.treelist = {
|
moretrees.treelist = {
|
||||||
{"beech", "Beech Tree"},
|
|
||||||
{"apple_tree", "Apple Tree"},
|
{"apple_tree", "Apple Tree"},
|
||||||
{"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
{"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
||||||
{"sequoia", "Giant Sequoia"},
|
{"sequoia", "Giant Sequoia"},
|
||||||
|
@ -201,19 +200,97 @@ if moretrees.enable_redefine_apple then
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if moretrees.enable_replace_default_trees then
|
||||||
|
|
||||||
|
minetest.register_node(":default:tree", {
|
||||||
|
description = "Beech Trunk",
|
||||||
|
tiles = {"moretrees_beech_trunk_top.png", "moretrees_beech_trunk_top.png", "moretrees_beech_trunk.png"},
|
||||||
|
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(":default:leaves", {
|
||||||
|
description = "Beech Leaves",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {"moretrees_beech_leaves.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
-- player will get sapling with 1/20 chance
|
||||||
|
items = {'default:sapling'},
|
||||||
|
rarity = 20,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- player will get leaves only if he get no saplings,
|
||||||
|
-- this is because max_items is 1
|
||||||
|
items = {'default:leaves'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(":default:wood", {
|
||||||
|
description = "Beech Planks",
|
||||||
|
tiles = {"moretrees_beech_wood.png"},
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(":default:sapling", {
|
||||||
|
description = "Beech Sapling",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1.0,
|
||||||
|
tiles = {"moretrees_beech_sapling.png"},
|
||||||
|
inventory_image = "moretrees_beech_sapling.png",
|
||||||
|
wield_image = "moretrees_beech_sapling.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||||
|
},
|
||||||
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("moretrees:beech_trunk_sideways", {
|
||||||
|
description = "Sideways Beech Trunk",
|
||||||
|
tiles = {
|
||||||
|
"moretrees_beech_trunk.png^[transformR90",
|
||||||
|
"moretrees_beech_trunk.png^[transformR90",
|
||||||
|
"moretrees_beech_trunk_top.png",
|
||||||
|
"moretrees_beech_trunk_top.png",
|
||||||
|
"moretrees_beech_trunk.png^[transformR90",
|
||||||
|
"moretrees_beech_trunk.png^[transformR90"
|
||||||
|
},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
})
|
||||||
|
|
||||||
table.insert(moretrees.avoidnodes, "default:jungletree")
|
table.insert(moretrees.avoidnodes, "default:jungletree")
|
||||||
table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
|
table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
|
||||||
table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
|
table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
|
||||||
|
|
||||||
-- For compatibility with newly-re-introduced default jungles and related nodes.
|
-- For compatibility with old nodes and recently-changed nodes.
|
||||||
|
|
||||||
|
minetest.register_alias("moretrees:beech_trunk", "default:tree")
|
||||||
|
minetest.register_alias("moretrees:beech_leaves", "default:leaves")
|
||||||
|
minetest.register_alias("moretrees:beech_planks", "default:wood")
|
||||||
|
minetest.register_alias("moretrees:beech_sapling", "default:sapling")
|
||||||
|
|
||||||
minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree")
|
minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree")
|
||||||
minetest.register_alias("moretrees:jungletree_planks", "default:junglewood")
|
minetest.register_alias("moretrees:jungletree_planks", "default:junglewood")
|
||||||
minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling")
|
minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling")
|
||||||
minetest.register_alias("jungletree:sapling", "default:junglesapling")
|
minetest.register_alias("jungletree:sapling", "default:junglesapling")
|
||||||
|
|
||||||
-- These next ones are for the old jungle trees and conifers mods.
|
|
||||||
|
|
||||||
minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green")
|
minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green")
|
||||||
minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red")
|
minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red")
|
||||||
minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow")
|
minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow")
|
||||||
|
|
|
@ -44,7 +44,7 @@ moretrees.leafdecay_delay = 2
|
||||||
moretrees.leafdecay_chance = 200
|
moretrees.leafdecay_chance = 200
|
||||||
moretrees.leafdecay_radius = 5
|
moretrees.leafdecay_radius = 5
|
||||||
|
|
||||||
moretrees.palm_leafdecay_radius = 8
|
moretrees.palm_leafdecay_radius = 12
|
||||||
|
|
||||||
moretrees.default_leafdecay_delay = 3
|
moretrees.default_leafdecay_delay = 3
|
||||||
moretrees.default_leafdecay_chance = 100
|
moretrees.default_leafdecay_chance = 100
|
||||||
|
|
|
@ -4,8 +4,8 @@ moretrees.beech_model={
|
||||||
rules_b="[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&Fd]//d[+^d][--&d]]",
|
rules_b="[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&Fd]//d[+^d][--&d]]",
|
||||||
rules_c="/",
|
rules_c="/",
|
||||||
rules_d="F",
|
rules_d="F",
|
||||||
trunk="moretrees:beech_trunk",
|
trunk="default:tree",
|
||||||
leaves="moretrees:beech_leaves",
|
leaves="default:leaves",
|
||||||
angle=30,
|
angle=30,
|
||||||
iterations=2,
|
iterations=2,
|
||||||
random_level=0,
|
random_level=0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user