This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplants.lua
815 lines (696 loc) · 27.4 KB
/
plants.lua
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
---MG TECTONIC adapted plants register.
---adapted from valleys_mapgen
--[[
Many syntaxes are possible, with their default behaviour (see *grow*):
* `nodes = "default:dry_shrub"`: simply generate a dry shrub.
* `nodes = {"default:papyrus", n=4}`: generate 4 papyrus nodes vertically.
* `nodes = {"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}`: generate one grass node, randomly chosen between the 5 nodes.
* `nodes = {"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5, n=3"}`: generate 3 grass nodes vertically (my example is a bit silly…), randomly chosen between the 5 nodes (chosen once, not 3 times).
--anything more needs a grow function
#### cover
Decimal number between 0 and 1, which determines the proportion of surface nodes that are "reserved" for the plant. This doesn't necessarily mean that there is a plant on the node (see *density*), but this "cover" prevents other plants with lower priority from spawning on said nodes.
#### density
Number between 0 and cover. Proportion of nodes that are effectively covered by the plant.
Examples:
* `cover = 0.8 ; density = 0.8`: the plant is present on 80% of the nodes, so extremely dense. Other plants can't take more than the remaining 20% if they have a lower `priority`.
* `cover = 0.8 ; density = 0.1`: the plant is present on 10% of the nodes, so more scattered, but other plants can't take more than 20% if they have a lower `priority`. Params like this are suitable for a plant that naturally needs much space.
* `cover = 0.1 ; density = 0.1`: the plant is present on 10% of the nodes as in the previous case, but other plants are much more common (max 90% of the nodes).
#### priority
Integer generally between 0 and 100 (no strict rule :) to determine which plants are dominating the others. The dominant plants (with higher priority) impose their *cover* on the others.
#### check
Function to check the conditions. Should return a boolean: true, the plant can spawn here ; false, the plant can't spawn and doesn't impose its *cover*. It takes 2 parameters:
* `t`: table containing all possible conditions: all noises (`t.v1` to `t.v20`), dirt thickness `t.thickness`, temperature `t.temp`, humidity `t.humidity`, humidity from sea `t.sea_water`, from rivers `t.river_water`, from sea and rivers `t.water`.
* `pos`: position of the future plant, above the dirt node.
```
check = function(t, pos)
return t.v15 < 0.7 and t.temp >= 1.9 and t.humidity > 2 and t.v16 > 2
end,
```
--]]
----------------------------------------------------
--Notes on species set up:
------------
--Temperature
-- >80 Tropical
-- 60-80 Sub-tropical
-- 40-60 Temperate
-- 20-40 Sub-polar
-- 0-20 Polar
--Humidity
-- >80 Swamp
-- 60-80 Damp
-- 40-60 Average
-- 20-40 Dry
-- 0-20 Arid
--Disturbance
-- >50 Disturbed
-- <50 Stable
--Combos:
-- Tropical Swamp Disturbed
-- Tropical Swamp Stable
-- Tropical Damp Disturbed
-- Tropical Damp Stable
-- Tropical Average Disturbed
-- Tropical Average Stable
-- Tropical Dry Disturbed
-- Tropical Dry Stable
-- Tropical Arid Disturbed
-- Tropical Arid Stable
-- Sub-tropical Swamp Disturbed
-- Sub-tropical Swamp Stable
-- Sub-tropical Damp Disturbed
-- Sub-tropical Damp Stable
-- Sub-tropical Average Disturbed
-- Sub-tropical Average Stable
-- Sub-tropical Dry Disturbed
-- Sub-tropical Dry Stable
-- Sub-tropical Arid Disturbed
-- Sub-tropical Arid Stable
-- Temperate Swamp Disturbed
-- Temperate Swamp Stable
-- Temperate Damp Disturbed
-- Temperate Damp Stable
-- Temperate Average Disturbed
-- Temperate Average Stable
-- Temperate Dry Disturbed
-- Temperate Dry Stable
-- Temperate Arid Disturbed
-- Temperate Arid Stable
-- Sub-polar Swamp Disturbed
-- Sub-polar Swamp Stable
-- Sub-polar Damp Disturbed
-- Sub-polar Damp Stable
-- Sub-polar Average Disturbed
-- Sub-polar Average Stable
-- Sub-polar Dry Disturbed
-- Sub-polar Dry Stable
-- Sub-polar Arid Disturbed
-- Sub-polar Arid Stable
-- Polar Swamp Disturbed
-- Polar Swamp Stable
-- Polar Damp Disturbed
-- Polar Damp Stable
-- Polar Average Disturbed
-- Polar Average Stable
-- Polar Dry Disturbed
-- Polar Dry Stable
-- Polar Arid Disturbed
-- Polar Arid Stable
--Conditions are:
--temp - temperature
--humidity ,
--disturb, - disturbance regime (e.g low = slow stable forest, high = fast early colonizers)
--nodu - node under
--Nodu check needs these to make sense of what the main stuff gives it
--sediments
local c_gravel = minetest.get_content_id("default:gravel")
local c_clay = minetest.get_content_id("default:clay")
local c_sand = minetest.get_content_id("default:sand")
local c_sand2 = minetest.get_content_id("default:silver_sand")
local c_dirt = minetest.get_content_id("default:dirt")
--surfaces
local c_dirtgr = minetest.get_content_id("default:dirt_with_grass")
local c_dirtdgr = minetest.get_content_id("default:dirt_with_dry_grass")
local c_dry_dirtdgr = minetest.get_content_id("default:dry_dirt_with_dry_grass")
local c_dirtsno = minetest.get_content_id("default:dirt_with_snow")
local c_dirtlit = minetest.get_content_id("default:dirt_with_rainforest_litter")
local c_dirtconlit = minetest.get_content_id("default:dirt_with_coniferous_litter")
local c_snowbl = minetest.get_content_id("default:snowblock")
local c_dsand = minetest.get_content_id("default:desert_sand")
local c_permamoss = minetest.get_content_id("default:permafrost_with_moss")
local c_permastone = minetest.get_content_id("default:permafrost_with_stones")
--water
local c_river = minetest.get_content_id("default:river_water_source")
--remember to set values for all the conditions...or it will go strange places
--===============================================================
--Climate
--Temperature
local tropic = 90
local stropic = 70
local temper = 50
local spolar = 30
local polar = 10
--Humidity
local swamp = 90
local damp = 70
local average = 50
local dry = 30
local arid = 10
--disturbance.
local barren = 90
local open = 70
local transition = 50
local young = 30
local old = 10
--add on to the above to create a range
--tolerance
local htol = 24
local mtol = 12
local ltol = 6
--==============================================================
--priority..higher exclude lower
--everything lower must survive in the remaining uncovered space.
--covers
-- 0 - 1. Proportion of space saved for plant.
--Blocks lower priority plants in area. Competitiveness
local includer = 0.001
local vlo_cov = 0.002
local lo_cov = 0.045
local mid_cov = 0.09
local hi_cov = 0.19
local vhi_cov = 0.38
local excluder = 0.60
--density
--0 - 1. Proportion of space covered by the plant.
local super_rare = 0.0001
local rare = 0.001
local scattered = 0.01
local uncommon = 0.04
local common = 0.07
local abundant = 0.16
local plague = 0.32
--cover should likely be higher than density?
--==============================================================
--Normal (for soils).. forests and grasslands and cold
local plantlist1 = {
--Green grass ..higher numbered grass is taller
{"default:grass_1", lo_cov, uncommon, 26, (spolar - htol), (tropic + htol), (average - ltol), (swamp + htol), (old - ltol), (open + htol)},
{"default:grass_2", lo_cov, uncommon, 27, (spolar - mtol), (tropic + htol), (average), (swamp + htol), (young - mtol), (open + htol)},
{"default:grass_3", lo_cov, uncommon, 28, (spolar - ltol), (tropic + htol), (average), (swamp + htol), (young - ltol), (open + mtol)},
{"default:grass_4", lo_cov, common, 29, (spolar), (tropic + htol), (average + ltol), (swamp + htol), (young), (open)},
{"default:grass_5", lo_cov, abundant, 30, (spolar + ltol), (tropic + htol), (average + mtol), (swamp + htol), (young), (open - ltol)},
----
{"default:junglegrass", lo_cov, abundant, 31, (stropic - mtol), (tropic + mtol), (damp - mtol), (swamp + mtol), (young - mtol), (transition + ltol)},
--ferns...higher numbered is taller
{"default:fern_1", lo_cov, scattered, 33, (spolar - mtol), (tropic + htol), (average - mtol), (swamp + htol), -1, (young + mtol)},
{"default:fern_2", lo_cov, common, 34, (spolar - mtol), (tropic + htol), (average - ltol), (swamp + htol), -1, (young + ltol)},
{"default:fern_3", lo_cov, abundant, 35, (spolar - ltol), (tropic + htol), average, (swamp + htol), -1, young},
--flowers
{"flowers:viola", vlo_cov, rare, 38, (temper - htol), (temper + htol), (average - htol), (average + ltol), open, (open + htol)},
{"flowers:tulip", vlo_cov, rare, 39, (spolar - htol), (temper + ltol), arid, average, transition, open},
{"flowers:geranium", vlo_cov, rare, 40, (spolar - mtol), (temper + mtol), (damp - htol), (damp + ltol), transition, open},
{"flowers:tulip_black", includer, super_rare, 41, (polar - mtol), (polar + htol), arid, damp, young, open},
{"flowers:rose", vlo_cov, rare, 42, (spolar - htol), (temper + htol), arid, damp, (open - ltol), (open + ltol)},
{"flowers:dandelion_yellow", vlo_cov, uncommon, 43, (spolar - mtol), (temper + htol), (arid - mtol), (arid + mtol), (open - ltol), (open + htol)},
{"flowers:dandelion_white", vlo_cov, uncommon, 44, 2, (temper + htol), (average - htol), (damp + htol), (open - ltol), (open + htol)},
{"flowers:chrysanthemum_green", includer, super_rare, 45, temper, (stropic + htol), (damp - htol), damp, young, transition},
--crops
{"farming:wheat_8", super_rare, includer, 49, (temper - mtol), (temper + htol), (dry - ltol), (dry + htol), open, (open + ltol)},
{"farming:cotton_8", super_rare, includer, 50, (stropic - mtol), (stropic + htol), (damp - htol), (damp + mtol), open, (open + ltol)},
}
for i in ipairs(plantlist1) do
local lnodes = plantlist1[i][1]
local lcover = plantlist1[i][2]
local ldensity = plantlist1[i][3]
local lpriority = plantlist1[i][4]
local temp_min = plantlist1[i][5]
local temp_max = plantlist1[i][6]
local hum_min = plantlist1[i][7]
local hum_max = plantlist1[i][8]
local dist_min = plantlist1[i][9]
local dist_max = plantlist1[i][10]
mgtec.register_plant({
nodes = lnodes,
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
})
end
--Normal soils and dry and desert sands,
local plantlist2 = {
--Dry grass ..higher numbered grass is taller
{"default:dry_grass_1", lo_cov, uncommon, 21, (spolar - htol), (tropic + htol), (arid - mtol), (average + ltol), (old - ltol), (open + htol)},
{"default:dry_grass_2", lo_cov, uncommon, 22, (spolar - mtol), (tropic + htol), (arid - ltol), (average), (young - mtol), (open + htol)},
{"default:dry_grass_3", lo_cov, uncommon, 23, (spolar - ltol), (tropic + htol), (arid), (average - ltol), (young - ltol), (open + mtol)},
{"default:dry_grass_4", lo_cov, common, 24, (spolar), (tropic + htol), (arid + ltol), (average - ltol), (young), (open)},
{"default:dry_grass_5", lo_cov, abundant, 25, (spolar + ltol), (tropic + htol), (arid + mtol), (average - ltol), (young), (open- ltol)},
}
for i in ipairs(plantlist2) do
local lnodes = plantlist2[i][1]
local lcover = plantlist2[i][2]
local ldensity = plantlist2[i][3]
local lpriority = plantlist2[i][4]
local temp_min = plantlist2[i][5]
local temp_max = plantlist2[i][6]
local hum_min = plantlist2[i][7]
local hum_max = plantlist2[i][8]
local dist_min = plantlist2[i][9]
local dist_max = plantlist2[i][10]
mgtec.register_plant({
nodes = lnodes,
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dry_dirtdgr
or t.nodu == c_dirtdgr
or t.nodu == c_dsand)
end,
})
end
--Sea Shore Sand
local plantlist3 = {
--Marram ..higher numbered grass is taller
{"default:marram_grass_1", lo_cov, uncommon, 51, (spolar - htol), (tropic + htol), arid, swamp, 2, barren},
{"default:marram_grass_2", lo_cov, common, 52, (spolar - mtol), (tropic + mtol), (arid + ltol), (swamp - ltol), 1, barren},
{"default:marram_grass_3", lo_cov, abundant, 53, (spolar - ltol), (tropic + ltol), (arid + mtol), (swamp - mtol), -1, barren},
}
for i in ipairs(plantlist3) do
local lnodes = plantlist3[i][1]
local lcover = plantlist3[i][2]
local ldensity = plantlist3[i][3]
local lpriority = plantlist3[i][4]
local temp_min = plantlist3[i][5]
local temp_max = plantlist3[i][6]
local hum_min = plantlist3[i][7]
local hum_max = plantlist3[i][8]
local dist_min = plantlist3[i][9]
local dist_max = plantlist3[i][10]
mgtec.register_plant({
nodes = lnodes,
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and t.nodu == c_sand
and pos.y < 5
and pos.y > 0
end,
})
end
--Weirdos Plants
--Dry shrub
-- dead stuff turns up all over the place
mgtec.register_plant({
nodes = {"default:dry_shrub"},
cover = vlo_cov,
density = rare,
priority = 54,
check = function(t, pos)
return t.nodu == c_permamoss or t.nodu == c_permastone or t.nodu == c_dsand or t.nodu == c_sand2 or t.nodu == c_dry_dirtdgr or t.nodu == c_dirtdgr or t.nodu == c_dirtgr or t.nodu == c_sand or t.nodu == c_dirtsno or t.nodu == c_gravel or t.nodu == c_dirtconlit
end,
})
--Cactus... arid specialist... low disturbance
mgtec.register_plant({
nodes = {"default:cactus", n= math.random(1,4)},
cover = lo_cov,
density = rare,
priority = 55,
check = function(t, pos)
return t.temp > (stropic - htol) and t.humidity > 1 and t.humidity < arid and t.disturb < transition and (t.nodu == c_dsand or t.nodu == c_dry_dirtdgr or t.nodu == c_dirtdgr or t.nodu == c_gravel)
end,
})
--papyrus
mgtec.register_plant({
nodes = {"default:papyrus", n= math.random(3,5) },
cover = lo_cov,
density = plague,
priority = 56,
check = function(t, pos)
return t.temp > temper and t.humidity > average and pos.y < 5 and pos.y > 1 and t.disturb > young and t.disturb < (open + ltol) and (t.nodu == c_clay or t.nodu == c_dirtgr or t.nodu == c_dirt or t.nodu == c_dirtlit or t.nodu == c_sand)
end,
})
--waterlily
mgtec.register_plant({
nodes = {"flowers:waterlily"},
cover = vlo_cov,
density = abundant,
priority = 57,
check = function(t, pos)
return t.temp > (stropic-mtol) and t.humidity > average and t.disturb > young and t.disturb < open and t.nodu == c_river
end,
})
-- mushrooms
--anywhere with enough warmth and moisture to allow it
mgtec.register_plant({
nodes = {"flowers:mushroom_brown", "flowers:mushroom_red"},
cover = vlo_cov,
density = rare,
priority = 58,
check = function(t, pos)
return t.temp > 1 and t.humidity > arid and (t.nodu == c_dirtlit or t.nodu == c_dirtgr or t.nodu == c_dry_dirtdgr or t.nodu == c_dirtdgr or t.nodu == c_dirtsno or t.nodu == c_dirtconlit or t.nodu == c_permamoss or t.nodu == c_permastone or t.nodu == c_clay)
end,
})
--Tree type trees. Trees and Bushes ..Normal (for soils).. forests and grasslands and cold
local bushlist1 = {
--adult jungletree
{"default:jungletree", "default:jungleleaves", hi_cov, common, 10, (stropic - htol), (tropic + htol), (damp - htol), (swamp + htol), (old - ltol), transition, 13, 5},
--juvenile acacia_tree---
{"default:acacia_tree", "default:acacia_leaves", vhi_cov, scattered, 12, (stropic - htol), (tropic + mtol), (dry - htol), (dry + htol), (old + ltol), (young + ltol), 5, 2},
--adult acacia_tree
{"default:acacia_tree", "default:acacia_leaves", vhi_cov, scattered, 13, (stropic - htol), (tropic + mtol), (dry - htol), (dry + htol), old, young, 12, 3},
}
for i in ipairs(bushlist1) do
local lnodes_tr = bushlist1[i][1]
local lnodes_le = bushlist1[i][2]
local lcover = bushlist1[i][3]
local ldensity = bushlist1[i][4]
local lpriority = bushlist1[i][5]
local temp_min = bushlist1[i][6]
local temp_max = bushlist1[i][7]
local hum_min = bushlist1[i][8]
local hum_max = bushlist1[i][9]
local dist_min = bushlist1[i][10]
local dist_max = bushlist1[i][11]
local lheight = bushlist1[i][12]
local hvar = bushlist1[i][13]
mgtec.register_plant({
nodes = {
trunk = lnodes_tr,
leaves = lnodes_le,
air = "air", ignore = "ignore",
},
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dry_dirtdgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(lheight + (hvar * rand))
local radius = 3 + (1 * rand)
mgtec.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
end
--Layered ...Trees and Bushes ..Normal (for soils).. forests and grasslands and cold
local bushlist2 = {
--bushes
{"default:bush_stem", "default:bush_leaves", vhi_cov, scattered, 1, (spolar - mtol), (stropic - mtol), (average - htol), (damp + mtol), (transition - mtol), (open + ltol), 1,0},
{"default:acacia_bush_stem", "default:acacia_bush_leaves", vhi_cov, scattered, 2, (temper - mtol), (tropic + htol), (dry - htol), (average + ltol), (transition - mtol), (open + ltol), 1, 0},
{"default:pine_bush_stem", "default:pine_bush_needles", vhi_cov, scattered, 3, (spolar - htol), (temper + ltol), (dry - htol), (average + mtol), (transition - mtol), (open + ltol), 1, 0},
{"default:blueberry_bush_leaves", "default:blueberry_bush_leaves_with_berries", lo_cov, rare, 4, (spolar - mtol), (temper + htol), (damp - mtol), (damp + htol), (young - ltol), (transition + ltol), 1, 0},
--juvenile aspen---
{"default:aspen_tree", "default:aspen_leaves", hi_cov, common, 6, (spolar - mtol), (temper + mtol), (average - mtol), (swamp + htol), (young - ltol), (transition + ltol), 6, 2},
--adult aspen
{"default:aspen_tree", "default:aspen_leaves", vhi_cov, common, 7, (spolar - mtol), (spolar + htol), (average - mtol), (swamp + htol), (old - ltol), (young + mtol), 13, 3},
--juvenile jungletree---
{"default:jungletree", "default:jungleleaves", hi_cov, common, 9, (stropic - htol), (tropic + htol), (damp - htol), (swamp + htol), (young - ltol), (transition + ltol), 12, 5},
--juvenile pine---
{"default:pine_tree", "default:pine_needles", vhi_cov, scattered, 18, (spolar - htol), (temper + mtol), (dry - htol), (average + ltol), (young - ltol), (young + ltol), 6, 1},
--adult pine
{"default:pine_tree", "default:pine_needles", vhi_cov, uncommon, 19, (spolar - htol), (temper + mtol), (dry - htol), (average + ltol), (old - ltol), young, 15, 1},
}
for i in ipairs(bushlist2) do
local lnodes_tr = bushlist2[i][1]
local lnodes_le = bushlist2[i][2]
local lcover = bushlist2[i][3]
local ldensity = bushlist2[i][4]
local lpriority = bushlist2[i][5]
local temp_min = bushlist2[i][6]
local temp_max = bushlist2[i][7]
local hum_min = bushlist2[i][8]
local hum_max = bushlist2[i][9]
local dist_min = bushlist2[i][10]
local dist_max = bushlist2[i][11]
local lheight = bushlist2[i][12]
local hvar = bushlist2[i][13]
mgtec.register_plant({
nodes = {
trunk = lnodes_tr,
leaves = lnodes_le,
air = "air", ignore = "ignore",
},
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dry_dirtdgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(lheight + (hvar * rand))
local radius = 3 + (1 * rand)
mgtec.make_layered_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
end
--Fruiting....Trees and Bushes ..Normal (for soils).. forests and grasslands and cold
local bushlist3 = {
--juvenile apple---
{"default:tree", "default:leaves", hi_cov, uncommon, 15, (temper - htol), (stropic + ltol), (average - htol), (damp + mtol), (young + ltol), (transition + mtol), 6, 2, "default:apple"},
--adult apple
{"default:tree", "default:leaves", vhi_cov, common, 16, (temper - htol), (temper + htol), (average - htol), (damp + mtol), (old + mtol), (young + mtol), 12, 5, "default:apple"},
}
for i in ipairs(bushlist3) do
local lnodes_tr = bushlist3[i][1]
local lnodes_le = bushlist3[i][2]
local lcover = bushlist3[i][3]
local ldensity = bushlist3[i][4]
local lpriority = bushlist3[i][5]
local temp_min = bushlist3[i][6]
local temp_max = bushlist3[i][7]
local hum_min = bushlist3[i][8]
local hum_max = bushlist3[i][9]
local dist_min = bushlist3[i][10]
local dist_max = bushlist3[i][11]
local lheight = bushlist3[i][12]
local hvar = bushlist3[i][13]
local lnodes_fr = bushlist3[i][14]
mgtec.register_plant({
nodes = {
trunk = lnodes_tr,
leaves = lnodes_le,
fruit = lnodes_fr,
air = "air", ignore = "ignore",
},
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dry_dirtdgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(lheight + (hvar * rand))
local radius = 3 + (1 * rand)
mgtec.make_apple_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.fruit, nodes.air, nodes.ignore)
end,
})
end
--Weirdo Trees
--- Cactus "tree" ...arid specialist...
mgtec.register_plant({
nodes = {
trunk = "default:cactus",
leaves = "default:cactus",
air = "air", ignore = "ignore",
},
cover = lo_cov,
density = super_rare,
priority = 5,
check = function(t, pos)
return t.temp > stropic and t.humidity > arid and t.humidity < dry and t.disturb < old and (t.nodu == c_dsand or t.nodu == c_dry_dirtdgr or t.nodu == c_dirtdgr)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(3 + 2 * rand)
local radius = 2 + 1 * rand
mgtec.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
--Thick Giant Trees..
local bushlist4 = {
--giant aspen
{"default:aspen_tree", "default:aspen_leaves", excluder, uncommon, 8, (spolar - mtol), (spolar + mtol), (damp - mtol), (swamp + htol), -1, (old + ltol), 16, 4},
--giant jungletree
{"default:jungletree", "default:jungleleaves", excluder, uncommon, 11, (stropic - htol), (tropic + htol), (damp - htol), (swamp + htol), -1, (old + mtol), 19, 1},
--giant acacia_tree
{"default:acacia_tree", "default:acacia_leaves", excluder, scattered, 14, (stropic - ltol), (tropic + mtol), dry, (dry + htol), -1, (old + ltol), 17, 3},
--giant pine
{"default:pine_tree", "default:pine_needles", excluder, scattered, 20, (spolar - htol), (temper + mtol), (dry - ltol), (average + ltol), -1, (old + ltol), 18, 1},
--giant apple
{"default:tree", "default:leaves", excluder, scattered, 17, (temper - htol), (temper + mtol), (average - htol), (damp + mtol), -1, (old + ltol), 17, 3},
}
for i in ipairs(bushlist4) do
local lnodes_tr = bushlist4[i][1]
local lnodes_le = bushlist4[i][2]
local lcover = bushlist4[i][3]
local ldensity = bushlist4[i][4]
local lpriority = bushlist4[i][5]
local temp_min = bushlist4[i][6]
local temp_max = bushlist4[i][7]
local hum_min = bushlist4[i][8]
local hum_max = bushlist4[i][9]
local dist_min = bushlist4[i][10]
local dist_max = bushlist4[i][11]
local lheight = bushlist4[i][12]
local hvar = bushlist4[i][13]
mgtec.register_plant({
nodes = {
trunk = lnodes_tr,
leaves = lnodes_le,
air = "air", ignore = "ignore",
},
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dry_dirtdgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(lheight + (hvar * rand))
local radius = 4 + (2 * rand)
mgtec.make_thick_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
end
----------------------------------------------------------------------
--Schematics
--[[
--doesn't work, for ??? reasons. only when using vmanip place. place works, but is inappropriate.
local schemlist1 = {
{ minetest.get_modpath("default").."/schematics/acacia_tree.mts", vhi_cov, abundant, 95, 0, 100, 0, 100, 0, 100, - 4, - 4},
}
for i in ipairs(schemlist1) do
local lschematic = schemlist1[i][1]
local lcover = schemlist1[i][2]
local ldensity = schemlist1[i][3]
local lpriority = schemlist1[i][4]
local temp_min = schemlist1[i][5]
local temp_max = schemlist1[i][6]
local hum_min = schemlist1[i][7]
local hum_max = schemlist1[i][8]
local dist_min = schemlist1[i][9]
local dist_max = schemlist1[i][10]
local lxa = schemlist1[i][11] --position adjust
local lza = schemlist1[i][12] --position adjust
mgtec.register_plant({
schematic = lschematic,
xa = lxa,
za = lza,
cover = lcover,
density = ldensity,
priority = lpriority,
check = function(t, pos)
return
t.temp > temp_min
and t.temp < temp_max
and t.humidity > hum_min
and t.humidity < hum_max
and t.disturb > dist_min
and t.disturb < dist_max
and (t.nodu == c_dirtlit
or t.nodu == c_dirtconlit
or t.nodu == c_dirtgr
or t.nodu == c_dirtdgr
or t.nodu == c_dirtsno
or t.nodu == c_permamoss)
end,
schem = function(vm, pos, xa, za, schematic)
minetest.place_schematic_on_vmanip(vm, { x = pos.x + xa, y = pos.y, z = pos.z + za}, schematic, "random", nil, false)
--minetest.place_schematic({ x = pos.x + xa, y = pos.y, z = pos.z + za}, schematic, "random", nil, false)
end,
})
end
]]
----------------------------------------------------------------------
--[[
-- BUGGE Fixer Test TREE
mgtec.register_plant({
nodes = {
trunk = "default:pine_needles",
leaves = "default:pine_needles",
air = "air", ignore = "ignore",
},
cover = wodcov,
density = woden,
priority = 87,
check = function(t, pos)
return t.temp > 40 and t.temp < 70 and t.humidity > 50 and t.humidity < 100 and t.disturb < 60 and (t.nodu == c_dirtlit or t.nodu == c_dirtgr or t.nodu == c_dirtdgr or t.nodu == c_dirtsno or t.nodu == c_gravel)
end,
grow = function(nodes, pos, data, data2,area)
local rand = math.random()
local height = math.floor(18 + 1 * rand)
local radius = 3 + 1 * rand
mgtec.make_layered_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
]]
---=====================================================================