init.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. -- paragenv7 0.3.1 by paramat
  2. -- For latest stable Minetest and back to 0.4.8
  3. -- Depends default
  4. -- Licenses: code WTFPL, textures CC BY-SA
  5. -- new in 0.3.1:
  6. -- ice varies thickness with temp
  7. -- dirt as papyrus bed, check for water below papyrus
  8. -- clay at mid-temp
  9. -- 'is ground content' false for leaves only
  10. -- TODO
  11. -- fog
  12. -- Parameters
  13. lottmapgen = {}
  14. local HITET = 0.4 -- High temperature threshold
  15. local LOTET = -0.4 -- Low ..
  16. local ICETET = -0.8 -- Ice ..
  17. local HIHUT = 0.4 -- High humidity threshold
  18. local LOHUT = -0.4 -- Low ..
  19. local HIRAN = 0.4
  20. local LORAN = -0.4
  21. local PAPCHA = 3 -- Papyrus
  22. local DUGCHA = 5 -- Dune grass
  23. local biome_blend = minetest.setting_getbool("biome_blend")
  24. --Rarity for Trees
  25. local TREE1 = 30
  26. local TREE2 = 50
  27. local TREE3 = 100
  28. local TREE4 = 200
  29. local TREE5 = 300
  30. local TREE6 = 500
  31. local TREE7 = 750
  32. local TREE8 = 1000
  33. local TREE9 = 2000
  34. local TREE10 = 5000
  35. --Rarity for Plants
  36. local PLANT1 = 3
  37. local PLANT2 = 5
  38. local PLANT3 = 10
  39. local PLANT4 = 20
  40. local PLANT5 = 50
  41. local PLANT6 = 100
  42. local PLANT7 = 200
  43. local PLANT8 = 500
  44. local PLANT9 = 750
  45. local PLANT10 = 1000
  46. local PLANT11 = 2000
  47. local PLANT12 = 5000
  48. local PLANT13 = 10000
  49. local PLANT14 = 35000
  50. local PLANT15 = 500000
  51. -- 2D noise for temperature
  52. local np_temp = {
  53. offset = 0,
  54. scale = 1,
  55. spread = {x=512, y=512, z=512},
  56. seed = 9130,
  57. octaves = 3,
  58. persist = 0.5
  59. }
  60. -- 2D noise for humidity
  61. local np_humid = {
  62. offset = 0,
  63. scale = 1,
  64. spread = {x=512, y=512, z=512},
  65. seed = -5500,
  66. octaves = 3,
  67. persist = 0.5
  68. }
  69. local np_random = {
  70. offset = 0,
  71. scale = 1,
  72. spread = {x=512, y=512, z=512},
  73. seed = 4510,
  74. octaves = 3,
  75. persist = 0.5
  76. }
  77. -- Stuff
  78. lottmapgen = {}
  79. local nobj_temp = nil
  80. local nobj_humid = nil
  81. local nobj_random = nil
  82. local nbuf_temp
  83. local nbuf_humid
  84. local nbuf_random
  85. local dbuf
  86. local p2dbuf
  87. local water_level = minetest.get_mapgen_setting("water_level")
  88. local function rangelim(d, min, max)
  89. if d < min then
  90. return min
  91. else
  92. if d > max then
  93. return max
  94. else
  95. return d
  96. end
  97. end
  98. end
  99. dofile(minetest.get_modpath("lottmapgen").."/nodes.lua")
  100. dofile(minetest.get_modpath("lottmapgen").."/functions.lua")
  101. dofile(minetest.get_modpath("lottmapgen").."/schematics.lua")
  102. -- On generated function
  103. minetest.register_on_generated(function(minp, maxp, seed)
  104. if minp.y < (water_level-1000) or minp.y > 5000 then
  105. return
  106. end
  107. local t1 = os.clock()
  108. local x1 = maxp.x
  109. local y1 = maxp.y
  110. local z1 = maxp.z
  111. local x0 = minp.x
  112. local y0 = minp.y
  113. local z0 = minp.z
  114. --print ("[lottmapgen_checking] chunk minp ("..x0.." "..y0.." "..z0..")")
  115. local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
  116. local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
  117. local data = vm:get_data(dbuf)
  118. local p2data = vm:get_param2_data(p2dbuf)
  119. local c_air = minetest.get_content_id("air")
  120. local c_ignore = minetest.get_content_id("ignore")
  121. local c_sand = minetest.get_content_id("default:sand")
  122. local c_desertsand = minetest.get_content_id("default:desert_sand")
  123. local c_snowblock = minetest.get_content_id("default:snowblock")
  124. local c_snow = minetest.get_content_id("default:snow")
  125. local c_ice = minetest.get_content_id("default:ice")
  126. local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
  127. local c_dirtgrass = minetest.get_content_id("default:dirt_with_grass")
  128. local c_dirt = minetest.get_content_id("default:dirt")
  129. local c_dryshrub = minetest.get_content_id("default:dry_shrub")
  130. local c_clay = minetest.get_content_id("default:clay")
  131. local c_stone = minetest.get_content_id("default:stone")
  132. local c_desertstone = minetest.get_content_id("default:desert_stone")
  133. local c_sandstone = minetest.get_content_id("default:sandstone")
  134. local c_stonecopper = minetest.get_content_id("default:stone_with_copper")
  135. local c_stoneiron = minetest.get_content_id("default:stone_with_iron")
  136. local c_stonecoal = minetest.get_content_id("default:stone_with_coal")
  137. local c_mese = minetest.get_content_id("default:mese")
  138. local c_chalk = minetest.get_content_id("darkage:chalk")
  139. local c_mapgen_stone = minetest.get_content_id("default:mapgen_stone")
  140. local c_water = minetest.get_content_id("default:water_source")
  141. local c_river_water = minetest.get_content_id("default:river_water_source")
  142. local c_morwat = minetest.get_content_id("lottmapgen:blacksource")
  143. local c_morrivwat = minetest.get_content_id("lottmapgen:black_river_source")
  144. local c_morstone = minetest.get_content_id("lottmapgen:mordor_stone")
  145. local c_frozenstone = minetest.get_content_id("lottmapgen:frozen_stone")
  146. local c_dungrass = minetest.get_content_id("lottmapgen:dunland_grass")
  147. local c_gondorgrass = minetest.get_content_id("lottmapgen:gondor_grass")
  148. local c_loriengrass = minetest.get_content_id("lottmapgen:lorien_grass")
  149. local c_fangorngrass = minetest.get_content_id("lottmapgen:fangorn_grass")
  150. local c_mirkwoodgrass = minetest.get_content_id("lottmapgen:mirkwood_grass")
  151. local c_rohangrass = minetest.get_content_id("lottmapgen:rohan_grass")
  152. local c_shiregrass = minetest.get_content_id("lottmapgen:shire_grass")
  153. local c_ironhillgrass = minetest.get_content_id("lottmapgen:ironhill_grass")
  154. local c_salt = minetest.get_content_id("lottores:mineral_salt")
  155. local c_pearl = minetest.get_content_id("lottores:mineral_pearl")
  156. local c_angsnowblock = minetest.get_content_id("lottmapgen:angsnowblock")
  157. local c_mallos = minetest.get_content_id("lottplants:mallos")
  158. local c_seregon = minetest.get_content_id("lottplants:seregon")
  159. local c_bomordor = minetest.get_content_id("lottplants:brambles_of_mordor")
  160. local c_pilinehtar = minetest.get_content_id("lottplants:pilinehtar")
  161. local c_ithilgrass = minetest.get_content_id("lottmapgen:ithilien_grass")
  162. local c_melon = minetest.get_content_id("lottplants:melon_wild")
  163. local sidelen = x1 - x0 + 1
  164. local chulens = {x=sidelen, y=sidelen, z=sidelen}
  165. local minposxz = {x=x0, y=z0}
  166. nobj_temp = nobj_temp or minetest.get_perlin_map(np_temp, chulens)
  167. nobj_humid = nobj_humid or minetest.get_perlin_map(np_humid, chulens)
  168. nobj_random = nobj_random or minetest.get_perlin_map(np_random, chulens)
  169. local nvals_temp = nobj_temp:get_2d_map_flat(minposxz, nbuf_temp)
  170. local nvals_humid = nobj_humid:get2dMap_flat(minposxz, nbuf_humid)
  171. local nvals_random = nobj_random:get2dMap_flat(minposxz, nbuf_random)
  172. local offset = math.random(5,20)
  173. if biome_blend == true then
  174. chulens = {x=sidelen+2*offset, y=sidelen+2*offset, z=sidelen+2*offset}
  175. minposxz = {x=x0-offset, y=z0-offset }
  176. nvals_temp = nobj_temp:get2dMap(minposxz)
  177. nvals_humid = nobj_humid:get2dMap(minposxz)
  178. nvals_random = nobj_random:get2dMap(minposxz)
  179. end
  180. local nixz = 1
  181. for z = z0, z1 do
  182. for x = x0, x1 do -- for each column do
  183. local n_temp = nvals_temp[nixz] -- select biome
  184. local n_humid = nvals_humid[nixz]
  185. local n_ran = nvals_random[nixz]
  186. local biome = false
  187. if biome_blend ~= true then
  188. biome = lottmapgen_biomes(biome, n_temp, n_humid, n_ran, LOTET, LOHUT, LORAN, HITET, HIHUT, HIRAN)
  189. end
  190. local sandy = (water_level+2) + math.random(-1, 1) -- sandline
  191. local sandmin = (water_level-15) + math.random(-5, 0) -- lowest sand
  192. local open = true -- open to sky?
  193. local solid = true -- solid node above?
  194. local water = false -- water node above?
  195. local surfy = y1 + 80 -- y of last surface detected
  196. for y = y1, y0, -1 do -- working down each column for each node do
  197. if biome_blend == true then
  198. local offsetpos = {x = (x-x0) + offset + math.random(-offset, offset) + 1, z = (z - z0) + offset + math.random(-offset, offset) + 1}
  199. offsetpos.x = rangelim(offsetpos.x, 1, 80)
  200. offsetpos.z = rangelim(offsetpos.z, 1, 80)
  201. n_temp = nvals_temp[offsetpos.z][offsetpos.x] -- select biome
  202. n_humid = nvals_humid[offsetpos.z][offsetpos.x]
  203. n_ran = nvals_random[offsetpos.z][offsetpos.x]
  204. biome = lottmapgen_biomes(biome, n_temp, n_humid, n_ran, LOTET, LOHUT, LORAN, HITET, HIHUT, HIRAN)
  205. end
  206. local fimadep = math.floor(6 - y / 512) + math.random(0, 1)
  207. local vi = area:index(x, y, z)
  208. local nodid = data[vi]
  209. local viuu = area:index(x, y - 1, z)
  210. local nodiduu = data[viuu]
  211. local via = area:index(x, y + 1, z)
  212. local nodida = data[via]
  213. if nodid == c_stone -- if stone
  214. or nodid == c_mapgen_stone
  215. or nodid == c_stonecopper
  216. or nodid == c_chalk
  217. or nodid == c_stoneiron
  218. or nodid == c_stonecoal then
  219. if y > water_level-32 then
  220. if biome == 4 or biome == 12 then
  221. data[vi] = c_desertstone
  222. elseif biome == 8 then
  223. data[vi] = c_morstone
  224. elseif biome == 5 then
  225. data[vi] = c_sandstone
  226. elseif biome == 11 then
  227. if math.random(10) == 1 then
  228. data[vi] = c_stoneiron
  229. end
  230. end
  231. end
  232. if y > - 40 and y < -5 and biome == 11 then
  233. if math.random(PLANT15) == 1 then
  234. lottmapgen.enqueue_building("Dwarf House", {x=x, y=y, z=z}) -- data[vi] = c_dwahous
  235. end
  236. end
  237. if y > - 100 and y < -50 and biome == 7 then
  238. if math.random(PLANT15) == 1 then
  239. lottmapgen_elf_workshop(x, y, z, area, data, p2data)
  240. end
  241. end
  242. if y > -100 and y < -5 then
  243. if biome == 11 or biome == 1 then
  244. if math.random(100000) == 1 then
  245. lottmapgen_mithrilore(x, y, z, area, data)
  246. end
  247. end
  248. if biome == 10 or biome == 7 then
  249. if math.random(100000) == 1 then
  250. lottmapgen_meseore(x, y, z, area, data)
  251. elseif math.random(10000000) == 1 then
  252. data[vi] = c_mese
  253. end
  254. end
  255. if biome == 8 then
  256. if math.random(100) == 1 then
  257. lottmapgen_orcore(x, y, z, area, data)
  258. end
  259. end
  260. end
  261. if not solid then -- if surface
  262. surfy = y
  263. if nodiduu ~= c_air and nodiduu ~= c_water and fimadep >= 1 then -- if supported by 2 stone nodes
  264. if nodida == c_river_water or data[area:index(x + 1, y, z)] == c_river_water
  265. or data[area:index(x, y, z + 1)] == c_river_water or data[area:index(x - 1, y, z)] == c_river_water
  266. or data[area:index(x, y, z - 1)] == c_river_water then
  267. if biome == 8 then
  268. data[vi] = c_morstone
  269. else
  270. data[vi] = c_sand
  271. end
  272. elseif y <= sandy and y >= sandmin then -- sand
  273. if biome ~= 8 then
  274. if open and water and y == (water_level-1) and biome > 4 and math.random(PAPCHA) == 2 then -- papyrus
  275. lottmapgen_papyrus(x, (water_level+1), z, area, data, p2data)
  276. data[vi] = c_dirt
  277. elseif math.abs(n_temp) < 0.05 and y == (water_level-1) then -- clay
  278. data[vi] = c_clay
  279. elseif math.abs(n_temp) < 0.05 and y == (water_level-5) then -- salt
  280. data[vi] = c_salt
  281. elseif math.abs(n_temp) < 0.05 and y == (water_level-20) then -- pearl
  282. data[vi] = c_pearl
  283. else
  284. data[vi] = c_sand
  285. end
  286. end
  287. if open and y > (water_level + 4) + math.random(0, 1) and math.random(DUGCHA) == 2 and biome ~= 8 and biome ~= 7 then -- dune grass
  288. local vi = area:index(x, y + 1, z)
  289. data[vi] = c_dryshrub
  290. p2data[vi] = 42
  291. end
  292. elseif y <= sandmin then
  293. data[vi] = c_stone
  294. else -- above sandline
  295. if open then
  296. if biome == 1 then
  297. if math.random(121) == 2 then
  298. data[vi] = c_ice
  299. elseif math.random(25) == 2 then
  300. data[vi] = c_frozenstone
  301. else
  302. data[vi] = c_angsnowblock
  303. end
  304. elseif biome == 2 then
  305. data[vi] = c_dirtsnow
  306. elseif biome == 3 then
  307. data[vi] = c_dirtsnow
  308. elseif biome == 4 then
  309. data[vi] = c_dungrass
  310. elseif biome == 5 then
  311. data[vi] = c_gondorgrass
  312. elseif biome == 6 then
  313. data[vi] = c_ithilgrass
  314. elseif biome == 7 then
  315. data[vi] = c_loriengrass
  316. elseif biome == 8 then
  317. data[vi] = c_morstone
  318. elseif biome == 9 then
  319. data[vi] = c_fangorngrass
  320. elseif biome == 10 then
  321. data[vi] = c_mirkwoodgrass
  322. elseif biome == 11 then
  323. data[vi] = c_ironhillgrass
  324. elseif biome == 12 then
  325. data[vi] = c_rohangrass
  326. elseif biome == 13 then
  327. data[vi] = c_shiregrass
  328. end
  329. local y = surfy + 1
  330. local vi = area:index(x, y, z)
  331. if biome == 1 then
  332. if math.random(PLANT3) == 2 then
  333. data[vi] = c_dryshrub
  334. p2data[vi] = 42
  335. elseif math.random(TREE10) == 2 then
  336. lottmapgen_beechtree(x, y, z, area, data)
  337. elseif math.random(TREE7) == 3 then
  338. lottmapgen_pinetree(x, y, z, area, data)
  339. elseif math.random(TREE8) == 4 then
  340. lottmapgen_firtree(x, y, z, area, data)
  341. elseif math.random(PLANT6) == 2 then
  342. data[vi] = c_seregon
  343. p2data[vi] = 40
  344. elseif math.random(PLANT14) == 13 then
  345. lottmapgen.enqueue_building("Angmar Fort", {x=x, y=y, z=z}) -- data[vi] = c_angfort
  346. end
  347. elseif biome == 2 then
  348. data[vi] = c_snowblock
  349. elseif biome == 3 then
  350. if math.random(PLANT3) == 2 then
  351. data[vi] = c_dryshrub
  352. p2data[vi] = 42
  353. elseif math.random(TREE10) == 2 then
  354. lottmapgen_beechtree(x, y, z, area, data)
  355. elseif math.random(TREE4) == 3 then
  356. lottmapgen_pinetree(x, y, z, area, data)
  357. elseif math.random(TREE3) == 4 then
  358. lottmapgen_firtree(x, y, z, area, data)
  359. end
  360. elseif biome == 4 then
  361. if math.random(TREE5) == 2 then
  362. lottmapgen_defaulttree(x, y, z, area, data)
  363. elseif math.random(TREE7) == 3 then
  364. lottmapgen_appletree(x, y, z, area, data)
  365. elseif math.random (PLANT3) == 4 then
  366. lottmapgen_grass(data, vi, p2data)
  367. end
  368. elseif biome == 5 then
  369. if math.random(TREE7) == 2 then
  370. lottmapgen_defaulttree(x, y, z, area, data)
  371. elseif math.random(TREE8) == 6 then
  372. lottmapgen_aldertree(x, y, z, area, data)
  373. elseif math.random(TREE9) == 3 then
  374. lottmapgen_appletree(x, y, z, area, data)
  375. elseif math.random(TREE8) == 4 then
  376. lottmapgen_plumtree(x, y, z, area, data)
  377. elseif math.random(TREE10) == 9 then
  378. lottmapgen_elmtree(x, y, z, area, data)
  379. elseif math.random(PLANT13) == 10 then
  380. lottmapgen_whitetree(x, y, z, area, data)
  381. elseif math.random(PLANT3) == 5 then
  382. lottmapgen_grass(data, vi, p2data)
  383. elseif math.random(PLANT8) == 7 then
  384. lottmapgen_farmingplants(data, vi, p2data)
  385. elseif math.random(PLANT13) == 8 then
  386. lottmapgen_farmingrareplants(data, vi, p2data)
  387. elseif math.random(PLANT6) == 2 then
  388. data[vi] = c_mallos
  389. p2data[vi] = 42
  390. elseif math.random(PLANT14) == 13 then
  391. lottmapgen.enqueue_building("Gondor Fort", {x=x, y=y, z=z})
  392. end
  393. elseif biome == 6 then
  394. if math.random(TREE3) == 2 then
  395. lottmapgen_defaulttree(x, y, z, area, data)
  396. elseif math.random(TREE6) == 6 then
  397. lottmapgen_lebethrontree(x, y, z, area, data)
  398. elseif math.random(TREE3) == 3 then
  399. lottmapgen_appletree(x, y, z, area, data)
  400. elseif math.random(TREE5) == 10 then
  401. lottmapgen_culumaldatree(x, y, z, area, data)
  402. elseif math.random(TREE5) == 4 then
  403. lottmapgen_plumtree(x, y, z, area, data)
  404. elseif math.random(TREE9) == 9 then
  405. lottmapgen_elmtree(x, y, z, area, data)
  406. elseif math.random(PLANT8) == 7 then
  407. lottmapgen_farmingplants(data, vi, p2data)
  408. elseif math.random(PLANT13) == 8 then
  409. data[vi] = c_melon
  410. elseif math.random(PLANT5) == 11 then
  411. lottmapgen_ithildinplants(data, vi, p2data)
  412. end
  413. elseif biome == 7 then
  414. if math.random(TREE3) == 2 then
  415. lottmapgen_mallornsmalltree(x, y, z, area, data)
  416. elseif math.random(TREE2) == 2 then
  417. lottmapgen_young_mallorn(x, y, z, area, data)
  418. elseif math.random(PLANT1) == 2 then
  419. lottmapgen_lorien_grass(data, vi, p2data)
  420. elseif math.random(TREE5) == 3 then
  421. lottmapgen_mallorntree(x, y, z, area, data)
  422. elseif math.random(PLANT4) == 11 then
  423. lottmapgen_lorienplants(data, vi, p2data)
  424. elseif math.random(PLANT14) == 13 then
  425. if math.random(1, 2) == 1 then
  426. lottmapgen.enqueue_building("Mallorn House", {x=x, y=y, z=z})
  427. else
  428. lottmapgen.enqueue_building("Lorien House", {x=x, y=y, z=z})
  429. end
  430. end
  431. elseif biome == 8 then
  432. if math.random(TREE10) == 2 then
  433. lottmapgen_burnedtree(x, y, z, area, data)
  434. elseif math.random(PLANT4) == 2 then
  435. data[vi] = c_bomordor
  436. p2data[vi] = 42
  437. elseif math.random(PLANT14) == 13 then
  438. lottmapgen.enqueue_building("Orc Fort", {x=x, y=y, z=z})
  439. end
  440. elseif biome == 9 then
  441. if math.random(TREE3) == 2 then
  442. lottmapgen_defaulttree(x, y, z, area, data)
  443. elseif math.random(TREE4) == 6 then
  444. lottmapgen_rowantree(x, y, z, area, data)
  445. elseif math.random(TREE4) == 3 then
  446. lottmapgen_appletree(x, y, z, area, data)
  447. elseif math.random(TREE5) == 10 then
  448. lottmapgen_birchtree(x, y, z, area, data)
  449. elseif math.random(TREE5) == 4 then
  450. lottmapgen_plumtree(x, y, z, area, data)
  451. elseif math.random(TREE7) == 9 then
  452. lottmapgen_elmtree(x, y, z, area, data)
  453. elseif math.random(TREE6) == 11 then
  454. lottmapgen_oaktree(x, y, z, area, data)
  455. elseif math.random(PLANT4) == 7 then
  456. lottmapgen_farmingplants(data, vi, p2data)
  457. elseif math.random(PLANT9) == 8 then
  458. data[vi] = c_melon
  459. end
  460. elseif biome == 10 then
  461. if math.random(TREE2) == 2 then
  462. lottmapgen_mirktree(x, y, z, area, data)
  463. elseif math.random(TREE2) == 3 then
  464. lottmapgen_jungletree2(x, y, z, area, data)
  465. elseif math.random(PLANT14) == 13 then
  466. data[vi] = lottmapgen.enqueue_building("Mirkwood House", {x=x, y=y, z=z})
  467. end
  468. elseif biome == 11 then
  469. if math.random(TREE10) == 2 then
  470. lottmapgen_beechtree(x, y, z, area, data)
  471. elseif math.random(TREE4) == 3 then
  472. lottmapgen_pinetree(x, y, z, area, data)
  473. elseif math.random(TREE6) == 4 then
  474. lottmapgen_firtree(x, y, z, area, data)
  475. end
  476. elseif biome == 12 then
  477. if math.random(TREE7) == 2 then
  478. lottmapgen_defaulttree(x, y, z, area, data)
  479. elseif math.random(TREE7) == 3 then
  480. lottmapgen_appletree(x, y, z, area, data)
  481. elseif math.random(TREE8) == 4 then
  482. lottmapgen_plumtree(x, y, z, area, data)
  483. elseif math.random(TREE10) == 9 then
  484. lottmapgen_elmtree(x, y, z, area, data)
  485. elseif math.random(PLANT2) == 5 then
  486. lottmapgen_grass(data, vi, p2data)
  487. elseif math.random(PLANT8) == 6 then
  488. lottmapgen_farmingplants(data, vi, p2data)
  489. elseif math.random(PLANT13) == 7 then
  490. data[vi] = c_melon
  491. elseif math.random(PLANT6) == 2 then
  492. data[vi] = c_pilinehtar
  493. p2data[vi] = 2
  494. elseif math.random(PLANT14) == 13 then
  495. lottmapgen.enqueue_building("Rohan Fort", {x=x, y=y, z=z})
  496. end
  497. elseif biome == 13 then
  498. if math.random(TREE7) == 2 then
  499. lottmapgen_defaulttree(x, y, z, area, data)
  500. elseif math.random(TREE7) == 3 then
  501. lottmapgen_appletree(x, y, z, area, data)
  502. elseif math.random(TREE7) == 4 then
  503. lottmapgen_plumtree(x, y, z, area, data)
  504. elseif math.random(TREE7) == 9 then
  505. lottmapgen_oaktree(x, y, z, area, data)
  506. elseif math.random(PLANT7) == 7 then
  507. lottmapgen_farmingplants(data, vi, p2data)
  508. elseif math.random(PLANT9) == 8 then
  509. data[vi] = c_melon
  510. elseif math.random(PLANT14) == 13 then
  511. lottmapgen.enqueue_building("Hobbit Hole", {x=x, y=y, z=z})
  512. end
  513. end
  514. end
  515. end
  516. end
  517. else -- underground
  518. if nodiduu ~= c_air and nodiduu ~= c_water and surfy - y + 1 <= fimadep then
  519. if y <= sandy and y >= sandmin then
  520. if biome ~= 8 then
  521. data[vi] = c_sand
  522. end
  523. elseif y > sandy and y >= surfy - 2 then
  524. if biome ~= 8 then
  525. data[vi] = c_dirt
  526. end
  527. end
  528. end
  529. end
  530. open = false
  531. solid = true
  532. elseif nodid == c_air or nodid == c_water or nodid == c_river_water then
  533. solid = false
  534. if nodid == c_water or nodid == c_river_water then
  535. water = true
  536. if biome == 8 then
  537. if nodid == c_river_water then
  538. data[vi] = c_morrivwat
  539. else
  540. data[vi] = c_morwat
  541. end
  542. end
  543. if n_temp < ICETET and y >= water_level - math.floor((ICETET - n_temp) * 10) then --ice
  544. data[vi] = c_ice
  545. end
  546. end
  547. end
  548. end
  549. nixz = nixz + 1
  550. end
  551. end
  552. vm:set_data(data)
  553. vm:set_param2_data(p2data)
  554. vm:set_lighting({day=0, night=0})
  555. vm:calc_lighting()
  556. vm:write_to_map(data)
  557. --local chugent = math.ceil((os.clock() - t1) * 1000)
  558. --print(chugent)
  559. end)
  560. dofile(minetest.get_modpath("lottmapgen").."/deco.lua")
  561. dofile(minetest.get_modpath("lottmapgen").."/chests.lua")