Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/english_channel.js
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | if (z > cu + 0.5 - WATER_WIDTH/2 && | ||||
setHeight(ix, iz, h); | setHeight(ix, iz, h); | ||||
} | } | ||||
else | else | ||||
setHeight(ix, iz, 3.1); | setHeight(ix, iz, 3.1); | ||||
} | } | ||||
RMS.SetProgress(20); | RMS.SetProgress(20); | ||||
log("Creating rivers"); | log("Creating rivers"); | ||||
for (var i = 0; i <= randInt(8, (scaleByMapSize(12,20))); i++) | for (var i = 0; i <= randInt(8, (scaleByMapSize(12,20))); i++) | ||||
elexis: ✓ | |||||
{ | { | ||||
var cLocation = randFloat(0.05,0.95); | var cLocation = randFloat(0.05, 0.95); | ||||
var tang = 2*PI * randFloat(0.2, 0.8) * (randInt(2) - 0.5); | |||||
var cDistance = 0.05 * (tang > 0 ? 1 : -1); | var sign = randBool(0.5) ? 1 : -1; | ||||
Not Done Inline ActionsIndeed better than Math.sign(randFloat(-1, 1)) elexis: Indeed better than Math.sign(randFloat(-1, 1)) | |||||
var tang = sign * PI * randFloat(0.2, 0.8); | |||||
Not Done Inline Actions✓, Looked wrong at first sight, then I noticed that this change I introduced in my branch was actually correct, as randInt(2) returns either 0 or 1 lol, so randInt(2) - 0.5 is either -0.5 or +0.5 elexis: ✓, Looked wrong at first sight, then I noticed that this change I introduced in my branch was… | |||||
var cDistance = sign * 0.05; | |||||
var point = getTIPIADBON([fractionToTiles(cLocation), fractionToTiles(0.5 + cDistance)], [fractionToTiles(cLocation), fractionToTiles(0.5 - cDistance)], [-6, -1.5], 0.5, 4, 0.01); | var point = getTIPIADBON([fractionToTiles(cLocation), fractionToTiles(0.5 + cDistance)], [fractionToTiles(cLocation), fractionToTiles(0.5 - cDistance)], [-6, -1.5], 0.5, 4, 0.01); | ||||
if (point !== undefined) | if (point !== undefined) | ||||
{ | { | ||||
var placer = new PathPlacer(floor(point[0]), floor(point[1]), floor(fractionToTiles(0.5 + 0.49*cos(tang))), floor(fractionToTiles(0.5 + 0.49*sin(tang))), scaleByMapSize(10,20), 0.4, 3*(scaleByMapSize(1,4)), 0.1, 0.05); | var placer = new PathPlacer(floor(point[0]), floor(point[1]), floor(fractionToTiles(0.5 + 0.49*cos(tang))), floor(fractionToTiles(0.5 + 0.49*sin(tang))), scaleByMapSize(10,20), 0.4, 3*(scaleByMapSize(1,4)), 0.1, 0.05); | ||||
var terrainPainter = new LayeredPainter( | var terrainPainter = new LayeredPainter( | ||||
[tShore, tWater, tWater], // terrains | [tShore, tWater, tWater], // terrains | ||||
[1, 3] // widths | [1, 3] // widths | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
✓