Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
MapGen.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
4public class MapGen : BaseMapGen
5{
6 private static MapGen _Instance;
7
8 public static MapGen Instance => _Instance ?? (_Instance = new MapGen());
9
10 protected override void GenerateTerrain()
11 {
12 SetSize((zone is Zone_Gathering) ? 60 : ((!zp.useRootSize) ? zp.size : (zone.GetTopZone().bounds?.Size ?? zp.size)), 10);
13 if (biomes == null || Size != biomes.GetLength(0))
14 {
16 subBiomes = new bool[Size, Size];
17 heights1 = new float[Size, Size];
18 heights2 = new float[Size, Size];
19 heights3 = new float[Size, Size];
20 waters = new float[Size, Size];
21 heights3d = new float[Size, Size];
22 lastSize = Size;
23 }
24 map.biomes = biomes;
25 layerHeight.SaveSettings();
26 layerStratum.SaveSettings();
27 layerBiome.SaveSettings();
28 layerRiver.SaveSettings();
29 layerBiome.SaveSettings();
30 skipWater = zp.noWater || (bp.tileCenter != null && (bp.tileCenter.IsNeighborRoad || bp.tileCenter.isRoad));
31 for (int i = 0; i < 100; i++)
32 {
33 seed = (map.seed = bp.genSetting.seed + i);
36 {
37 break;
38 }
39 Debug.Log("Failed map generation:" + i + " / " + BaseMapGen.err);
40 skipWater = true;
41 }
43 for (int j = 0; j < Size; j++)
44 {
45 for (int k = 0; k < Size; k++)
46 {
48 }
49 }
50 Rand.SetSeed();
51 }
52
53 protected override bool OnGenerateTerrain()
54 {
55 int idMat = 66;
56 if (map.isGenerated)
57 {
58 if (map.Size != Size)
59 {
61 }
62 map.Reset();
63 }
64 else
65 {
67 }
69 if (zone is Zone_Gathering)
70 {
71 map.SetBounds(Size - 20);
72 }
73 else if (bp.zoneProfile.useRootSize && zone.GetTopZone().bounds != null)
74 {
76 }
77 else
78 {
80 }
81 switch (zp.genType)
82 {
83 case ZoneProfile.GenType.Underground:
84 map.config.idBiome = "Underground";
85 zone._biome = null;
86 break;
87 case ZoneProfile.GenType.Sky:
88 {
89 map.config.idBiome = "Sky";
90 zone._biome = null;
91 for (int i = 0; i < Size; i++)
92 {
93 for (int j = 0; j < Size; j++)
94 {
95 SetFloor(i, j, 0, 90);
96 }
97 }
98 return true;
99 }
100 }
101 waterCount = 0f;
102 if (!skipWater)
103 {
104 float num = (float)(Size * Size) * variation.maxWaterRatio;
105 layerRiver.FillHeightMap(waters, OX, 0, OZ, Size, Size, seed);
106 for (int k = 0; k < Size; k++)
107 {
108 for (int l = 0; l < Size; l++)
109 {
110 waters[k, l] += zp.water;
111 if (waters[k, l] > 0f)
112 {
113 waterCount += 1f;
114 }
115 }
116 if (waterCount > num)
117 {
118 BaseMapGen.err = "Too many water";
119 return false;
120 }
121 }
122 }
123 layerBiome.FillHeightMap(heights1, OX, 0, OZ, Size, Size, zp.seeds.biome);
124 layerBiome.FillHeightMap(heights2, OX, 0, OZ, Size, Size, zp.seeds.biome + 1);
125 if (base.extraBiome)
126 {
127 layerBiome.FillHeightMap(heights3, OX, 0, OZ, Size, Size, zp.seeds.biome + 2);
128 }
129 for (int m = 0; m < Size; m++)
130 {
131 for (int n = 0; n < Size; n++)
132 {
133 if (heights1[m, n] != 0f)
134 {
135 biomes[m, n] = biomeProfiles[1];
136 }
137 else if (heights2[m, n] != 0f)
138 {
139 biomes[m, n] = biomeProfiles[2];
140 }
141 else if (base.extraBiome && heights3[m, n] != 0f)
142 {
143 biomes[m, n] = biomeProfiles[3];
144 }
145 else
146 {
147 biomes[m, n] = biomeProfiles[0];
148 }
149 }
150 }
151 layerBiome.FillHeightMap(heights1, OX, 0, OZ, Size, Size, zp.seeds.biomeSub, zp.biomeSubScale);
152 for (int num2 = 0; num2 < Size; num2++)
153 {
154 for (int num3 = 0; num3 < Size; num3++)
155 {
156 subBiomes[num2, num3] = heights1[num2, num3] != 0f;
157 }
158 }
159 layerBiome.FillHeightMap(heights1, OX, 0, OZ, Size, Size, zp.seeds.biome);
160 for (int num4 = 0; num4 < biomeProfiles.Length; num4++)
161 {
162 if (num4 != 0 && biomeProfiles[num4 - 1] == biomeProfiles[num4])
163 {
164 continue;
165 }
166 biomeProfiles[num4].layerBlock.FillHeightMap(heights1, OX, 0, OZ, Size, Size, zp.seeds.biome);
167 bool flag = EClass.sources.floors.rows[biomeProfiles[num4].exterior.floor.id].tag.Contains("soil");
168 for (int num5 = 0; num5 < Size; num5++)
169 {
170 if (zp.clearEdge && ((num5 > map.bounds.x - 4 && num5 <= map.bounds.x + 4) || (num5 > map.bounds.maxX - 4 && num5 <= map.bounds.maxX + 4)))
171 {
172 continue;
173 }
174 for (int num6 = 0; num6 < Size; num6++)
175 {
176 if ((!zp.clearEdge || ((num6 <= map.bounds.z - 4 || num6 > map.bounds.z + 4) && (num6 <= map.bounds.maxZ - 4 || num6 > map.bounds.maxZ + 4))) && !(biomes[num5, num6] != biomeProfiles[num4]) && heights1[num5, num6] > (float)blockHeight)
177 {
179 if (!flag || row.alias == "block_ice")
180 {
182 SetFloor(num5, num6, row2.DefaultMaterial.id, row2.id);
183 }
184 SetBlock(num5, num6, biomeProfiles[num4].exterior.block.mat, biomeProfiles[num4].exterior.block.id);
185 }
186 }
187 }
188 }
189 bool flag2 = false;
190 for (int num7 = Size / 2 - 4; num7 < Size / 2 + 4; num7++)
191 {
192 for (int num8 = Size / 2 - 4; num8 < Size / 2 + 4; num8++)
193 {
194 if (num7 >= 0 && num8 >= 0 && num7 < Size && num8 < Size && map.cells[num7, num8]._block != 0)
195 {
196 flag2 = true;
197 break;
198 }
199 }
200 }
201 if (flag2)
202 {
203 for (int num9 = 0; num9 < Size; num9++)
204 {
205 for (int num10 = 0; num10 < Size; num10++)
206 {
207 SetBlock(num9, num10, 0, 0);
208 }
209 }
210 }
211 layerHeight.FillHeightMap(heights1, OX, 0, OZ, Size, Size, seed);
212 layerHeight.FillHeightMap(heights2, OX, 0, OZ, Size, Size, zp.seeds.bush);
213 layerHeight.FillHeightMap(heights3, OX, 0, OZ, Size, Size, seed + 1);
214 BiomeProfile biomeProfile = biomeWater;
215 byte b = (byte)EClass.setting.maxGenHeight;
216 for (int num11 = 0; num11 < Size; num11++)
217 {
218 for (int num12 = 0; num12 < Size; num12++)
219 {
220 int num13 = (int)heights1[num11, num12];
221 Cell cell = map.cells[num11, num12];
222 if (cell._block != 0 && cell._floor != 0)
223 {
224 continue;
225 }
226 BiomeProfile biomeProfile2 = biomes[num11, num12];
227 SourceMaterial.Row row3 = (subBiomes[num11, num12] ? biomeProfile2.MatSub : biomeProfile2.MatFloor);
228 int dir = biomeProfile2.exterior.floor.GetDir();
229 byte b2 = (byte)(heights1[num11, num12] * (float)hSetting.heightMod + (float)hSetting.baseHeight);
230 if (hSetting.step > 0)
231 {
232 b2 = (byte)(b2 / hSetting.step * hSetting.step);
233 }
234 if (b2 > b)
235 {
236 b2 = b;
237 }
238 cell.height = b2;
239 if (!skipWater && waters[num11, num12] > 0f && cell._block == 0)
240 {
241 cell.height = 0;
242 if ((bool)biomeProfile)
243 {
244 bool flag3 = false;
245 for (int num14 = num12 - 2; num14 < num12 + 3; num14++)
246 {
247 for (int num15 = num11 - 2; num15 < num11 + 3; num15++)
248 {
249 if (num14 >= 0 && num15 >= 0 && num15 < Size && num14 < Size && waters[num15, num14] <= 0f)
250 {
251 flag3 = true;
252 break;
253 }
254 }
255 }
256 SetFloor(num11, num12, biomeWater.MatFloor.id, flag3 ? 44 : 43);
257 }
258 else
259 {
260 SetFloor(num11, num12, idMat, (waters[num11, num12] < 5f) ? 44 : 43);
261 }
262 }
263 else if (zp.shoreHeight > 0f && (float)num13 < zp.shoreHeight)
264 {
265 SetFloor(num11, num12, biomeShore.MatFloor.id, biomeShore.MatFloor.defFloor);
266 biomes[num11, num12] = biomeShore;
267 }
268 else if (biomeProfile2.floor_height != 0 && (int)heights2[num11, num12] + zp.bushMod >= 4)
269 {
270 SetFloor(num11, num12, (byte)row3.id, biomeProfile2.floor_height, dir);
271 }
272 else
273 {
274 SetFloor(num11, num12, (byte)row3.id, (biomeProfile2.exterior.floor.id != 0) ? biomeProfile2.exterior.floor.id : row3.defFloor, dir);
275 }
276 }
277 }
278 if (hSetting.heightMod > 0)
279 {
281 }
282 MakeNeighbor();
283 for (int num16 = 0; num16 < Size; num16++)
284 {
285 for (int num17 = 0; num17 < Size; num17++)
286 {
287 Cell cell2 = map.cells[num16, num17];
288 if (!zp.setShore || cell2.HasBlock || cell2.IsTopWater || cell2.height > 20)
289 {
290 continue;
291 }
292 bool flag4 = false;
293 for (int num18 = num16 - 1; num18 < num16 + 2; num18++)
294 {
295 if (num18 < 0 || num18 >= Size)
296 {
297 continue;
298 }
299 for (int num19 = num17 - 1; num19 < num17 + 2; num19++)
300 {
301 if (num19 >= 0 && num19 < Size && (num18 != num16 || num19 != num17) && map.cells[num18, num19].IsTopWater)
302 {
303 flag4 = true;
304 break;
305 }
306 }
307 if (flag4)
308 {
309 break;
310 }
311 }
312 if (!flag4)
313 {
314 continue;
315 }
316 SetFloor(num16, num17, biomeShore.MatFloor.id, biomeShore.MatFloor.defFloor);
317 biomes[num16, num17] = biomeShore;
318 if (zp.extraShores <= 0)
319 {
320 continue;
321 }
322 int extraShores = zp.extraShores;
323 for (int num20 = num16 - extraShores; num20 < num16 + extraShores + 1; num20++)
324 {
325 if (num20 < 0 || num20 >= Size)
326 {
327 continue;
328 }
329 for (int num21 = num17 - extraShores; num21 < num17 + extraShores + 1; num21++)
330 {
331 if (num21 >= 0 && num21 < Size && !(biomes[num20, num21] == biomeShore) && !map.cells[num20, num21].IsTopWater && !map.cells[num20, num21].HasBlock)
332 {
333 SetFloor(num20, num21, biomeShore.MatFloor.id, biomeShore.MatFloor.defFloor);
334 biomes[num20, num21] = biomeShore;
335 }
336 }
337 }
338 }
339 }
340 return true;
341 }
342
343 public void MakeNeighbor()
344 {
345 EloMap.TileInfo thisInfo;
346 int seaDir;
347 if (bp.surrounding != null)
348 {
349 thisInfo = bp.surrounding[1, 1];
350 seaDir = (thisInfo.sea ? (1 + EClass.rnd(4)) : 0);
351 _MakeNeighbor(bp.surrounding[1, 2], Size / 3 + 7, new Point(0, Size - 1), 0, -1, 3, 1);
352 _MakeNeighbor(bp.surrounding[1, 0], Size / 3 + 7, new Point(0, 0), 0, 1, 1, 3);
353 _MakeNeighbor(bp.surrounding[2, 1], Size / 3 + 7, new Point(Size - 1, 0), -1, 0, 2, 4);
354 _MakeNeighbor(bp.surrounding[0, 1], Size / 3 + 7, new Point(0, 0), 1, 0, 4, 2);
355 EClass._map.config.seaDir = seaDir;
356 }
357 void _MakeNeighbor(EloMap.TileInfo info, int _s, Point p, int vx, int vz, int _seaDir1, int _seaDir2)
358 {
359 int num = _s;
360 int num2 = 4;
361 Point point = new Point();
362 while (p.IsValid)
363 {
364 point.Set(p);
365 num2--;
366 if (num2 < 0)
367 {
368 num += ((EClass.rnd(2) == 0) ? 1 : (-1));
369 num = Mathf.Clamp(num, _s - 3, _s + 3);
370 num2 = 2 + EClass.rnd(4);
371 }
372 for (int i = 0; i < num; i++)
373 {
374 if (vx != 0)
375 {
376 point.x = p.x + i * vx;
377 }
378 else
379 {
380 point.z = p.z + i * vz;
381 }
382 if (point.IsValid)
383 {
384 if (info.sea)
385 {
386 if (!thisInfo.sea)
387 {
388 seaDir = _seaDir1;
389 }
390 SetFloor(point.x, point.z, 66, (i >= num - 3) ? 44 : 43);
391 }
392 else if (info.rock)
393 {
394 SetBlock(point.x, point.z, 45, 1);
395 }
396 else if (info.shore)
397 {
398 if (!thisInfo.shore)
399 {
400 seaDir = _seaDir2;
401 }
402 SetFloor(point.x, point.z, 97, 33);
403 }
404 }
405 }
406 if (vx == 0)
407 {
408 p.x++;
409 }
410 else
411 {
412 p.z++;
413 }
414 }
415 }
416 }
417
418 public void MakeNeighbor_old()
419 {
420 if (bp.surrounding != null)
421 {
422 _MakeNeighbor(bp.surrounding[1, 2], new Point(Size / 2, Size / 3 * 2 - 5), 0, 1);
423 _MakeNeighbor(bp.surrounding[1, 0], new Point(Size / 2, Size / 3 + 6), 0, -1);
424 _MakeNeighbor(bp.surrounding[2, 1], new Point(Size / 3 * 2 - 5, Size / 2), 1, 0);
425 _MakeNeighbor(bp.surrounding[0, 1], new Point(Size / 3 + 6, Size / 2), -1, 0);
426 }
427 void _MakeNeighbor(EloMap.TileInfo info, Point p, int vx, int vz)
428 {
429 Point point = new Point();
430 while (p.IsValid)
431 {
432 point.Set(p);
433 int num = 0;
434 num = EClass.rnd(2) - EClass.rnd(2);
435 if (vx != 0)
436 {
437 p.x += num;
438 }
439 else
440 {
441 p.z += num;
442 }
443 for (int i = -Size / 2; i < Size / 2; i++)
444 {
445 if (vx != 0)
446 {
447 point.z = p.z + i;
448 }
449 else
450 {
451 point.x = p.x + i;
452 }
453 if (point.IsValid)
454 {
455 if (info.sea)
456 {
457 SetFloor(point.x, point.z, 66, 43);
458 }
459 else if (info.rock)
460 {
461 SetBlock(point.x, point.z, 45, 1);
462 }
463 else if (info.shore)
464 {
465 SetFloor(point.x, point.z, 97, 33);
466 }
467 }
468 }
469 p.x += vx;
470 p.z += vz;
471 }
472 }
473 }
474
475 public void MakeRoad()
476 {
477 if (bp.tileCenter != null && !bp.ignoreRoad)
478 {
479 EloMap.TileInfo tileCenter = bp.tileCenter;
480 if (tileCenter.roadLeft)
481 {
482 _MakeRoad(-1, 0);
483 }
484 if (tileCenter.roadRight)
485 {
486 _MakeRoad(1, 0);
487 }
488 if (tileCenter.roadUp)
489 {
490 _MakeRoad(0, 1);
491 }
492 if (tileCenter.roadDown)
493 {
494 _MakeRoad(0, -1);
495 }
496 }
497 void _MakeRoad(int vx, int vz)
498 {
499 Point point = new Point(Size / 2, Size / 2);
500 Point point2 = new Point();
501 while (point.IsValid)
502 {
503 point2.Set(point);
504 for (int i = -1; i < 2; i++)
505 {
506 if (vx != 0)
507 {
508 point2.z = point.z + i;
509 }
510 else
511 {
512 point2.x = point.x + i;
513 }
514 if (point2.IsValid)
515 {
516 SetFloor(point2.x, point2.z, 45, 40);
517 SetBlock(point2.x, point2.z, 0, 0);
518 point2.cell.obj = 0;
519 }
520 }
521 point.x += vx;
522 point.z += vz;
523 if (EClass.rnd(30) == 0)
524 {
525 point.x += ((vx == 0) ? (EClass.rnd(3) - 1) : 0);
526 point.z += ((vz == 0) ? (EClass.rnd(3) - 1) : 0);
527 }
528 }
529 }
530 }
531
532 public void ModifyHeight(Map _map)
533 {
534 map = _map;
535 Cell[,] cells = map.cells;
536 bool flag = false;
537 for (int num = Size - 1; num > 0; num--)
538 {
539 for (int i = 0; i < Size - 1; i++)
540 {
541 Cell cell = cells[num, i];
542 byte b = cell.height;
543 Cell cell2 = cells[num - 1, i];
544 Cell cell3 = cells[num, i + 1];
545 if (cell2.IsTopWater || cell3.IsTopWater)
546 {
547 continue;
548 }
549 if (EClass.rnd(500) == 0)
550 {
551 flag = !flag;
552 }
553 if (EClass.rnd(3) == 0)
554 {
555 if (flag)
556 {
557 cell2.height = b;
558 }
559 else
560 {
561 cell3.height = b;
562 }
563 }
564 if (hSetting.smoothDownhill && EClass.rnd(3) == 0)
565 {
566 if (cell2.height < b - 2)
567 {
568 cell2.height = (byte)(b - 2);
569 }
570 if (cell3.height < b - 2)
571 {
572 cell3.height = (byte)(b - 2);
573 }
574 continue;
575 }
576 if (hSetting.mod1 && (cell2.height >= b - 1 || cell3.height >= b - 1))
577 {
578 if (EClass.rnd(4) == 0 && b != 0)
579 {
580 cell2.height = (cell3.height = b);
581 }
582 else
583 {
584 cell.height = (cell2.height = cell3.height);
585 }
586 }
587 if (hSetting.mod2 && (cell2.height < b - 1 || cell3.height < b - 1))
588 {
589 if (EClass.rnd(2) == 0)
590 {
591 cell2.height = (cell3.height = b);
592 }
593 else
594 {
595 cells[num, i].height = (cell2.height = cell3.height);
596 }
597 }
598 if (hSetting.mod3 && (cell2.height >= b - 1 || cell3.height >= b - 1))
599 {
600 if (EClass.rnd(2) == 0)
601 {
602 cell2.height = (cell3.height = b);
603 }
604 else
605 {
606 cells[num, i].height = (cell2.height = cell3.height);
607 }
608 }
609 }
610 }
612 {
613 return;
614 }
615 for (int num2 = Size - 1; num2 > 0; num2--)
616 {
617 for (int j = 0; j < Size - 1; j++)
618 {
619 byte b2 = cells[num2, j].height;
620 Cell cell4 = cells[num2 - 1, j];
621 Cell cell5 = cells[num2, j + 1];
622 if (b2 != 0)
623 {
624 if (cell4.height < b2 - 2 && !cell4.IsTopWater)
625 {
626 cell4.height = (byte)(b2 - 2);
627 }
628 if (cell5.height < b2 - 2 && !cell5.IsTopWater)
629 {
630 cell5.height = (byte)(b2 - 2);
631 }
632 }
633 }
634 }
635 }
636
637 public void MakeRiver(Map _map)
638 {
639 int num = 0;
640 for (int i = 0; i < 100; i++)
641 {
642 Point point = null;
643 Point point2 = null;
644 for (int j = 0; j < 1000; j++)
645 {
646 point = _map.GetRandomEdge(1);
647 if (!point.cell.blocked)
648 {
649 break;
650 }
651 }
652 for (int k = 0; k < 1000; k++)
653 {
654 point2 = _map.GetRandomEdge(1);
655 if (point.x != point2.x && point.z != point2.z && !point2.cell.blocked && point.Distance(point2) >= _map.Size / 2)
656 {
657 break;
658 }
659 }
660 if (TryMakeRiver(point, point2))
661 {
662 num += 1 + EClass.rnd(2);
663 if (num > 10)
664 {
665 break;
666 }
667 }
668 }
669 }
670
671 public bool TryMakeRiver(Point p1, Point p2)
672 {
673 List<Point> list = new List<Point>();
674 int num = 30;
675 for (int i = 0; i < num; i++)
676 {
677 Point point = new Point();
678 point.x = p1.x + (p2.x - p1.x) * i / num;
679 point.z = p1.z + (p2.z - p1.z) * i / num;
680 list.Add(point);
681 }
682 for (int j = 0; j < num; j++)
683 {
684 Point point2 = list[j];
685 if (p1.Equals(point2))
686 {
687 continue;
688 }
689 while (!p1.IsWater)
690 {
691 SetBlock(p1.x, p1.z, 0, 0);
692 SetFloor(p1.x, p1.z, 67, 44);
693 if (EClass.rnd(2) == 0)
694 {
695 if (p1.x != point2.x)
696 {
697 p1.x += ((p1.x <= point2.x) ? 1 : (-1));
698 }
699 else if (p1.z != point2.z)
700 {
701 p1.z += ((p1.z <= point2.z) ? 1 : (-1));
702 }
703 }
704 else if (p1.z != point2.z)
705 {
706 p1.z += ((p1.z <= point2.z) ? 1 : (-1));
707 }
708 else if (p1.x != point2.x)
709 {
710 p1.x += ((p1.x <= point2.x) ? 1 : (-1));
711 }
712 if (p1.Equals(point2))
713 {
714 break;
715 }
716 }
717 if (p1.IsWater || p1.Equals(p2))
718 {
719 return true;
720 }
721 }
722 return true;
723 }
724
725 public void Populate(Map _map)
726 {
727 map = _map;
728 EClass._zone.isShore = bp.zoneProfile.isShore;
730 if (zp.river)
731 {
733 }
735 layerStratum.FillHeightMap(heights1, OX, 0, OZ, Size, Size, seed);
736 layerStratum.FillHeightMap(heights2, OX, 0, OZ, Size, Size, seed + 1);
737 layerStratum.FillHeightMap(heights3, OX, 0, OZ, Size, Size, seed + 2);
738 layerStratum.FillHeightMap(heights3d, OX, 0, OZ, Size, Size, seed);
739 Point point = new Point();
740 for (int i = 0; i < Size; i++)
741 {
742 for (int j = 0; j < Size; j++)
743 {
744 point.Set(i, j);
745 Cell cell = point.cell;
746 if (cell.IsTopWater && (bool)biomeWater)
747 {
748 if (cell.Left.IsTopWater && cell.Right.IsTopWater && cell.Front.IsTopWater && cell.Back.IsTopWater)
749 {
750 biomeWater.Populate(point);
751 }
752 continue;
753 }
754 BiomeProfile biome = cell.biome;
755 if (!cell.HasBlock)
756 {
757 biome.Populate(point);
758 }
759 }
760 }
761 if (zp.name == "R_Plain")
762 {
763 Crawler crawler = Crawler.Create("pasture");
764 int tries = 10;
765 crawler.CrawlUntil(_map, () => _map.GetRandomPoint(), tries, delegate(Crawler.Result r)
766 {
767 int id = ((EClass.rnd(3) == 0) ? 108 : 105);
768 foreach (Point point2 in r.points)
769 {
770 map.SetObj(point2.x, point2.z, id);
771 int num = 3;
772 if (EClass.rnd(6) == 0)
773 {
774 num++;
775 }
776 point2.growth.SetStage(num);
777 }
778 return false;
779 });
780 }
781 if (crawlers != null)
782 {
783 Crawler[] array = crawlers;
784 for (int k = 0; k < array.Length; k++)
785 {
786 array[k].Crawl(map);
787 }
788 }
789 MakeRoad();
790 Rand.SetSeed();
791 }
792
793 public void Output()
794 {
795 Debug.Log(zp.name + "/" + variation.name);
796 Debug.Log("seed:" + EClass._map.seed + " offset: " + OX + "/" + OZ);
797 }
798}
float[,] heights3
Definition: BaseMapGen.cs:51
float[,] waters
Definition: BaseMapGen.cs:54
int lastSize
Definition: BaseMapGen.cs:66
float[,] heights2
Definition: BaseMapGen.cs:48
NoiseLayer layerStratum
Definition: BaseMapGen.cs:15
static string err
Definition: BaseMapGen.cs:6
NoiseLayer layerBiome
Definition: BaseMapGen.cs:18
float[,] heights3d
Definition: BaseMapGen.cs:57
BiomeProfile[,] biomes
Definition: BaseMapGen.cs:78
float waterCount
Definition: BaseMapGen.cs:75
NoiseLayer layerHeight
Definition: BaseMapGen.cs:9
void SetSize(int size, int _poiSize)
Definition: BaseMapGen.cs:91
ZoneProfile zp
Definition: BaseMapGen.cs:42
Crawler[] crawlers
Definition: BaseMapGen.cs:33
ZoneBlueprint bp
Definition: BaseMapGen.cs:39
float[,] heights1
Definition: BaseMapGen.cs:45
MapHeight hSetting
Definition: BaseMapGen.cs:87
NoiseLayer layerRiver
Definition: BaseMapGen.cs:12
BiomeProfile[] biomeProfiles
Definition: BaseMapGen.cs:21
BiomeProfile biomeShore
Definition: BaseMapGen.cs:24
int blockHeight
Definition: BaseMapGen.cs:60
MapGenVariation variation
Definition: BaseMapGen.cs:84
bool skipWater
Definition: BaseMapGen.cs:36
BiomeProfile biomeWater
Definition: BaseMapGen.cs:30
bool[,] subBiomes
Definition: BaseMapGen.cs:81
TileGroup exterior
NoiseLayer layerBlock
void Populate(Point point, bool interior=false)
SourceMaterial.Row MatFloor
Definition: Cell.cs:7
byte _block
Definition: Cell.cs:30
bool HasBlock
Definition: Cell.cs:643
byte _floor
Definition: Cell.cs:34
Cell Back
Definition: Cell.cs:153
Cell Front
Definition: Cell.cs:129
BiomeProfile biome
Definition: Cell.cs:1075
bool IsTopWater
Definition: Cell.cs:700
byte height
Definition: Cell.cs:72
Cell Left
Definition: Cell.cs:165
Cell Right
Definition: Cell.cs:141
void Crawl(Map map)
Definition: Crawler.cs:107
static Crawler Create(string id)
Definition: Crawler.cs:190
bool CrawlUntil(Map map, Func< Point > onStart, int tries, Func< Result, bool > canComplete, Action onFail=null)
Definition: Crawler.cs:57
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static GameSetting setting
Definition: EClass.cs:34
bool roadLeft
Definition: EloMap.cs:38
bool roadUp
Definition: EloMap.cs:42
bool shore
Definition: EloMap.cs:50
bool roadDown
Definition: EloMap.cs:44
bool roadRight
Definition: EloMap.cs:40
Definition: EloMap.cs:8
int maxGenHeight
Definition: GameSetting.cs:331
int defaultMapSize
Definition: GameSetting.cs:335
void SetBlock(BiomeProfile.Tile t, int x, int z, int idMat=-1)
Definition: GenBounds.cs:43
Zone zone
Definition: GenBounds.cs:9
int Size
Definition: GenBounds.cs:11
Map map
Definition: GenBounds.cs:7
void SetFloor(BiomeProfile.Tile t, int x, int z)
Definition: GenBounds.cs:37
int Size
Definition: MapBounds.cs:20
int maxZ
Definition: MapBounds.cs:17
int maxX
Definition: MapBounds.cs:14
int x
Definition: MapBounds.cs:8
Definition: MapGen.cs:5
void MakeRoad()
Definition: MapGen.cs:475
void MakeNeighbor_old()
Definition: MapGen.cs:418
bool TryMakeRiver(Point p1, Point p2)
Definition: MapGen.cs:671
override void GenerateTerrain()
Definition: MapGen.cs:10
void ModifyHeight(Map _map)
Definition: MapGen.cs:532
void MakeNeighbor()
Definition: MapGen.cs:343
static MapGen _Instance
Definition: MapGen.cs:6
static MapGen Instance
Definition: MapGen.cs:8
void MakeRiver(Map _map)
Definition: MapGen.cs:637
override bool OnGenerateTerrain()
Definition: MapGen.cs:53
void Populate(Map _map)
Definition: MapGen.cs:725
void Output()
Definition: MapGen.cs:793
int heightMod
Definition: MapHeight.cs:5
int baseHeight
Definition: MapHeight.cs:7
bool mod2
Definition: MapHeight.cs:15
bool mod3
Definition: MapHeight.cs:17
bool smoothDownhill
Definition: MapHeight.cs:11
bool mod1
Definition: MapHeight.cs:13
int step
Definition: MapHeight.cs:9
Definition: Map.cs:13
bool isGenerated
Definition: Map.cs:129
Point GetRandomPoint(Point center, int radius, int tries=100, bool mustBeWalkable=true, bool requireLos=true)
Definition: Map.cs:2193
void Reset()
Definition: Map.cs:345
void SetBounds(int size)
Definition: Map.cs:2309
void SetZone(Zone _zone)
Definition: Map.cs:181
int seed
Definition: Map.cs:19
POIMap poiMap
Definition: Map.cs:97
new Point GetRandomEdge(int r=3)
Definition: Map.cs:2211
void QuickRefreshTile(int x, int z)
Definition: Map.cs:2116
Cell[,] cells
Definition: Map.cs:85
void CreateNew(int size, bool setReference=true)
Definition: Map.cs:153
void Resize(int newSize)
Definition: Map.cs:226
void RefreshAllTiles()
Definition: Map.cs:2086
MapBounds bounds
Definition: Map.cs:52
void Reset()
Definition: POIMap.cs:35
Definition: Point.cs:9
Point Set(int _x, int _z)
Definition: Point.cs:479
bool IsWater
Definition: Point.cs:129
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
bool Equals(int _x, int _z)
Definition: Point.cs:924
bool IsValid
Definition: Point.cs:88
int Distance(Point p)
Definition: Point.cs:953
Point Clamp(bool useBounds=false)
Definition: Point.cs:972
Cell cell
Definition: Point.cs:51
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37
SourceMaterial.Row DefaultMaterial
Definition: RenderRow.cs:86
string autoFloor
Definition: SourceBlock.cs:15
SourceBlock blocks
SourceFloor floors
string alias
Definition: TileRow.cs:12
int id
Definition: TileRow.cs:8
ZoneProfile zoneProfile
EloMap.TileInfo tileCenter
EloMap.TileInfo[,] surrounding
float shoreHeight
Definition: ZoneProfile.cs:49
bool isShore
Definition: ZoneProfile.cs:53
int sizeBounds
Definition: ZoneProfile.cs:35
Seeds seeds
Definition: ZoneProfile.cs:31
bool setShore
Definition: ZoneProfile.cs:55
float biomeSubScale
Definition: ZoneProfile.cs:51
bool useRootSize
Definition: ZoneProfile.cs:61
GenType genType
Definition: ZoneProfile.cs:69
bool clearEdge
Definition: ZoneProfile.cs:65
int extraShores
Definition: ZoneProfile.cs:47
Zone GetTopZone()
Definition: Zone.cs:1854
MapBounds bounds
Definition: Zone.cs:46