Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/archipelago.js
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | createArea( | ||||
new ChainPlacer( | new ChainPlacer( | ||||
2, | 2, | ||||
Math.floor(scaleByMapSize(5, 10)), | Math.floor(scaleByMapSize(5, 10)), | ||||
Math.floor(scaleByMapSize(25, 60)), | Math.floor(scaleByMapSize(25, 60)), | ||||
Infinity, | Infinity, | ||||
playerPosition[i], | playerPosition[i], | ||||
0, | 0, | ||||
[Math.floor(islandRadius)]), | [Math.floor(islandRadius)]), | ||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 4)); | [ | ||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 4), | |||||
new TileClassPainter(clLand) | |||||
]); | |||||
g_Map.log("Creating random islands"); | g_Map.log("Creating random islands"); | ||||
createAreas( | createAreas( | ||||
new ChainPlacer( | new ChainPlacer( | ||||
Math.floor(scaleByMapSize(4, 8)), | Math.floor(scaleByMapSize(4, 8)), | ||||
Math.floor(scaleByMapSize(8, 14)), | Math.floor(scaleByMapSize(8, 14)), | ||||
Math.floor(scaleByMapSize(25, 60)), | Math.floor(scaleByMapSize(25, 60)), | ||||
0.07, | 0.07, | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
createBumps([avoidClasses(clPlayer, 10), stayClasses(clLand, 5)]); | createBumps([avoidClasses(clPlayer, 10), stayClasses(clLand, 5)]); | ||||
if (randBool()) | if (randBool()) | ||||
createHills([tMainTerrain, tCliff, tHill], [avoidClasses(clPlayer, 2, clHill, 15), stayClasses(clLand, 0)], clHill, scaleByMapSize(1, 4) * numPlayers); | createHills([tMainTerrain, tCliff, tHill], [avoidClasses(clPlayer, 2, clHill, 15), stayClasses(clLand, 0)], clHill, scaleByMapSize(1, 4) * numPlayers); | ||||
else | else | ||||
createMountains(tCliff, [avoidClasses(clPlayer, 2, clHill, 15), stayClasses(clLand, 0)], clHill, scaleByMapSize(1, 4) * numPlayers); | createMountains(tCliff, [avoidClasses(clPlayer, 2, clHill, 15), stayClasses(clLand, 0)], clHill, scaleByMapSize(1, 4) * numPlayers); | ||||
var [forestTrees, stragglerTrees] = getTreeCounts(...rBiomeTreeCount(1)); | // bump tree amount in all biomes and especially in sahara to ensure the players get some wood | ||||
// exclude india as it gets too crowded | |||||
var treeAmount = 1.2 | |||||
Lint: semi: Missing semicolon. | |||||
if (currentBiome() == "generic/sahara") | |||||
Done Inline ActionsCan extract these out to JSON, or even a regular object, to at least make it easier when someone decides to mess with biomes. { "generic/india": { "treeAmount": 1, "forestForestSpacing": 20, "treeAmount": 20, } } lyv: Can extract these out to JSON, or even a regular object, to at least make it easier when… | |||||
treeAmount = 2 | |||||
Lint: semi Missing semicolon. Lint: semi: Missing semicolon. | |||||
else if (currentBiome() == "generic/india") | |||||
Done Inline ActionsYou can do something like const biomeSpecifics = biomeTweaks[currentBiome()] || biomeTweaks["baseline"] and get away with having zero hardcoded biome names in the map script. lyv: You can do something like `const biomeSpecifics = biomeTweaks[currentBiome()] || biomeTweaks… | |||||
Done Inline Actionsthanks, yes that makes it much cleaner marder: thanks, yes that makes it much cleaner | |||||
treeAmount = 1 | |||||
Lint: semi Missing semicolon. Lint: semi: Missing semicolon. | |||||
var forestForestSpacing = currentBiome() == "generic/india" ? 20 : 13; | |||||
var forestPlayerSpacing = currentBiome() == "generic/india" ? 20 : 10; | |||||
var [forestTrees, stragglerTrees] = getTreeCounts(...rBiomeTreeCount(treeAmount)); | |||||
createForests( | createForests( | ||||
[tMainTerrain, tForestFloor1, tForestFloor2, pForest1, pForest2], | [tMainTerrain, tForestFloor1, tForestFloor2, pForest1, pForest2], | ||||
[avoidClasses(clPlayer, 20, clForest, 17, clHill, 0), stayClasses(clLand, 4)], | [avoidClasses(clPlayer, forestPlayerSpacing, clForest, forestForestSpacing, clHill, 0), stayClasses(clLand, 3)], | ||||
Lint: indent Expected indentation of 1 tab but found 1 space. Lint: indent: Expected indentation of 1 tab but found 1 space. | |||||
clForest, | clForest, | ||||
forestTrees); | forestTrees); | ||||
Engine.SetProgress(50); | Engine.SetProgress(50); | ||||
g_Map.log("Creating dirt patches"); | g_Map.log("Creating dirt patches"); | ||||
createLayeredPatches( | createLayeredPatches( | ||||
[scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)], | [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)], | ||||
[[tMainTerrain,tTier1Terrain],[tTier1Terrain,tTier2Terrain], [tTier2Terrain,tTier3Terrain]], | [[tMainTerrain,tTier1Terrain],[tTier1Terrain,tTier2Terrain], [tTier2Terrain,tTier3Terrain]], | ||||
Show All 9 Lines | |||||
[avoidClasses(clForest, 0, clHill, 0, clDirt, 3, clPlayer, 12), stayClasses(clLand, 7)], | [avoidClasses(clForest, 0, clHill, 0, clDirt, 3, clPlayer, 12), stayClasses(clLand, 7)], | ||||
scaleByMapSize(15, 45), | scaleByMapSize(15, 45), | ||||
clDirt); | clDirt); | ||||
Engine.SetProgress(55); | Engine.SetProgress(55); | ||||
g_Map.log("Creating stone mines"); | g_Map.log("Creating stone mines"); | ||||
createMines( | createMines( | ||||
[ | [ | ||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], | [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], | ||||
Done Inline ActionsThe last three parameters are the default. The other occurrences in this file omit these. lyv: The last three parameters are the default. The other occurrences in this file omit these. | |||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)] | [new SimpleObject(oStoneSmall, 2,5, 1,3)] | ||||
], | ], | ||||
[avoidClasses(clForest, 1, clPlayer, 7, clRock, 10, clHill, 1), stayClasses(clLand, 6)], | [avoidClasses(clForest, 1, clPlayer, 7, clRock, 10, clHill, 1), stayClasses(clLand, 6)], | ||||
clRock | clRock | ||||
); | ); | ||||
g_Map.log("Creating metal mines"); | g_Map.log("Creating metal mines"); | ||||
createMines( | createMines( | ||||
[ | [ | ||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)] | [new SimpleObject(oMetalLarge, 1,1, 0,4)] | ||||
], | ], | ||||
[avoidClasses(clForest, 1, clPlayer, 7, clMetal, 10, clRock, 5, clHill, 1), stayClasses(clLand, 6)], | [avoidClasses(clForest, 1, clPlayer, 7, clMetal, 10, clRock, 5, clHill, 1), stayClasses(clLand, 6)], | ||||
clMetal | clMetal | ||||
); | ); | ||||
Engine.SetProgress(65); | Engine.SetProgress(65); | ||||
var planetm = currentBiome() == "generic/india" ? 8 : 1; | var planetm = currentBiome() == "generic/india" ? 8 : 1; | ||||
Done Inline Actionswell, not 0 hardcoded names. iirc this is in every script that uses the generic biomes marder: well, not 0 hardcoded names. iirc this is in every script that uses the generic biomes | |||||
createDecoration( | createDecoration( | ||||
[ | [ | ||||
[new SimpleObject(aRockMedium, 1, 3, 0, 1)], | [new SimpleObject(aRockMedium, 1, 3, 0, 1)], | ||||
[new SimpleObject(aRockLarge, 1, 2, 0, 1), new SimpleObject(aRockMedium, 1, 3, 0, 2)], | [new SimpleObject(aRockLarge, 1, 2, 0, 1), new SimpleObject(aRockMedium, 1, 3, 0, 2)], | ||||
[new SimpleObject(aGrassShort, 1, 2, 0, 1)], | [new SimpleObject(aGrassShort, 1, 2, 0, 1)], | ||||
[new SimpleObject(aGrass, 2, 4, 0, 1.8), new SimpleObject(aGrassShort, 3, 6, 1.2, 2.5)], | [new SimpleObject(aGrass, 2, 4, 0, 1.8), new SimpleObject(aGrassShort, 3, 6, 1.2, 2.5)], | ||||
[new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] | [new SimpleObject(aBushMedium, 1, 2, 0, 2), new SimpleObject(aBushSmall, 2, 4, 0, 2)] | ||||
], | ], | ||||
Show All 35 Lines | |||||
createFood( | createFood( | ||||
[ | [ | ||||
[new SimpleObject(oFish, 2, 3, 0, 2)] | [new SimpleObject(oFish, 2, 3, 0, 2)] | ||||
], | ], | ||||
[ | [ | ||||
25 * numPlayers | 25 * numPlayers | ||||
], | ], | ||||
avoidClasses(clLand, 3, clPlayer, 2, clFood, 20), | avoidClasses(clLand, 3, clPlayer, 2, clFood, 20), | ||||
Done Inline Actionsfish constraint^ elexis: fish constraint^ | |||||
Done Inline ActionsThis is a semantical inaccuracy, but it doesn't cause any issues in this particular map. lyv: This is a semantical inaccuracy, but it doesn't cause any issues in this particular map. | |||||
clFood); | clFood); | ||||
Engine.SetProgress(85); | Engine.SetProgress(85); | ||||
createStragglerTrees( | createStragglerTrees( | ||||
[oTree1, oTree2, oTree4, oTree3], | [oTree1, oTree2, oTree4, oTree3], | ||||
[avoidClasses(clForest, 7, clHill, 1, clPlayer, 3, clMetal, 6, clRock, 6), stayClasses(clLand, 7)], | [avoidClasses(clForest, 7, clHill, 1, clPlayer, 3, clMetal, 6, clRock, 6), stayClasses(clLand, 7)], | ||||
clForest, | clForest, | ||||
Show All 12 Lines |
Wildfire Games · Phabricator
Missing semicolon.