@@ -147,9 +147,9 @@ function getDefaultSettings() {
147
147
hexSize : 16 ,
148
148
hexOrientation : 'flat' ,
149
149
//hexColums: colums, // x
150
- hexColums : 20 , // x
150
+ hexColums : 10 , // x
151
151
//hexRows: rows, // y
152
- hexRows : 20 , // y
152
+ hexRows : 10 , // y
153
153
lineThickness : 1 ,
154
154
lineColor : 0x999999 ,
155
155
hideCoords : true ,
@@ -416,7 +416,7 @@ function loadGrid(app, viewport, settings) {
416
416
counter ++ ;
417
417
}
418
418
}
419
- if ( terrainSorrounded && counter < 2 ) {
419
+ if ( terrainSorrounded && counter < 1 ) {
420
420
if ( counter === 0 ) hex . tile = lookup ( ) <= 50 ? "lake2" : "lake1" ;
421
421
else if ( counter === 1 ) hex . tile = lookup ( ) <= 50 ? "lake4" : "lake3" ;
422
422
}
@@ -491,7 +491,7 @@ function loadGrid(app, viewport, settings) {
491
491
let riverSources = [ ] ;
492
492
gr . forEach ( hex => {
493
493
if ( hex . biome === "Water" || hex . tile === "Volcano" || hex . archetype === "Flat" ) return ;
494
- if ( hex . moisture < 0.70 && hex . archetype !== "Mountain impassable" && hex . biome !== 'Alpine forest' ) return ;
494
+ if ( hex . moisture < 0.60 && hex . archetype !== "Mountain impassable" && hex . biome !== 'Alpine forest' ) return ;
495
495
496
496
hex . source = false ;
497
497
if ( hex . archetype === "Hill" && lookup ( ) <= 6 ) {
@@ -557,7 +557,13 @@ function loadGrid(app, viewport, settings) {
557
557
for ( let i = 0 ; i < hexesInRange . length ; i ++ ) {
558
558
let hexToCheck = hexesInRange [ i ] ;
559
559
560
- if ( typeof hexToCheck === 'undefined' ) {
560
+ if ( typeof hexToCheck !== 'undefined' && ( hexToCheck . tile === "ShallowWater" || hexToCheck . tile === "DeepWater" || hexToCheck . tile . includes ( 'lake' ) ) ) {
561
+ hex . sideRiverExit = i ;
562
+ hex . riverEnd = true ;
563
+ hexDestination = null ;
564
+ hex . river = null ;
565
+ break ;
566
+ } else if ( typeof hexToCheck === 'undefined' ) {
561
567
hex . sideRiverExit = i ;
562
568
hex . riverEnd = true ;
563
569
hexDestination = null ;
@@ -573,8 +579,8 @@ function loadGrid(app, viewport, settings) {
573
579
//No go north or south impassable
574
580
if ( i === 4 && biomeTileset [ hex . tile ] . z === 5 ) continue ;
575
581
if ( i === 1 && biomeTileset [ hexToCheck . tile ] . z === 5 && biomeTileset [ hex . tile ] . z === 5 ) continue ;
576
- if ( hexToCheck . x === settings . hexColums ) continue ;
577
- if ( hexToCheck . y === settings . hexRows ) continue ;
582
+ if ( hexToCheck . x === settings . hexColums - 1 && hex . source === true ) continue ;
583
+ if ( hexToCheck . y === settings . hexRows - 1 && hex . source === true ) continue ;
578
584
579
585
if ( ! hexDestination ) {
580
586
hexDestination = hexToCheck ;
@@ -583,7 +589,7 @@ function loadGrid(app, viewport, settings) {
583
589
else if ( biomeTileset [ hexToCheck . tile ] . z < biomeTileset [ hexDestination . tile ] . z ) {
584
590
hexDestination = hexToCheck ;
585
591
}
586
- // For the same archetype choose more moisture
592
+ // The source runs to the most moisture hex.
587
593
else if ( hex . source === true && biomeTileset [ hexToCheck . tile ] . z === biomeTileset [ hexDestination . tile ] . z && hexToCheck . moisture > hexDestination . moisture ) {
588
594
hexDestination = hexToCheck ;
589
595
} else if ( hex . source !== true && biomeTileset [ hexToCheck . tile ] . z === biomeTileset [ hexDestination . tile ] . z && hexToCheck . elevation < hexDestination . elevation ) {
@@ -597,6 +603,7 @@ function loadGrid(app, viewport, settings) {
597
603
hexDestination . sourceSon = true ;
598
604
}
599
605
606
+ /*
600
607
if (biomeTileset[hex.tile].z < biomeTileset[hexDestination.tile].z) {
601
608
// Dibujamos lago
602
609
hex.redrawAsLake = true;
@@ -617,16 +624,33 @@ function loadGrid(app, viewport, settings) {
617
624
} else {
618
625
hexDestination.riverId = hex.riverId;
619
626
}
627
+ }*/
628
+
629
+ let indexHex = hexesInRange . indexOf ( hexDestination ) ;
630
+ hex . sideRiverExit = indexHex ;
631
+ hexDestination . sideRiverEnter = indexHex > 2 ? indexHex - 3 : indexHex + 3 ;
632
+ if ( hexDestination . tile === "ShallowWater" || hexDestination . tile === "DeepWater" || hexDestination . tile . includes ( 'lake' ) && hexDestination . archetype !== 'flat' ) {
633
+ hexDestination . riverEnd = true ;
634
+ } else if ( hexDestination . tile . includes ( 'lake' ) && hexDestination . archetype === 'flat' ) {
635
+ //nada
636
+ } else if ( hexDestination . riverId && hex . riverId !== hexDestination . riverId ) {
637
+ // Si es un source, hay que dibujar tambien el hexagono del source --> hexDestination.
638
+ hex . riverEnd = true ;
639
+ hex . riverJoin = true ;
640
+ // Hay que dibujar una conexión entre ríos
641
+ } else {
642
+ hexDestination . riverId = hex . riverId ;
620
643
}
644
+
621
645
}
622
646
623
647
if ( hex . riverJoin === true ) {
624
- console . log ( 'dibujarmos conexion' )
648
+ console . log ( 'dibujamos conexion' )
625
649
console . log ( hex ) ;
626
650
drawRiverTile ( hex ) ;
627
651
return ;
628
652
} else if ( hex . redrawAsLake && ! hex . sourceSon ) {
629
- console . log ( 'dibujarmos lago' )
653
+ console . log ( 'dibujamos lago' )
630
654
console . log ( hex ) ;
631
655
drawLakeTile ( hex ) ;
632
656
return ;
0 commit comments