Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/rmgen/library.js
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | function randomizePlacerCoordinates(placer, halfMapSize) | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Helper function for randomly placing areas and groups in the given areas. | * Helper function for randomly placing areas and groups in the given areas. | ||||
*/ | */ | ||||
function randomizePlacerCoordinatesFromAreas(placer, areas) | function randomizePlacerCoordinatesFromAreas(placer, areas) | ||||
{ | { | ||||
let i = randInt(areas.length); | let pt = pickRandom(pickRandom(areas).points); | ||||
let pt = areas[i].points[randInt(areas[i].points.length)]; | |||||
placer.x = pt.x; | placer.x = pt.x; | ||||
placer.z = pt.z; | placer.z = pt.z; | ||||
} | } | ||||
/** | /** | ||||
* Attempts to place the given number of areas in random places of the map. | * Attempts to place the given number of areas in random places of the map. | ||||
* Returns actually placed areas. | * Returns actually placed areas. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator