Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/ardennes_forest.js
Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | for (let iz = 0; iz < mapSize; iz++) | ||||
const n = (noise0.get(x,z) - 0.5) * 10; | const n = (noise0.get(x,z) - 0.5) * 10; | ||||
g_Map.setHeight(position, h + (n * pn)); | g_Map.setHeight(position, h + (n * pn)); | ||||
} | } | ||||
} | } | ||||
Engine.SetProgress(60); | Engine.SetProgress(60); | ||||
g_Map.log("Creating forests"); | g_Map.log("Creating forests"); | ||||
var [forestTrees, stragglerTrees] = getTreeCounts(1300, 8000, 0.8); | const [protoPorestTrees, stragglerTrees] = getTreeCounts(1300, 8000, 0.8); | ||||
var [forestTreesJoin, forestTrees] = getTreeCounts(forestTrees, forestTrees, 0.25); | const [forestTreesJoin, forestTrees] = getTreeCounts(protoPorestTrees, protoPorestTrees, 0.25); | ||||
var num = forestTrees / scaleByMapSize(20, 70); | const treeNum = forestTrees / scaleByMapSize(20, 70); | ||||
createAreasInAreas( | createAreasInAreas( | ||||
new ClumpPlacer(forestTrees / num, 0.1, 0.1, Infinity), | new ClumpPlacer(forestTrees / treeNum, 0.1, 0.1, Infinity), | ||||
[ | [ | ||||
new TerrainPainter(pForest), | new TerrainPainter(pForest), | ||||
new TileClassPainter(clForest) | new TileClassPainter(clForest) | ||||
], | ], | ||||
avoidClasses(clPlayer, 5, clBaseResource, 4, clForest, 5, clHill, 4), | avoidClasses(clPlayer, 5, clBaseResource, 4, clForest, 5, clHill, 4), | ||||
num, | treeNum, | ||||
100, | 100, | ||||
[explorableArea] | [explorableArea] | ||||
); | ); | ||||
var num = forestTreesJoin / (scaleByMapSize(4, 6) * numPlayers); | const joinNum = forestTreesJoin / (scaleByMapSize(4, 6) * numPlayers); | ||||
createAreasInAreas( | createAreasInAreas( | ||||
new ClumpPlacer(forestTreesJoin / num, 0.1, 0.1, Infinity), | new ClumpPlacer(forestTreesJoin / joinNum, 0.1, 0.1, Infinity), | ||||
[ | [ | ||||
new TerrainPainter(pForest), | new TerrainPainter(pForest), | ||||
new TileClassPainter(clForest), | new TileClassPainter(clForest), | ||||
new TileClassPainter(clForestJoin) | new TileClassPainter(clForestJoin) | ||||
], | ], | ||||
[avoidClasses(clPlayer, 5, clBaseResource, 4, clForestJoin, 5, clHill, 4), borderClasses(clForest, 1, 4)], | [avoidClasses(clPlayer, 5, clBaseResource, 4, clForestJoin, 5, clHill, 4), borderClasses(clForest, 1, 4)], | ||||
num, | joinNum, | ||||
100, | 100, | ||||
[explorableArea] | [explorableArea] | ||||
); | ); | ||||
Engine.SetProgress(70); | Engine.SetProgress(70); | ||||
g_Map.log("Creating grass patches"); | g_Map.log("Creating grass patches"); | ||||
for (const size of [scaleByMapSize(3, 48), scaleByMapSize(5, 84), scaleByMapSize(8, 128)]) | for (const size of [scaleByMapSize(3, 48), scaleByMapSize(5, 84), scaleByMapSize(8, 128)]) | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | createObjectGroupsByAreasDeprecated( | ||||
scaleByMapSize(5, 50), 50, | scaleByMapSize(5, 50), 50, | ||||
[explorableArea] | [explorableArea] | ||||
); | ); | ||||
Engine.SetProgress(90); | Engine.SetProgress(90); | ||||
g_Map.log("Creating straggler trees"); | g_Map.log("Creating straggler trees"); | ||||
const types = [oOak, oOakLarge, oPine, oAleppoPine]; | const types = [oOak, oOakLarge, oPine, oAleppoPine]; | ||||
var num = Math.floor(stragglerTrees / types.length); | const stragglerNum = Math.floor(stragglerTrees / types.length); | ||||
for (const type of types) | for (const type of types) | ||||
createObjectGroupsByAreasDeprecated( | createObjectGroupsByAreasDeprecated( | ||||
new SimpleGroup([new SimpleObject(type, 1, 1, 0, 3)], true, clForest), | new SimpleGroup([new SimpleObject(type, 1, 1, 0, 3)], true, clForest), | ||||
0, | 0, | ||||
avoidClasses(clForest, 4, clHill, 5, clPlayer, 10, clBaseResource, 2, clMetal, 5, clRock, 5), | avoidClasses(clForest, 4, clHill, 5, clPlayer, 10, clBaseResource, 2, clMetal, 5, clRock, 5), | ||||
num, 20, | stragglerNum, 20, | ||||
[explorableArea]); | [explorableArea]); | ||||
Engine.SetProgress(95); | Engine.SetProgress(95); | ||||
g_Map.log("Creating grass tufts"); | g_Map.log("Creating grass tufts"); | ||||
group = new SimpleGroup( | group = new SimpleGroup( | ||||
[new SimpleObject(aGrassLarge, 1,2, 0,1, -Math.PI / 8, Math.PI / 8)] | [new SimpleObject(aGrassLarge, 1,2, 0,1, -Math.PI / 8, Math.PI / 8)] | ||||
); | ); | ||||
Show All 9 Lines |
Wildfire Games · Phabricator