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 128 Lines • ▼ Show 20 Lines | if (!!g_MapSettings.CircularMap) | ||||
let r = halfMapSize * Math.sqrt(randFloat()); // uniform distribution | let r = halfMapSize * Math.sqrt(randFloat()); // uniform distribution | ||||
let theta = randFloat(0, 2 * PI); | let theta = randFloat(0, 2 * PI); | ||||
placer.x = Math.floor(r * Math.cos(theta)) + halfMapSize; | placer.x = Math.floor(r * Math.cos(theta)) + halfMapSize; | ||||
placer.z = Math.floor(r * Math.sin(theta)) + halfMapSize; | placer.z = Math.floor(r * Math.sin(theta)) + halfMapSize; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
// Rectangular coordinates | // Rectangular coordinates | ||||
placer.x = randInt(g_Map.size); | placer.x = randIntExclusive(0, g_Map.size); | ||||
placer.z = randInt(g_Map.size); | placer.z = randIntExclusive(0, g_Map.size); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 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) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator