Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/rmgen2/setup.js
Show First 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | |||||
* @param groupedDistance - distance between neighboring players. | * @param groupedDistance - distance between neighboring players. | ||||
* @param func - A function called for every player base or stronghold placed. | * @param func - A function called for every player base or stronghold placed. | ||||
*/ | */ | ||||
function randomPlayerPlacementAt(singleBases, strongholdBases, heightmapScale, groupedDistance, func) | function randomPlayerPlacementAt(singleBases, strongholdBases, heightmapScale, groupedDistance, func) | ||||
{ | { | ||||
let strongholdBasesRandom = shuffleArray(strongholdBases); | let strongholdBasesRandom = shuffleArray(strongholdBases); | ||||
let singleBasesRandom = shuffleArray(singleBases); | let singleBasesRandom = shuffleArray(singleBases); | ||||
if (randInt(2) == 1 && | if (randBool() && | ||||
g_MapInfo.mapSize >= 256 && | g_MapInfo.mapSize >= 256 && | ||||
g_MapInfo.teams.length >= 2 && | g_MapInfo.teams.length >= 2 && | ||||
g_MapInfo.teams.length < g_MapInfo.numPlayers && | g_MapInfo.teams.length < g_MapInfo.numPlayers && | ||||
g_MapInfo.teams.length <= strongholdBasesRandom.length) | g_MapInfo.teams.length <= strongholdBasesRandom.length) | ||||
{ | { | ||||
for (let t = 0; t < g_MapInfo.teams.length; ++t) | for (let t = 0; t < g_MapInfo.teams.length; ++t) | ||||
{ | { | ||||
let tileX = Math.floor(strongholdBasesRandom[t][0] / heightmapScale); | let tileX = Math.floor(strongholdBasesRandom[t][0] / heightmapScale); | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator