mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
fix: bug fixes, 3d mode controls change to MapContol
This commit is contained in:
parent
07d0729cfc
commit
34b880e10f
19 changed files with 398 additions and 182 deletions
|
|
@ -360,7 +360,7 @@ window.Routes = (function () {
|
|||
// connect cell with routes system by land
|
||||
function connect(cellId) {
|
||||
const getCost = createCostEvaluator({isWater: false, connections: new Map()});
|
||||
const isExit = cellId => isLand(cellId) && isConnected(cellId);
|
||||
const isExit = c => isLand(c) && isConnected(c);
|
||||
const pathCells = findPath(cellId, isExit, getCost);
|
||||
if (!pathCells) return;
|
||||
|
||||
|
|
@ -372,9 +372,9 @@ window.Routes = (function () {
|
|||
pack.routes.push(newRoute);
|
||||
|
||||
for (let i = 0; i < pathCells.length; i++) {
|
||||
const cellId = pathCells[i];
|
||||
const currentCell = pathCells[i];
|
||||
const nextCellId = pathCells[i + 1];
|
||||
if (nextCellId) addConnection(cellId, nextCellId, routeId);
|
||||
if (nextCellId) addConnection(currentCell, nextCellId, routeId);
|
||||
}
|
||||
|
||||
return newRoute;
|
||||
|
|
@ -446,6 +446,7 @@ window.Routes = (function () {
|
|||
|
||||
const connectivity = Object.values(connections).reduce((acc, routeId) => {
|
||||
const route = pack.routes.find(route => route.i === routeId);
|
||||
if (!route) return acc;
|
||||
const rate = connectivityRateMap[route.group] || connectivityRateMap.default;
|
||||
return acc + rate;
|
||||
}, 0.8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue