Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/canyon.js
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
placer = new ClumpPlacer(150, 0.6, 0.3, 10, fractionToTiles(0.5), fractionToTiles(0.5)); | placer = new ClumpPlacer(150, 0.6, 0.3, 10, fractionToTiles(0.5), fractionToTiles(0.5)); | ||||
var painter = new LayeredPainter([tRoad, tRoad], [1]); | var painter = new LayeredPainter([tRoad, tRoad], [1]); | ||||
createArea(placer, [painter, paintClass(clHill)], null); | createArea(placer, [painter, paintClass(clHill)], null); | ||||
for (var i = 0; i < scaleByMapSize(9,16); i++) | for (var i = 0; i < scaleByMapSize(9,16); i++) | ||||
{ | { | ||||
var ix = randInt(1, mapSize - 1); | var placer = new PathPlacer( | ||||
var iz = randInt(1, mapSize - 1); | randIntExclusive(1, mapSize), | ||||
var ix2 = randInt(1, mapSize - 1); | randIntExclusive(1, mapSize), | ||||
var iz2 = randInt(1, mapSize - 1); | randIntExclusive(1, mapSize), | ||||
var placer = new PathPlacer(ix, iz, ix2, iz2, scaleByMapSize(11,16), 0.4, 3*(scaleByMapSize(1,4)), 0.1, 0); | randIntExclusive(1, mapSize), | ||||
scaleByMapSize(11,16), | |||||
0.4, | |||||
3 * scaleByMapSize(1,4), | |||||
0.1, | |||||
0); | |||||
var terrainPainter = new LayeredPainter( | var terrainPainter = new LayeredPainter( | ||||
[tMainTerrain, tMainTerrain], // terrains | [tMainTerrain, tMainTerrain], // terrains | ||||
[3] // widths | [3] // widths | ||||
); | ); | ||||
var elevationPainter = new SmoothElevationPainter( | var elevationPainter = new SmoothElevationPainter( | ||||
ELEVATION_SET, // type | ELEVATION_SET, // type | ||||
30, // elevation | 30, // elevation | ||||
3 // blend radius | 3 // blend radius | ||||
); | ); | ||||
createArea(placer, [terrainPainter, elevationPainter, paintClass(clHill2)], avoidClasses(clPlayer, 6, clHill2, 3, clHill, 2)); | createArea(placer, [terrainPainter, elevationPainter, paintClass(clHill2)], avoidClasses(clPlayer, 6, clHill2, 3, clHill, 2)); | ||||
} | } | ||||
for (var g = 0; g < scaleByMapSize(5,30); g++) | for (var g = 0; g < scaleByMapSize(5,30); g++) | ||||
{ | { | ||||
var tx = randInt(1, mapSize - 1); | var tx = randIntInclusive(1, mapSize - 1); | ||||
var tz = randInt(1, mapSize - 1); | var tz = randIntInclusive(1, mapSize - 1); | ||||
placer = new ClumpPlacer(mapArea * 0.01 * lSize, 0.7, 0.1, 10, tx, tz); | placer = new ClumpPlacer(mapArea * 0.01 * lSize, 0.7, 0.1, 10, tx, tz); | ||||
terrainPainter = new LayeredPainter( | terrainPainter = new LayeredPainter( | ||||
[tMainTerrain, tMainTerrain], // terrains | [tMainTerrain, tMainTerrain], // terrains | ||||
[3] // widths | [3] // widths | ||||
); | ); | ||||
elevationPainter = new SmoothElevationPainter( | elevationPainter = new SmoothElevationPainter( | ||||
ELEVATION_SET, // type | ELEVATION_SET, // type | ||||
▲ Show 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | |||||
log("Creating straggler trees..."); | log("Creating straggler trees..."); | ||||
var types = [oTree1, oTree2, oTree4, oTree3]; // some variation | var types = [oTree1, oTree2, oTree4, oTree3]; // some variation | ||||
createStragglerTrees(types, [avoidClasses(clForest, 1, clHill, 1, clPlayer, 9, clMetal, 6, clRock, 6, clHill2, 1), stayClasses(clLand, 3)]); | createStragglerTrees(types, [avoidClasses(clForest, 1, clHill, 1, clPlayer, 9, clMetal, 6, clRock, 6, clHill2, 1), stayClasses(clLand, 3)]); | ||||
// create treasures | // create treasures | ||||
var fx = fractionToTiles(0.5); | var fx = fractionToTiles(0.5); | ||||
var fz = fractionToTiles(0.5); | var fz = fractionToTiles(0.5); | ||||
for (var i = 0; i < randInt(3,8); i++) | for (let i = 0; i < randIntInclusive(3, 8); ++i) | ||||
placeObject(fx+randFloat(-7,7), fz+randFloat(-7,7), oWood, 0, randFloat(0, TWO_PI)); | placeObject(fx + randFloat(-7, 7), fz + randFloat(-7, 7), oWood, 0, randFloat(0, 2 * PI)); | ||||
for (var i = 0; i < randInt(3,8); i++) | for (let i = 0; i < randIntInclusive(3, 8); ++i) | ||||
placeObject(fx+randFloat(-7,7), fz+randFloat(-7,7), oFood, 0, randFloat(0, TWO_PI)); | placeObject(fx + randFloat(-7, 7), fz + randFloat(-7, 7), oFood, 0, randFloat(0, 2 * PI)); | ||||
// Export map data | // Export map data | ||||
ExportMap(); | ExportMap(); |
Wildfire Games · Phabricator