Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/alpine_valley.js
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | else | ||||
this.SetConnectable(true); | this.SetConnectable(true); | ||||
this.possibleEdges.splice(this.index, 1); | this.possibleEdges.splice(this.index, 1); | ||||
} | } | ||||
}; | }; | ||||
setBiome(g_MapSettings.Biome ?? "alpine/winter"); | setBiome(g_MapSettings.Biome ?? "alpine/winter"); | ||||
var heightLand = 3; | const heightLand = 3; | ||||
var heightOffsetBump = 2; | const heightOffsetBump = 2; | ||||
var snowlineHeight = 29; | const snowlineHeight = 29; | ||||
var heightMountain = 30; | const heightMountain = 30; | ||||
const pForest = [g_Terrains.forestFloor + TERRAIN_SEPARATOR + g_Gaia.tree1, g_Terrains.forestFloor]; | const pForest = [g_Terrains.forestFloor + TERRAIN_SEPARATOR + g_Gaia.tree1, g_Terrains.forestFloor]; | ||||
const g_Map = new RandomMap(heightLand, g_Terrains.mainTerrain); | const g_Map = new RandomMap(heightLand, g_Terrains.mainTerrain); | ||||
const numPlayers = getNumPlayers(); | const numPlayers = getNumPlayers(); | ||||
const mapCenter = g_Map.getCenter(); | const mapCenter = g_Map.getCenter(); | ||||
const clPlayer = g_Map.createTileClass(); | const clPlayer = g_Map.createTileClass(); | ||||
const clHill = g_Map.createTileClass(); | const clHill = g_Map.createTileClass(); | ||||
const clForest = g_Map.createTileClass(); | const clForest = g_Map.createTileClass(); | ||||
const clDirt = g_Map.createTileClass(); | const clDirt = g_Map.createTileClass(); | ||||
const clRock = g_Map.createTileClass(); | const clRock = g_Map.createTileClass(); | ||||
const clMetal = g_Map.createTileClass(); | const clMetal = g_Map.createTileClass(); | ||||
const clFood = g_Map.createTileClass(); | const clFood = g_Map.createTileClass(); | ||||
const clBaseResource = g_Map.createTileClass(); | const clBaseResource = g_Map.createTileClass(); | ||||
var [playerIDs, playerPosition, playerAngle, startAngle] = playerPlacementCircle(fractionToTiles(0.35)); | const [playerIDs, playerPosition, playerAngle, startAngle] = playerPlacementCircle(fractionToTiles(0.35)); | ||||
placePlayerBases({ | placePlayerBases({ | ||||
"PlayerPlacement": [playerIDs, playerPosition], | "PlayerPlacement": [playerIDs, playerPosition], | ||||
"PlayerTileClass": clPlayer, | "PlayerTileClass": clPlayer, | ||||
"BaseResourceClass": clBaseResource, | "BaseResourceClass": clBaseResource, | ||||
"CityPatch": { | "CityPatch": { | ||||
"outerTerrain": g_Terrains.roadWild, | "outerTerrain": g_Terrains.roadWild, | ||||
"innerTerrain": g_Terrains.road | "innerTerrain": g_Terrains.road | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
Engine.SetProgress(50); | Engine.SetProgress(50); | ||||
g_Map.log("Creating forests"); | g_Map.log("Creating forests"); | ||||
const [forestTrees, stragglerTrees] = getTreeCounts(500, 3000, 0.7); | const [forestTrees, stragglerTrees] = getTreeCounts(500, 3000, 0.7); | ||||
const types = [ | const types = [ | ||||
[[g_Terrains.forestFloor, g_Terrains.mainTerrain, pForest], [g_Terrains.forestFloor, pForest]] | [[g_Terrains.forestFloor, g_Terrains.mainTerrain, pForest], [g_Terrains.forestFloor, pForest]] | ||||
]; | ]; | ||||
var size = forestTrees / (scaleByMapSize(2,8) * numPlayers); | const size = forestTrees / (scaleByMapSize(2, 8) * numPlayers); | ||||
const num = Math.floor(size / types.length); | const num = Math.floor(size / types.length); | ||||
for (const type of types) | for (const type of types) | ||||
createAreas( | createAreas( | ||||
new ClumpPlacer(forestTrees / num, 0.1, 0.1, Infinity), | new ClumpPlacer(forestTrees / num, 0.1, 0.1, Infinity), | ||||
[ | [ | ||||
new LayeredPainter(type, [2]), | new LayeredPainter(type, [2]), | ||||
new TileClassPainter(clForest) | new TileClassPainter(clForest) | ||||
Show All 24 Lines | createAreas( | ||||
new ClumpPlacer(size, 0.3, 0.06, 0.5), | new ClumpPlacer(size, 0.3, 0.06, 0.5), | ||||
new TerrainPainter(g_Terrains.tier2Terrain), | new TerrainPainter(g_Terrains.tier2Terrain), | ||||
avoidClasses(clForest, 0, clHill, 0, clDirt, 5, clPlayer, 12), | avoidClasses(clForest, 0, clHill, 0, clDirt, 5, clPlayer, 12), | ||||
scaleByMapSize(15, 45)); | scaleByMapSize(15, 45)); | ||||
Engine.SetProgress(65); | Engine.SetProgress(65); | ||||
g_Map.log("Creating stone mines"); | g_Map.log("Creating stone mines"); | ||||
var group = new SimpleGroup( | let group = new SimpleGroup( | ||||
[ | [ | ||||
new SimpleObject(g_Gaia.stoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), | new SimpleObject(g_Gaia.stoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), | ||||
new SimpleObject(g_Gaia.stoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4) | new SimpleObject(g_Gaia.stoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4) | ||||
], | ], | ||||
true, | true, | ||||
clRock); | clRock); | ||||
createObjectGroupsDeprecated(group, 0, | createObjectGroupsDeprecated(group, 0, | ||||
avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), | avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
createStragglerTrees( | createStragglerTrees( | ||||
[g_Gaia.tree1], | [g_Gaia.tree1], | ||||
avoidClasses(clForest, 1, clHill, 1, clPlayer, 12, clMetal, 6, clRock, 6), | avoidClasses(clForest, 1, clHill, 1, clPlayer, 12, clMetal, 6, clRock, 6), | ||||
clForest, | clForest, | ||||
stragglerTrees); | stragglerTrees); | ||||
g_Map.log("Creating small grass tufts"); | g_Map.log("Creating small grass tufts"); | ||||
var planetm = 1; | const planetm = 1; | ||||
group = new SimpleGroup( | group = new SimpleGroup( | ||||
[new SimpleObject(g_Decoratives.grassShort, 1, 2, 0, 1, -Math.PI / 8, Math.PI / 8)] | [new SimpleObject(g_Decoratives.grassShort, 1, 2, 0, 1, -Math.PI / 8, Math.PI / 8)] | ||||
); | ); | ||||
createObjectGroupsDeprecated(group, 0, | createObjectGroupsDeprecated(group, 0, | ||||
avoidClasses(clHill, 2, clPlayer, 2, clDirt, 0), | avoidClasses(clHill, 2, clPlayer, 2, clDirt, 0), | ||||
planetm * scaleByMapSize(13, 200) | planetm * scaleByMapSize(13, 200) | ||||
); | ); | ||||
Show All 28 Lines |
Wildfire Games · Phabricator