Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/unknown_nomad.js
Show First 20 Lines • Show All 1,286 Lines • ▼ Show 20 Lines | for (var mx = 0; mx < mapSize; ++mx) | ||||
if (g_Map.getHeight(mx, mz) >= 3 && g_Map.getHeight(mx, mz) <= 3.12) | if (g_Map.getHeight(mx, mz) >= 3 && g_Map.getHeight(mx, mz) <= 3.12) | ||||
placableArea.push([mx, mz]); | placableArea.push([mx, mz]); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (!placableArea.length) | if (!placableArea.length) | ||||
{ | |||||
for (var mx = 0; mx < mapSize; ++mx) | for (var mx = 0; mx < mapSize; ++mx) | ||||
for (var mz = 0; mz < mapSize; ++mz) | for (var mz = 0; mz < mapSize; ++mz) | ||||
if (g_Map.getHeight(mx, mz) >= 3 && g_Map.getHeight(mx, mz) <= 3.12) | if (g_Map.getHeight(mx, mz) >= 3 && g_Map.getHeight(mx, mz) <= 3.12) | ||||
placableArea.push([mx, mz]); | placableArea.push([mx, mz]); | ||||
} | |||||
var chosen = floor(Math.random()*placableArea.length); | |||||
playerX[i] = placableArea[chosen][0]; | |||||
playerZ[i] = placableArea[chosen][1]; | |||||
} | |||||
[playerX[i], playerZ[i]] = pickRandom(placableArea); | |||||
} | |||||
for (var i = 0; i < numPlayers; ++i) | for (var i = 0; i < numPlayers; ++i) | ||||
elexis: As discussed in irc, [playerX[i], playerZ[i]] = pickRandom(placableArea);
Verify by starting… | |||||
{ | { | ||||
var id = playerIDs[i]; | var id = playerIDs[i]; | ||||
log("Creating units for player " + id + "..."); | log("Creating units for player " + id + "..."); | ||||
// get the x and z in tiles | // get the x and z in tiles | ||||
var ix = playerX[i]; | var ix = playerX[i]; | ||||
var iz = playerZ[i]; | var iz = playerZ[i]; | ||||
var civEntities = getStartingEntities(id-1); | var civEntities = getStartingEntities(id-1); | ||||
▲ Show 20 Lines • Show All 356 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
As discussed in irc, [playerX[i], playerZ[i]] = pickRandom(placableArea);
Verify by starting unknown nomad