Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/rmgen/misc.js
Show First 20 Lines • Show All 798 Lines • ▼ Show 20 Lines | for (var ix = sx; ix <= lx; ++ix) | ||||
placeTerrain(ix, iz, terrain); | placeTerrain(ix, iz, terrain); | ||||
if (tileclass !== undefined) | if (tileclass !== undefined) | ||||
addToClass(ix, iz, tileclass); | addToClass(ix, iz, tileclass); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | |||||
* @param {number} x - horizontal coordinate | |||||
* @param {number} z - other horizontal coordinate | |||||
* @param {number} tileClass - which class to paint | |||||
* @param {number} elevationType - Elevation painter type, ELEVATION_SET = absolute or ELEVATION_MODIFY = relative | |||||
bb: periods and caps
also `fx` and `fz` | |||||
*/ | |||||
function createVolcano(fx = 0.5, fz = 0.5, tileClass = clHill, terrainTexture = tCliff, elevationType = ELEVATION_SET, smoke = true) | |||||
{ | |||||
log("Creating volcano"); | |||||
let ix = Math.round(fractionToTiles(fx)); | |||||
let iz = Math.round(fractionToTiles(fz)); | |||||
let baseSize = mapArea / scaleByMapSize(1, 8); | |||||
let coherence = 0.7; | |||||
let smoothness = 0.05; | |||||
let failFraction = 100; | |||||
let steepness = 3; | |||||
let clLast = createTileClass(); | |||||
let layerSizes = [ | |||||
{ | |||||
"clumps": 0.067, | |||||
"elevation": 15, | |||||
"tileClass": tileClass | |||||
}, | |||||
{ | |||||
"clumps": 0.05, | |||||
"elevation": 25, | |||||
"tileClass": createTileClass() | |||||
}, | |||||
{ | |||||
"clumps": 0.02, | |||||
"elevation": 45, | |||||
"tileClass": createTileClass() | |||||
}, | |||||
{ | |||||
"clumps": 0.011, | |||||
"elevation": 62, | |||||
"tileClass": clLast | |||||
} | |||||
]; | |||||
for (let i = 0; i < layerSizes.length; ++i) | |||||
bbUnsubmitted Done Inline Actionsfor ... of indeed bad since i-1 used bb: for ... of indeed bad since i-1 used | |||||
createArea( | |||||
new ClumpPlacer(baseSize * layerSizes[i].clumps, coherence, smoothness, failFraction, ix, iz), | |||||
[ | |||||
new LayeredPainter([terrainTexture, terrainTexture], [3]), | |||||
bbUnsubmitted Done Inline Actions3 == steepness? (dunno) bb: 3 == steepness? (dunno) | |||||
elexisAuthorUnsubmitted Not Done Inline ActionsThat's the distance between those 2 textures. If this is used for painting dirt patches, we can increase the size of the dirt patches this way f.e. elexis: That's the distance between those 2 textures. If this is used for painting dirt patches, we can… | |||||
new SmoothElevationPainter(elevationType, layerSizes[i].elevation, steepness), | |||||
paintClass(layerSizes[i].tileClass) | |||||
], | |||||
i == 0 ? null : stayClasses(layerSizes[i - 1].tileClass, 1)); | |||||
// lava | |||||
createArea( | |||||
new ClumpPlacer(baseSize * 0.003, coherence, smoothness, failFraction, ix, iz), | |||||
[ | |||||
new LayeredPainter([terrainTexture, tLava1, tLava2, tLava3], [1, 1, 1]), | |||||
new SmoothElevationPainter(elevationType, 42, 1), | |||||
paintClass(clLast) | |||||
], | |||||
stayClasses(clLast, 1)); | |||||
if (!smoke) | |||||
return; | |||||
let num = Math.floor(baseSize * 0.002); | |||||
createObjectGroup( | |||||
new SimpleGroup( | |||||
[new SimpleObject("actor|particle/smoke.xml", num, num, 0, 7)], | |||||
false, createTileClass(), Math.round(fx), Math.round(fz) | |||||
bbUnsubmitted Done Inline Actionsfx != fractionToTiles(fx) so not the same. (we don't want duplicate fractionToTiles execution so it requires new variable guess) bb: fx != fractionToTiles(fx) so not the same. (we don't want duplicate fractionToTiles execution… | |||||
elexisAuthorUnsubmitted Not Done Inline Actionsix, iz, done. elexis: ix, iz, done. | |||||
), | |||||
0, | |||||
stayClasses(tileClass, 1)); | |||||
bbUnsubmitted Done Inline Actionsshouldn't that be clLast? bb: shouldn't that be clLast? | |||||
elexisAuthorUnsubmitted Not Done Inline ActionsThe idea is that the smoke is only placed onto the lava-area, so creating clLava to make it more obvious. elexis: The idea is that the smoke is only placed onto the lava-area, so creating `clLava` to make it… | |||||
} |
Wildfire Games · Phabricator
periods and caps
also fx and fz