Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/oasis.js
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | |||||
fz = fractionToTiles(0.5); | fz = fractionToTiles(0.5); | ||||
ix = round(fx); | ix = round(fx); | ||||
iz = round(fz); | iz = round(fz); | ||||
placer = new ClumpPlacer(size*1.1, 0.8, 0.2, 10, ix, iz); | placer = new ClumpPlacer(size*1.1, 0.8, 0.2, 10, ix, iz); | ||||
terrainPainter = new LayeredPainter( [pOasisForestLight,tShoreBlend, tWater, tWater, tWater], [scaleByMapSize(6,20),3, 5, 2] ); | terrainPainter = new LayeredPainter( [pOasisForestLight,tShoreBlend, tWater, tWater, tWater], [scaleByMapSize(6,20),3, 5, 2] ); | ||||
var elevationPainter = new SmoothElevationPainter(ELEVATION_SET, -3, 15 ); | var elevationPainter = new SmoothElevationPainter(ELEVATION_SET, -3, 15 ); | ||||
createArea(placer, [terrainPainter, elevationPainter, paintClass(clWater)], null); | createArea(placer, [terrainPainter, elevationPainter, paintClass(clWater)], null); | ||||
RMS.SetProgress(50); | RMS.SetProgress(50); | ||||
if(mapSize > 150 && randInt(0,1)) { | if (mapSize > 150 && randBool()) | ||||
{ | |||||
log ("creating path through"); | log ("creating path through"); | ||||
var pAngle = randFloat(0, TWO_PI); | var pAngle = randFloat(0, TWO_PI); | ||||
var px = round(fx) + round(fractionToTiles(0.13 * cos(pAngle))); | var px = round(fx) + round(fractionToTiles(0.13 * cos(pAngle))); | ||||
var py = round(fz) + round(fractionToTiles(0.13 * sin(pAngle))); | var py = round(fz) + round(fractionToTiles(0.13 * sin(pAngle))); | ||||
var pex = round(fx) + round(fractionToTiles(0.13 * -cos(pAngle))); | var pex = round(fx) + round(fractionToTiles(0.13 * -cos(pAngle))); | ||||
var pey = round(fz) + round(fractionToTiles(0.13 * sin(pAngle + PI))); | var pey = round(fz) + round(fractionToTiles(0.13 * sin(pAngle + PI))); | ||||
var path = new PathPlacer(px,py,pex,pey,scaleByMapSize(7,18), 0.4, 1, 0.2, 0); | var path = new PathPlacer(px,py,pex,pey,scaleByMapSize(7,18), 0.4, 1, 0.2, 0); | ||||
terrainPainter = new TerrainPainter(tSand); | terrainPainter = new TerrainPainter(tSand); | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
); | ); | ||||
log ("Creating Sand blows and beautifications"); | log ("Creating Sand blows and beautifications"); | ||||
for (var sandx = 0; sandx < mapSize; sandx += 4) | for (var sandx = 0; sandx < mapSize; sandx += 4) | ||||
{ | { | ||||
for (var sandz = 0; sandz < mapSize; sandz += 4) | for (var sandz = 0; sandz < mapSize; sandz += 4) | ||||
{ | { | ||||
if (getHeight(sandx,sandz) > 3.4) | if (getHeight(sandx,sandz) > 3.4) | ||||
{ | { | ||||
if (Math.random()* 1.4 < getHeight(sandx,sandz) - 3.4) | if (randBool((getHeight(sandx,sandz) - 3.4) / 1.4)) | ||||
{ | { | ||||
group = new SimpleGroup( [new SimpleObject(aSand, 0,1, 0,2)], true, undefined, sandx,sandz ); | group = new SimpleGroup( [new SimpleObject(aSand, 0,1, 0,2)], true, undefined, sandx,sandz ); | ||||
createObjectGroup(group, 0); | createObjectGroup(group, 0); | ||||
} | } | ||||
} else if (getHeight(sandx,sandz) > -2.5 && getHeight(sandx,sandz) < -1.0) | } else if (getHeight(sandx,sandz) > -2.5 && getHeight(sandx,sandz) < -1.0) | ||||
{ | { | ||||
if (Math.random() < 0.4) | if (randBool(0.4)) | ||||
{ | { | ||||
group = new SimpleGroup( [new SimpleObject(aWaterFlower, 1,4, 1,2)], true, undefined, sandx,sandz ); | group = new SimpleGroup( [new SimpleObject(aWaterFlower, 1,4, 1,2)], true, undefined, sandx,sandz ); | ||||
createObjectGroup(group, 0); | createObjectGroup(group, 0); | ||||
} else if (Math.random() > 0.3 && getHeight(sandx,sandz) < -1.9) | } | ||||
else if (randBool(0.7) && getHeight(sandx,sandz) < -1.9) | |||||
{ | { | ||||
group = new SimpleGroup( [new SimpleObject(aReedsA, 5,12, 0,2),new SimpleObject(aReedsB, 5,12, 0,2)], true, undefined, sandx,sandz ); | group = new SimpleGroup( [new SimpleObject(aReedsA, 5,12, 0,2),new SimpleObject(aReedsB, 5,12, 0,2)], true, undefined, sandx,sandz ); | ||||
createObjectGroup(group, 0); | createObjectGroup(group, 0); | ||||
} | } | ||||
if (getTileClass(clPassage).countInRadius(sandx,sandz,2,true) > 0) { | if (getTileClass(clPassage).countInRadius(sandx,sandz,2,true) > 0) { | ||||
if (Math.random() < 0.4) | if (randBool(0.4)) | ||||
{ | { | ||||
group = new SimpleGroup( [new SimpleObject(aWaterFlower, 1,4, 1,2)], true, undefined, sandx,sandz ); | group = new SimpleGroup( [new SimpleObject(aWaterFlower, 1,4, 1,2)], true, undefined, sandx,sandz ); | ||||
createObjectGroup(group, 0); | createObjectGroup(group, 0); | ||||
} else if (Math.random() > 0.3 && getHeight(sandx,sandz) < -1.9) | } | ||||
else if (randBool(0.7) && getHeight(sandx,sandz) < -1.9) | |||||
{ | { | ||||
group = new SimpleGroup( [new SimpleObject(aReedsA, 5,12, 0,2),new SimpleObject(aReedsB, 5,12, 0,2)], true, undefined, sandx,sandz ); | group = new SimpleGroup( [new SimpleObject(aReedsA, 5,12, 0,2),new SimpleObject(aReedsB, 5,12, 0,2)], true, undefined, sandx,sandz ); | ||||
createObjectGroup(group, 0); | createObjectGroup(group, 0); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Show All 16 Lines |
Wildfire Games · Phabricator