2013-04-08 04:09:18 +02:00
|
|
|
-- More trees! 2013-04-07
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
|
|
|
-- This mod adds more types of trees to the game
|
|
|
|
--
|
2013-01-20 00:36:13 +01:00
|
|
|
-- Some of the node definitions and textures came from cisoun's conifers mod
|
|
|
|
-- and bas080's jungle trees mod.
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
|
|
|
-- Brought together into one mod and made L-systems compatible by Vanessa
|
2013-01-20 07:39:00 +01:00
|
|
|
-- Ezekowitz.
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
2013-02-12 04:07:40 +01:00
|
|
|
-- Firs and Jungle tree axioms/rules by Vanessa Ezekowitz, with the
|
|
|
|
-- latter having been tweaked by RealBadAngel, most other axioms/rules written
|
|
|
|
-- by RealBadAngel.
|
2013-01-14 02:37:05 +01:00
|
|
|
--
|
2013-02-12 04:07:40 +01:00
|
|
|
-- License: WTFPL for all parts (code and textures, including those copied
|
|
|
|
-- from the jungletree and conifers mods) except the default jungle tree trunk
|
|
|
|
-- texture, which is CC-By-SA.
|
2013-02-11 18:09:17 +01:00
|
|
|
|
2013-01-19 03:35:39 +01:00
|
|
|
moretrees = {}
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2013-04-09 06:15:24 +02:00
|
|
|
-- If the config file is not found in the world directory, copy the default
|
|
|
|
-- settings to that location and read them in.
|
|
|
|
|
|
|
|
local worldpath=minetest.get_worldpath()
|
|
|
|
local modpath=minetest.get_modpath("moretrees")
|
|
|
|
|
|
|
|
if io.open(worldpath.."/moretrees_settings.txt","r") == nil then
|
|
|
|
|
|
|
|
dofile(modpath.."/default_settings.txt")
|
|
|
|
|
|
|
|
io.input(modpath.."/default_settings.txt")
|
|
|
|
io.output(worldpath.."/moretrees_settings.txt")
|
|
|
|
|
|
|
|
local size = 2^13 -- good buffer size (8K)
|
|
|
|
while true do
|
|
|
|
local block = io.read(size)
|
|
|
|
if not block then break end
|
|
|
|
io.write(block)
|
|
|
|
end
|
|
|
|
|
2013-04-09 06:32:15 +02:00
|
|
|
else
|
|
|
|
dofile(worldpath.."/moretrees_settings.txt")
|
|
|
|
end
|
2013-04-09 06:15:24 +02:00
|
|
|
|
Update 2013-04-17: Got rid of horizontal jungle tree trunk, aliased it
to the one in the moreblocks mod. Got rid of jungle tree planks recipe,
default already has it. But that's not the important part...
Acorns, fir/spruce/pine cones, and coconuts are now edible!
Fir/spruce/pine cones can be cooked to extract fir/spruce/pine nuts. One cone yields 4 portions of nuts, each of which heals 1/2 heart.
Coconuts can be broken apart to get milk and raw coconut solids (e.g. the "meat"). Craft one coconut, one drinking glass, and one cutting tool (*see below). Yields one portion of coconut solids, one glass full of coconut milk, and the tool is returned. The coconut milk heals 1 heart and returns the empty glass, while one portion of coconut solids heals two hearts.
Coconut milk can be crafted with four acorns to produce acorn muffin batter. One portion of this batter can be cooked into four acorn muffins. Each muffin restores two hearts.
Enjoy :-)
-----
* Since Minetest doesn't have any default cutting tools that would normally be suitable for this purpose, the following tools may be used instead to cut the coconuts open:
Default bronze, diamond, Mese, or steel axe,
...or... glooptest Alatro or Arol axe,
...or... moreores Mithril or silver axe,
...or... titanium axe.
(note that stone and wooden axes are deliberately not usable)
2013-04-18 01:30:17 +02:00
|
|
|
moretrees.cutting_tools = {
|
|
|
|
"default:axe_bronze",
|
|
|
|
"default:axe_diamond",
|
|
|
|
"default:axe_mese",
|
|
|
|
"default:axe_steel",
|
|
|
|
"glooptest:axe_alatro",
|
|
|
|
"glooptest:axe_arol",
|
|
|
|
"moreores:axe_mithril",
|
|
|
|
"moreores:axe_silver",
|
|
|
|
"titanium:axe",
|
|
|
|
}
|
|
|
|
|
2013-04-09 06:15:24 +02:00
|
|
|
dofile(modpath.."/tree_models.lua")
|
|
|
|
dofile(modpath.."/biome_defs.lua")
|
|
|
|
dofile(modpath.."/node_defs.lua")
|
|
|
|
dofile(modpath.."/saplings.lua")
|
|
|
|
dofile(modpath.."/crafts.lua")
|
|
|
|
dofile(modpath.."/leafdecay.lua")
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2013-04-09 04:54:22 +02:00
|
|
|
-- tree spawning setup
|
|
|
|
|
|
|
|
if moretrees.enable_beech then
|
2013-04-08 04:09:18 +02:00
|
|
|
plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
|
|
|
|
end
|
|
|
|
|
2013-04-06 23:21:11 +02:00
|
|
|
if moretrees.enable_apple_tree then
|
|
|
|
plantslib:register_generate_plant(moretrees.apple_tree_biome, moretrees.apple_tree_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_oak then
|
|
|
|
plantslib:register_generate_plant(moretrees.oak_biome, moretrees.oak_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_sequoia then
|
|
|
|
plantslib:register_generate_plant(moretrees.sequoia_biome, moretrees.sequoia_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_palm then
|
|
|
|
plantslib:register_generate_plant(moretrees.palm_biome, moretrees.palm_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_pine then
|
|
|
|
plantslib:register_generate_plant(moretrees.pine_biome, moretrees.pine_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_rubber_tree then
|
|
|
|
plantslib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.rubber_tree_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_willow then
|
|
|
|
plantslib:register_generate_plant(moretrees.willow_biome, moretrees.willow_model)
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_birch then
|
|
|
|
plantslib:register_generate_plant(moretrees.birch_biome, "moretrees:grow_birch")
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_spruce then
|
|
|
|
plantslib:register_generate_plant(moretrees.spruce_biome, "moretrees:grow_spruce")
|
|
|
|
end
|
|
|
|
|
|
|
|
if moretrees.enable_jungle_tree then
|
|
|
|
plantslib:register_generate_plant(moretrees.jungletree_biome, "moretrees:grow_jungletree")
|
|
|
|
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")
|
|
|
|
end
|
2013-02-23 18:34:01 +01:00
|
|
|
|
2013-01-20 06:01:15 +01:00
|
|
|
-- Code to spawn a birch tree
|
|
|
|
|
|
|
|
function moretrees:grow_birch(pos)
|
2013-01-20 20:04:10 +01:00
|
|
|
minetest.env:remove_node(pos)
|
2013-01-20 06:01:15 +01:00
|
|
|
if math.random(1,2) == 1 then
|
|
|
|
minetest.env:spawn_tree(pos, moretrees.birch_model1)
|
|
|
|
else
|
|
|
|
minetest.env:spawn_tree(pos, moretrees.birch_model2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Code to spawn a spruce tree
|
|
|
|
|
|
|
|
function moretrees:grow_spruce(pos)
|
2013-01-20 20:04:10 +01:00
|
|
|
minetest.env:remove_node(pos)
|
2013-01-20 06:01:15 +01:00
|
|
|
if math.random(1,2) == 1 then
|
|
|
|
minetest.env:spawn_tree(pos, moretrees.spruce_model1)
|
|
|
|
else
|
|
|
|
minetest.env:spawn_tree(pos, moretrees.spruce_model2)
|
|
|
|
end
|
|
|
|
end
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-02-12 04:07:40 +01:00
|
|
|
-- Code to spawn jungle trees
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jt_axiom1 = "FFFA"
|
|
|
|
moretrees.jt_rules_a1 = "FFF[&&-FBf[&&&Ff]^^^Ff][&&+FBFf[&&&FFf]^^^Ff][&&---FBFf[&&&Ff]^^^Ff][&&+++FBFf[&&&Ff]^^^Ff]F/A"
|
|
|
|
moretrees.jt_rules_b1 = "[-Ff&f][+Ff&f]B"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jt_axiom2 = "FFFFFA"
|
|
|
|
moretrees.jt_rules_a2 = "FFFFF[&&-FFFBF[&&&FFff]^^^FFf][&&+FFFBFF[&&&FFff]^^^FFf][&&---FFFBFF[&&&FFff]^^^FFf][&&+++FFFBFF[&&&FFff]^^^FFf]FF/A"
|
|
|
|
moretrees.jt_rules_b2 = "[-FFf&ff][+FFf&ff]B"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.ct_rules_a1 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
|
|
|
|
moretrees.ct_rules_b1 = "[-FBf][+FBf]"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.ct_rules_a2 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
|
|
|
|
moretrees.ct_rules_b2 = "[-fB][+fB]"
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2013-01-19 06:45:03 +01:00
|
|
|
function moretrees:grow_jungletree(pos)
|
2013-01-11 16:29:38 +01:00
|
|
|
local r1 = math.random(2)
|
|
|
|
local r2 = math.random(3)
|
|
|
|
if r1 == 1 then
|
2013-01-22 02:50:41 +01:00
|
|
|
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_red"
|
2013-01-11 16:29:38 +01:00
|
|
|
else
|
2013-01-22 02:50:41 +01:00
|
|
|
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_yellow"
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.leaves2_chance = math.random(25, 75)
|
2013-01-11 16:29:38 +01:00
|
|
|
|
|
|
|
if r2 == 1 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "single"
|
|
|
|
moretrees.jungletree_model.iterations = 2
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom1
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a1
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b1
|
2013-01-11 16:29:38 +01:00
|
|
|
elseif r2 == 2 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "double"
|
|
|
|
moretrees.jungletree_model.iterations = 4
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom2
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a2
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
elseif r2 == 3 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "crossed"
|
|
|
|
moretrees.jungletree_model.iterations = 4
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom2
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a2
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
|
2013-01-10 03:35:50 +01:00
|
|
|
minetest.env:remove_node(pos)
|
2013-01-11 16:29:38 +01:00
|
|
|
local leaves = minetest.env:find_nodes_in_area({x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, "default:leaves")
|
|
|
|
for leaf in ipairs(leaves) do
|
|
|
|
minetest.env:remove_node(leaves[leaf])
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
2013-01-20 00:36:13 +01:00
|
|
|
minetest.env:spawn_tree(pos, moretrees.jungletree_model)
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
-- code to spawn fir trees
|
2013-02-12 04:07:40 +01:00
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
function moretrees:grow_fir(pos)
|
2013-01-11 16:29:38 +01:00
|
|
|
if math.random(2) == 1 then
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves"
|
2013-01-11 16:29:38 +01:00
|
|
|
else
|
2013-01-22 17:29:20 +01:00
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves_bright"
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
if math.random(2) == 1 then
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a1
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b1
|
2013-01-10 03:35:50 +01:00
|
|
|
else
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a2
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
moretrees.fir_model.iterations = 7
|
|
|
|
moretrees.fir_model.random_level = 5
|
|
|
|
|
2013-01-11 16:29:38 +01:00
|
|
|
minetest.env:remove_node(pos)
|
|
|
|
local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
|
|
|
|
for leaf in ipairs(leaves) do
|
|
|
|
minetest.env:remove_node(leaves[leaf])
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
2013-01-22 02:52:04 +01:00
|
|
|
minetest.env:spawn_tree(pos,moretrees.fir_model)
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
-- same thing, but a smaller version that grows only in snow biomes
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
function moretrees:grow_fir_snow(pos)
|
|
|
|
if math.random(2) == 1 then
|
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves"
|
|
|
|
else
|
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves_bright"
|
|
|
|
end
|
|
|
|
if math.random(2) == 1 then
|
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a1
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b1
|
|
|
|
else
|
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a2
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b2
|
|
|
|
end
|
|
|
|
|
|
|
|
moretrees.fir_model.iterations = 2
|
|
|
|
moretrees.fir_model.random_level = 2
|
|
|
|
|
|
|
|
minetest.env:remove_node(pos)
|
|
|
|
local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
|
|
|
|
for leaf in ipairs(leaves) do
|
|
|
|
minetest.env:remove_node(leaves[leaf])
|
|
|
|
end
|
|
|
|
minetest.env:spawn_tree(pos,moretrees.fir_model)
|
|
|
|
end
|
2013-02-12 04:07:40 +01:00
|
|
|
|
|
|
|
print("[Moretrees] Loaded (2013-02-11)")
|