1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
-- More trees! 2013-04-07
--
-- This mod adds more types of trees to the game
--
-- Some of the node definitions and textures came from cisoun's conifers mod
-- and bas080's jungle trees mod.
--
-- Brought together into one mod and made L-systems compatible by Vanessa
-- Ezekowitz.
--
-- Firs and Jungle tree axioms/rules by Vanessa Ezekowitz, with the
-- latter having been tweaked by RealBadAngel, most other axioms/rules written
-- by RealBadAngel.
--
-- License: WTFPL for all parts (code and textures, including those copied
-- from the the old jungletree and conifers mods).
moretrees = {}
-- Read the default config file (and if necessary, copy it to the world folder).
local worldpath=minetest.get_worldpath()
local modpath=minetest.get_modpath("moretrees")
dofile(modpath.."/default_settings.txt")
if io.open(worldpath.."/moretrees_settings.txt","r") then
io.close()
dofile(worldpath.."/moretrees_settings.txt")
end
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s) return s end
end
moretrees.intllib = S
-- clone node
function moretrees.clone_node(name)
local node2 = {}
local node = minetest.registered_nodes[name]
for k,v in pairs(node) do
node2[k]=v
end
return node2
end
-- infinite stacks checking
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
moretrees.expect_infinite_stacks = false
else
moretrees.expect_infinite_stacks = true
end
-- tables, load other files
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",
}
dofile(modpath.."/tree_models.lua")
dofile(modpath.."/node_defs.lua")
dofile(modpath.."/date_palm.lua")
dofile(modpath.."/cocos_palm.lua")
dofile(modpath.."/biome_defs.lua")
dofile(modpath.."/saplings.lua")
dofile(modpath.."/crafts.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_date_palm_object = "moretrees:date_palm_sapling_ongen"
moretrees.spawn_cedar_object = "moretrees:cedar_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"
moretrees.spawn_poplar_object = "moretrees:poplar_sapling_ongen"
moretrees.spawn_poplar_small_object = "moretrees:poplar_small_sapling_ongen"
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_date_palm_object = moretrees.date_palm_model
moretrees.spawn_cedar_object = moretrees.cedar_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"
moretrees.spawn_poplar_object = moretrees.poplar_model
moretrees.spawn_poplar_small_object = moretrees.poplar_small_model
end
if moretrees.enable_beech then
biome_lib:register_generate_plant(moretrees.beech_biome, moretrees.spawn_beech_object)
end
if moretrees.enable_apple_tree then
biome_lib:register_generate_plant(moretrees.apple_tree_biome, moretrees.spawn_apple_tree_object)
end
if moretrees.enable_oak then
biome_lib:register_generate_plant(moretrees.oak_biome, moretrees.spawn_oak_object)
end
if moretrees.enable_sequoia then
biome_lib:register_generate_plant(moretrees.sequoia_biome, moretrees.spawn_sequoia_object)
end
if moretrees.enable_palm then
biome_lib:register_generate_plant(moretrees.palm_biome, moretrees.spawn_palm_object)
end
if moretrees.enable_date_palm then
biome_lib:register_generate_plant(moretrees.date_palm_biome, moretrees.spawn_date_palm_object)
biome_lib:register_generate_plant(moretrees.date_palm_biome_2, moretrees.spawn_date_palm_object)
end
if moretrees.enable_cedar then
biome_lib:register_generate_plant(moretrees.cedar_biome, moretrees.spawn_cedar_object)
end
if moretrees.enable_rubber_tree then
biome_lib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.spawn_rubber_tree_object)
end
if moretrees.enable_willow then
biome_lib:register_generate_plant(moretrees.willow_biome, moretrees.spawn_willow_object)
end
if moretrees.enable_birch then
biome_lib:register_generate_plant(moretrees.birch_biome, moretrees.spawn_birch_object)
end
if moretrees.enable_spruce then
biome_lib:register_generate_plant(moretrees.spruce_biome, moretrees.spawn_spruce_object)
end
if moretrees.enable_jungle_tree then
biome_lib:register_generate_plant(moretrees.jungletree_biome, moretrees.spawn_jungletree_object)
end
if moretrees.enable_fir then
biome_lib:register_generate_plant(moretrees.fir_biome, moretrees.spawn_fir_object)
if minetest.get_modpath("snow") then
biome_lib:register_generate_plant(moretrees.fir_biome_snow, moretrees.spawn_fir_snow_object)
end
end
if moretrees.enable_poplar then
biome_lib:register_generate_plant(moretrees.poplar_biome, moretrees.spawn_poplar_object)
biome_lib:register_generate_plant(moretrees.poplar_biome_2, moretrees.spawn_poplar_object)
biome_lib:register_generate_plant(moretrees.poplar_biome_3, moretrees.spawn_poplar_object)
biome_lib:register_generate_plant(moretrees.poplar_small_biome, moretrees.spawn_poplar_small_object)
biome_lib:register_generate_plant(moretrees.poplar_small_biome_2, moretrees.spawn_poplar_small_object)
end
-- Code to spawn a birch tree
function moretrees.grow_birch(pos)
minetest.remove_node(pos)
if math.random(1,2) == 1 then
minetest.spawn_tree(pos, moretrees.birch_model1)
else
minetest.spawn_tree(pos, moretrees.birch_model2)
end
end
-- Code to spawn a spruce tree
function moretrees.grow_spruce(pos)
minetest.remove_node(pos)
if math.random(1,2) == 1 then
minetest.spawn_tree(pos, moretrees.spruce_model1)
else
minetest.spawn_tree(pos, moretrees.spruce_model2)
end
end
-- Code to spawn jungle trees
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"
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"
moretrees.ct_rules_a1 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
moretrees.ct_rules_b1 = "[-FBf][+FBf]"
moretrees.ct_rules_a2 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
moretrees.ct_rules_b2 = "[-fB][+fB]"
function moretrees.grow_jungletree(pos)
local r1 = math.random(2)
local r2 = math.random(3)
if r1 == 1 then
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_red"
else
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_yellow"
end
moretrees.jungletree_model.leaves2_chance = math.random(25, 75)
if r2 == 1 then
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
elseif r2 == 2 then
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
elseif r2 == 3 then
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
end
minetest.remove_node(pos)
local leaves = minetest.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.remove_node(leaves[leaf])
end
minetest.spawn_tree(pos, moretrees.jungletree_model)
end
-- code to spawn fir trees
function moretrees.grow_fir(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 = 7
moretrees.fir_model.random_level = 5
minetest.remove_node(pos)
local leaves = minetest.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.remove_node(leaves[leaf])
end
minetest.spawn_tree(pos,moretrees.fir_model)
end
-- same thing, but a smaller version that grows only in snow biomes
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.remove_node(pos)
local leaves = minetest.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.remove_node(leaves[leaf])
end
minetest.spawn_tree(pos,moretrees.fir_model)
end
print(S("[Moretrees] Loaded (2013-02-11)"))
|