mirror of
https://github.com/mt-mods/moretrees.git
synced 2024-12-24 17:50:24 +01:00
add option to spawn saplings instead of fully-grown trees at mapgen
time. Such saplings will grow very quickly into a tree, compared to a planted sapling. Defaults to spawning saplings. add custom jungle tree sapling, alias default one to that, so that moretrees will be able to grow its own jungle trees. fix tree density bug
This commit is contained in:
parent
258f33e42a
commit
fad79d86b7
@ -15,6 +15,13 @@ moretrees.enable_jungle_tree = true
|
||||
moretrees.enable_fir = true
|
||||
moretrees.enable_beech = false
|
||||
|
||||
-- set this to true to make moretrees spawn saplings at mapgen time instead
|
||||
-- of fully-grown trees, which will grow into full trees very quickly. This will
|
||||
-- greatly reduce mapgen lag, at the expense of having to wait several seconds for
|
||||
-- the trees to grow via an ABM.
|
||||
|
||||
moretrees.spawn_saplings = true
|
||||
|
||||
-- Set this to true to allow usage of the stairsplus mod in moreblocks
|
||||
|
||||
moretrees.enable_stairsplus = true
|
||||
|
59
init.lua
59
init.lua
@ -57,61 +57,92 @@ moretrees.cutting_tools = {
|
||||
}
|
||||
|
||||
dofile(modpath.."/tree_models.lua")
|
||||
dofile(modpath.."/biome_defs.lua")
|
||||
dofile(modpath.."/node_defs.lua")
|
||||
dofile(modpath.."/biome_defs.lua")
|
||||
dofile(modpath.."/saplings.lua")
|
||||
dofile(modpath.."/crafts.lua")
|
||||
dofile(modpath.."/leafdecay.lua")
|
||||
|
||||
-- tree spawning setup
|
||||
|
||||
if moretrees.spawn_saplings then
|
||||
moretrees.spawn_beech_object = "moretrees:beech_sapling_ongen"
|
||||
moretrees.spawn_apple_tree_object = "moretrees:apple_tree_sapling_ongen"
|
||||
moretrees.spawn_oak_object = "moretrees:oak_sapling_ongen"
|
||||
moretrees.spawn_sequoia_object = "moretrees:sequoia_sapling_ongen"
|
||||
moretrees.spawn_palm_object = "moretrees:palm_sapling_ongen"
|
||||
moretrees.spawn_pine_object = "moretrees:pine_sapling_ongen"
|
||||
moretrees.spawn_rubber_tree_object = "moretrees:rubber_tree_sapling_ongen"
|
||||
moretrees.spawn_willow_object = "moretrees:willow_sapling_ongen"
|
||||
moretrees.spawn_birch_object = "moretrees:birch_sapling_ongen"
|
||||
moretrees.spawn_spruce_object = "moretrees:spruce_sapling_ongen"
|
||||
moretrees.spawn_jungletree_object = "moretrees:jungletree_sapling_ongen"
|
||||
moretrees.spawn_fir_object = "moretrees:fir_sapling_ongen"
|
||||
moretrees.spawn_fir_snow_object = "snow:sapling_pine"
|
||||
else
|
||||
moretrees.spawn_beech_object = moretrees.beech_model
|
||||
moretrees.spawn_apple_tree_object = moretrees.apple_tree_model
|
||||
moretrees.spawn_oak_object = moretrees.oak_model
|
||||
moretrees.spawn_sequoia_object = moretrees.sequoia_model
|
||||
moretrees.spawn_palm_object = moretrees.palm_model
|
||||
moretrees.spawn_pine_object = moretrees.pine_model
|
||||
moretrees.spawn_rubber_tree_object = moretrees.rubber_tree_model
|
||||
moretrees.spawn_willow_object = moretrees.willow_model
|
||||
moretrees.spawn_birch_object = "moretrees:grow_birch"
|
||||
moretrees.spawn_spruce_object = "moretrees:grow_spruce"
|
||||
moretrees.spawn_jungletree_object = "moretrees:grow_jungletree"
|
||||
moretrees.spawn_fir_object = "moretrees:grow_fir"
|
||||
moretrees.spawn_fir_snow_object = "moretrees:grow_fir_snow"
|
||||
end
|
||||
|
||||
|
||||
if moretrees.enable_beech then
|
||||
plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
|
||||
plantslib:register_generate_plant(moretrees.beech_biome, moretrees.spawn_beech_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_apple_tree then
|
||||
plantslib:register_generate_plant(moretrees.apple_tree_biome, moretrees.apple_tree_model)
|
||||
plantslib:register_generate_plant(moretrees.apple_tree_biome, moretrees.spawn_apple_tree_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_oak then
|
||||
plantslib:register_generate_plant(moretrees.oak_biome, moretrees.oak_model)
|
||||
plantslib:register_generate_plant(moretrees.oak_biome, moretrees.spawn_oak_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_sequoia then
|
||||
plantslib:register_generate_plant(moretrees.sequoia_biome, moretrees.sequoia_model)
|
||||
plantslib:register_generate_plant(moretrees.sequoia_biome, moretrees.spawn_sequoia_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_palm then
|
||||
plantslib:register_generate_plant(moretrees.palm_biome, moretrees.palm_model)
|
||||
plantslib:register_generate_plant(moretrees.palm_biome, moretrees.spawn_palm_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_pine then
|
||||
plantslib:register_generate_plant(moretrees.pine_biome, moretrees.pine_model)
|
||||
plantslib:register_generate_plant(moretrees.pine_biome, moretrees.spawn_pine_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_rubber_tree then
|
||||
plantslib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.rubber_tree_model)
|
||||
plantslib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.spawn_rubber_tree_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_willow then
|
||||
plantslib:register_generate_plant(moretrees.willow_biome, moretrees.willow_model)
|
||||
plantslib:register_generate_plant(moretrees.willow_biome, moretrees.spawn_willow_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_birch then
|
||||
plantslib:register_generate_plant(moretrees.birch_biome, "moretrees:grow_birch")
|
||||
plantslib:register_generate_plant(moretrees.birch_biome, moretrees.spawn_birch_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_spruce then
|
||||
plantslib:register_generate_plant(moretrees.spruce_biome, "moretrees:grow_spruce")
|
||||
plantslib:register_generate_plant(moretrees.spruce_biome, moretrees.spawn_spruce_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_jungle_tree then
|
||||
plantslib:register_generate_plant(moretrees.jungletree_biome, "moretrees:grow_jungletree")
|
||||
plantslib:register_generate_plant(moretrees.jungletree_biome, moretrees.spawn_jungletree_object)
|
||||
end
|
||||
|
||||
if moretrees.enable_fir then
|
||||
plantslib:register_generate_plant(moretrees.fir_biome, "moretrees:grow_fir")
|
||||
plantslib:register_generate_plant(moretrees.fir_biome_snow, "moretrees:grow_fir_snow")
|
||||
plantslib:register_generate_plant(moretrees.fir_biome, moretrees.spawn_fir_object)
|
||||
plantslib:register_generate_plant(moretrees.fir_biome_snow, moretrees.spawn_fir_snow_object)
|
||||
end
|
||||
|
||||
-- Code to spawn a birch tree
|
||||
|
@ -27,7 +27,7 @@ for i in ipairs(moretrees.treelist) do
|
||||
local selbox = moretrees.treelist[i][5]
|
||||
local vscale = moretrees.treelist[i][6]
|
||||
|
||||
if treename ~= "jungletree" then -- the default game provides jungle tree nodes.
|
||||
if treename ~= "jungletree" then -- the default game provides jungle tree trunk/planks nodes.
|
||||
|
||||
minetest.register_node("moretrees:"..treename.."_trunk", {
|
||||
description = treedesc.." Trunk",
|
||||
@ -65,6 +65,22 @@ for i in ipairs(moretrees.treelist) do
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moretrees:"..treename.."_sapling_ongen", {
|
||||
description = treedesc.." Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"moretrees_"..treename.."_sapling.png"},
|
||||
inventory_image = "moretrees_"..treename.."_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,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
drop = "moretrees:"..treename.."_sapling"
|
||||
})
|
||||
|
||||
-- player will get a sapling with 1/100 chance
|
||||
-- player will get leaves only if he/she gets no saplings,
|
||||
-- this is because max_items is 1
|
||||
@ -226,9 +242,49 @@ for i in ipairs(moretrees.treelist) do
|
||||
})
|
||||
|
||||
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
|
||||
|
||||
if moretrees.spawn_saplings then
|
||||
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_sapling")
|
||||
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_sapling_ongen")
|
||||
end
|
||||
end
|
||||
|
||||
-- Extra leaves for jungle trees:
|
||||
-- Extra nodes for jungle trees:
|
||||
|
||||
minetest.register_node("moretrees:jungletree_sapling", {
|
||||
description = "Jungle Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_junglesapling.png"},
|
||||
inventory_image = "default_junglesapling.png",
|
||||
wield_image = "default_junglesapling.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_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("moretrees:jungletree_sapling_ongen", {
|
||||
description = "Jungle Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_junglesapling.png"},
|
||||
inventory_image = "default_junglesapling.png",
|
||||
wield_image = "default_junglesapling.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,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = "moretrees:jungletree_sapling"
|
||||
})
|
||||
|
||||
local jungleleaves = {"green","yellow","red"}
|
||||
local jungleleavesnames = {"Green", "Yellow", "Red"}
|
||||
@ -295,6 +351,13 @@ table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
|
||||
table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
|
||||
table.insert(moretrees.avoidnodes, "default:tree")
|
||||
|
||||
if moretrees.spawn_saplings then
|
||||
table.insert(moretrees.avoidnodes, "snow:sapling_pine")
|
||||
table.insert(moretrees.avoidnodes, "default:junglesapling")
|
||||
table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling")
|
||||
table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling_ongen")
|
||||
end
|
||||
|
||||
-- "empty" (tapped) rubber tree nodes
|
||||
|
||||
minetest.register_node("moretrees:rubber_tree_trunk_empty", {
|
||||
@ -332,11 +395,7 @@ minetest.register_alias("farming_plus:rubber_leaves", "moretrees:rubber_tree_lea
|
||||
minetest.register_alias("farming_plus:rubber_sapling", "moretrees:rubber_tree_sapling")
|
||||
minetest.register_alias("technic:rubber_tree_sapling", "moretrees:rubber_tree_sapling")
|
||||
|
||||
minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree")
|
||||
minetest.register_alias("moretrees:jungletree_planks", "default:junglewood")
|
||||
minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling")
|
||||
minetest.register_alias("jungletree:sapling", "default:junglesapling")
|
||||
|
||||
minetest.register_alias("default:junglesapling","moretrees:jungletree_sapling")
|
||||
minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree")
|
||||
|
||||
minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green")
|
||||
|
42
saplings.lua
42
saplings.lua
@ -15,6 +15,15 @@ for i in ipairs(moretrees.treelist) do
|
||||
grow_nodes = moretrees[tree_biome].surface,
|
||||
grow_function = moretrees[tree_model],
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = 2,
|
||||
grow_chance = 30,
|
||||
grow_plant = "moretrees:"..treename.."_sapling_ongen",
|
||||
grow_nodes = moretrees[tree_biome].surface,
|
||||
grow_function = moretrees[tree_model],
|
||||
})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -26,6 +35,14 @@ plantslib:grow_plants({
|
||||
grow_function = "moretrees:grow_birch"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
grow_plant = "moretrees:birch_sapling_ongen",
|
||||
grow_nodes = moretrees.birch_biome.surface,
|
||||
grow_function = "moretrees:grow_birch"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
@ -34,6 +51,14 @@ plantslib:grow_plants({
|
||||
grow_function = "moretrees:grow_spruce"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
grow_plant = "moretrees:spruce_sapling_ongen",
|
||||
grow_nodes = moretrees.spruce_biome.surface,
|
||||
grow_function = "moretrees:grow_spruce"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
@ -42,6 +67,14 @@ plantslib:grow_plants({
|
||||
grow_function = "moretrees:grow_fir"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
grow_plant = "moretrees:fir_sapling_ongen",
|
||||
grow_nodes = moretrees.fir_biome.surface,
|
||||
grow_function = "moretrees:grow_fir"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
@ -49,3 +82,12 @@ plantslib:grow_plants({
|
||||
grow_nodes = moretrees.jungletree_biome.surface,
|
||||
grow_function = "moretrees:grow_jungletree"
|
||||
})
|
||||
|
||||
plantslib:grow_plants({
|
||||
grow_delay = moretrees.sapling_interval,
|
||||
grow_chance = moretrees.sapling_chance,
|
||||
grow_plant = "moretrees:jungletree_sapling_ongen",
|
||||
grow_nodes = moretrees.jungletree_biome.surface,
|
||||
grow_function = "moretrees:grow_jungletree"
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user