mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Remove isNomad from rmgen-common
This removes a usage of the global `g_MapSettings`.
The conversion to bool isn't required.
`mapSettings` (non-global) is available since e01ea16ae5.
This commit is contained in:
parent
aa0c195332
commit
6bb7f3fd39
38 changed files with 82 additions and 87 deletions
|
|
@ -35,7 +35,7 @@ export function* generateMap(mapSettings)
|
|||
undefined),
|
||||
playerbaseTypes[mapSettings.PlayerPlacement].walls);
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
markPlayerAvoidanceArea(playerPosition, defaultPlayerBaseRadius());
|
||||
|
||||
yield 20;
|
||||
|
|
@ -63,7 +63,7 @@ export function* generateMap(mapSettings)
|
|||
]);
|
||||
yield 30;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createBluffsPassages(playerPosition);
|
||||
|
||||
addElements([
|
||||
|
|
@ -224,7 +224,7 @@ export function* generateMap(mapSettings)
|
|||
]));
|
||||
yield 90;
|
||||
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Preventing units to be spawned at the map border");
|
||||
createArea(
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export function* generateMap(mapSettings)
|
|||
]);
|
||||
yield 45;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing players");
|
||||
const [playerIDs, playerPosition] = createBases(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Engine.LoadLibrary("rmgen");
|
|||
Engine.LoadLibrary("rmgen-common");
|
||||
Engine.LoadLibrary("heightmap");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
const tPrimary = ["temp_grass", "temp_grass_b", "temp_grass_c", "temp_grass_d",
|
||||
"temp_grass_long_b", "temp_grass_clovers_2", "temp_grass_mossy", "temp_grass_plants"];
|
||||
|
|
@ -261,7 +261,7 @@ export function* generateMap()
|
|||
|
||||
yield 90;
|
||||
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
placePlayersNomad(g_Map.createTileClass(),
|
||||
new HeightConstraint(lowerHeightLimit, upperHeightLimit));
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Engine.LoadLibrary("rmgen-common");
|
|||
Engine.LoadLibrary("rmbiome");
|
||||
Engine.LoadLibrary("heightmap");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
const tGrove = "temp_grass_plants";
|
||||
const tPath = "road_rome_a";
|
||||
|
|
@ -614,7 +614,7 @@ export function* generateMap()
|
|||
yield 80;
|
||||
|
||||
g_Map.log("Placing players");
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
placePlayersNomad(g_Map.createTileClass(),
|
||||
new HeightConstraint(heighLimits[4], heighLimits[5]));
|
||||
else
|
||||
|
|
@ -628,7 +628,7 @@ export function* generateMap()
|
|||
for (let i = 0; i < resourceSpots.length; ++i)
|
||||
{
|
||||
const pos = new Vector2D(resourceSpots[i].x, resourceSpots[i].y);
|
||||
const choice = i % (isNomad() ? 4 : 5);
|
||||
const choice = i % (mapSettings.Nomad ? 4 : 5);
|
||||
if (choice == 0)
|
||||
placeMine(pos, "gaia/rock/temperate_large_02");
|
||||
if (choice == 1)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export function* generateMap(mapSettings)
|
|||
const clFood = g_Map.createTileClass();
|
||||
const clBaseResource = g_Map.createTileClass();
|
||||
|
||||
const playerHillRadius = defaultPlayerBaseRadius() / (isNomad() ? 1.5 : 1);
|
||||
const playerHillRadius = defaultPlayerBaseRadius() / (mapSettings.Nomad ? 1.5 : 1);
|
||||
|
||||
const [playerIDs, playerPosition, playerAngle] = playerPlacementCircle(fractionToTiles(0.35));
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export function* generateMap(mapSettings)
|
|||
[
|
||||
new TerrainPainter(tMainTerrain),
|
||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 2),
|
||||
new TileClassPainter(j == 1 || isNomad() ? clLand : clPlayer)
|
||||
new TileClassPainter(j == 1 || mapSettings.Nomad ? clLand : clPlayer)
|
||||
]);
|
||||
|
||||
g_Map.log("Creating center area");
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export function* generateMap(mapSettings)
|
|||
"length": 0,
|
||||
"indent": 4,
|
||||
"bend": 0,
|
||||
"templateName": mapSize >= normalMapSize ? (isNomad() ? oSentryTower : oTower) :
|
||||
"templateName": mapSize >= normalMapSize ? (mapSettings.Nomad ? oSentryTower : oTower) :
|
||||
oWatchTower
|
||||
},
|
||||
"pillar": readyWallElement(oPalisadePillar),
|
||||
|
|
@ -734,7 +734,7 @@ export function* generateMap(mapSettings)
|
|||
clFood);
|
||||
|
||||
g_Map.log("Creating violent animals");
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createFood(
|
||||
[
|
||||
[new SimpleObject(oWolf, 1, 3, 0, 4)],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Engine.LoadLibrary("rmgen");
|
||||
Engine.LoadLibrary("rmgen-common");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
TILE_CENTERED_HEIGHT_MAP = true;
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ export function* generateMap()
|
|||
new TerrainPainter(tPrimary),
|
||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 4),
|
||||
new TileClassPainter(clIsland)
|
||||
].concat(isNomad() ? [] : [new TileClassPainter(clPlayerIsland)]));
|
||||
].concat(mapSettings.Nomad ? [] : [new TileClassPainter(clPlayerIsland)]));
|
||||
yield 10;
|
||||
|
||||
g_Map.log("Creating islands");
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ export function* generateMap(mapSettings)
|
|||
50);
|
||||
yield 83;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating lions");
|
||||
createObjectGroups(
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export function* generateMap(mapSettings)
|
|||
undefined);
|
||||
|
||||
g_Map.log("Creating CC mountains");
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
// This one consists of many bumps, creating an omnidirectional ramp
|
||||
|
|
@ -299,7 +299,7 @@ export function* generateMap(mapSettings)
|
|||
100);
|
||||
yield 65;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating towers");
|
||||
createObjectGroupsDeprecated(
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export function* generateMap(mapSettings)
|
|||
const oField = "structures/kush/field";
|
||||
const oPyramid = "structures/kush/pyramid_small";
|
||||
const oPyramidLarge = "structures/kush/pyramid_large";
|
||||
const oKushUnits = isNomad() ?
|
||||
const oKushUnits = mapSettings.Nomad ?
|
||||
"units/kush/support_female_citizen" :
|
||||
"units/kush/infantry_javelineer_merc_e";
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ export function* generateMap(mapSettings)
|
|||
50);
|
||||
|
||||
g_Map.log("Creating lions");
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createObjectGroups(
|
||||
new SimpleGroup([new SimpleObject(oLion, 2, 3, 0, 2)], true, clFood),
|
||||
0,
|
||||
|
|
@ -450,7 +450,7 @@ export function* generateMap(mapSettings)
|
|||
clRiver, 15,
|
||||
clKushiteVillages, 15),
|
||||
clForest,
|
||||
stragglerTrees * (isNomad() ? 3 : 1));
|
||||
stragglerTrees * (mapSettings.Nomad ? 3 : 1));
|
||||
|
||||
createStragglerTrees(
|
||||
[oDatePalm, oSDatePalm],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Engine.LoadLibrary("rmgen");
|
||||
Engine.LoadLibrary("rmgen-common");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
const tGrass = ["temperate_grass_04", "temperate_grass_03", "temperate_grass_04"];
|
||||
const tForestFloor = "temperate_forestfloor_01";
|
||||
|
|
@ -74,7 +74,7 @@ export function* generateMap()
|
|||
const playerAngle = BUILDING_ORIENTATION;
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
break;
|
||||
|
||||
// CC and units
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
yield 20;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
createBases(
|
||||
...playerPlacementByPattern(
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ export function* generateMap(mapSettings)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
break;
|
||||
|
||||
g_Map.log("Finding player locations");
|
||||
|
|
@ -191,7 +191,7 @@ export function* generateMap(mapSettings)
|
|||
}
|
||||
yield 35;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Flattening initial CC area");
|
||||
const playerRadius = defaultPlayerBaseRadius() * 0.8;
|
||||
|
|
@ -246,7 +246,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
break;
|
||||
|
||||
const localBiome = constraintHighlands.allows(playerPosition[i]) ? biomes.highlands :
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ export function* generateMap(mapSettings)
|
|||
if (currentBiome() == "generic/autumn")
|
||||
spineTerrain = g_Terrains.tier4Terrain;
|
||||
|
||||
const spineCount = isNomad() ? randIntInclusive(1, 4) : teamsArray.length;
|
||||
const spineCount = mapSettings.Nomad ? randIntInclusive(1, 4) : teamsArray.length;
|
||||
|
||||
for (let i = 0; i < spineCount; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
for (let i = 0; i < teams.length; ++i)
|
||||
{
|
||||
if (!teams[i] || isNomad())
|
||||
if (!teams[i] || mapSettings.Nomad)
|
||||
continue;
|
||||
|
||||
++teamNo;
|
||||
|
|
@ -212,8 +212,8 @@ export function* generateMap(mapSettings)
|
|||
g_Map.log("Creating big islands");
|
||||
createAreas(
|
||||
new ChainPlacer(
|
||||
Math.floor(scaleByMapSize(4, 8) * (isNomad() ? 2 : 1)),
|
||||
Math.floor(scaleByMapSize(8, 16) * (isNomad() ? 2 : 1)),
|
||||
Math.floor(scaleByMapSize(4, 8) * (mapSettings.Nomad ? 2 : 1)),
|
||||
Math.floor(scaleByMapSize(8, 16) * (mapSettings.Nomad ? 2 : 1)),
|
||||
Math.floor(scaleByMapSize(25, 60)),
|
||||
0.07,
|
||||
undefined,
|
||||
|
|
@ -224,7 +224,7 @@ export function* generateMap(mapSettings)
|
|||
new TileClassPainter(clLand)
|
||||
],
|
||||
avoidClasses(clLand, 3, clPlayer, 3),
|
||||
scaleByMapSize(4, 14) * (isNomad() ? 2 : 1),
|
||||
scaleByMapSize(4, 14) * (mapSettings.Nomad ? 2 : 1),
|
||||
1);
|
||||
|
||||
g_Map.log("Creating small islands");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
const [playerIDs, playerPosition, playerAngle] = playerPlacementCircle(fractionToTiles(0.35));
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating player islands and docks");
|
||||
for (let i = 0; i < numPlayers; i++)
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ export function* generateMap(mapSettings)
|
|||
0.05 * Math.PI,
|
||||
0.55 * Math.PI);
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Marking player positions");
|
||||
for (const position of playerPosition)
|
||||
|
|
@ -1271,7 +1271,7 @@ export function* generateMap(mapSettings)
|
|||
[areaDesert]);
|
||||
}
|
||||
|
||||
for (let i = 0; i < (isNomad() ? scaleByMapSize(6, 16) : scaleByMapSize(0, 8)); ++i)
|
||||
for (let i = 0; i < (mapSettings.Nomad ? scaleByMapSize(6, 16) : scaleByMapSize(0, 8)); ++i)
|
||||
{
|
||||
const mineObjectsBiome = pickRandom(mineObjectsPerBiome);
|
||||
createObjectGroupsByAreas(
|
||||
|
|
@ -1351,7 +1351,7 @@ export function* generateMap(mapSettings)
|
|||
50,
|
||||
[areaDesert]);
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating lions");
|
||||
createObjectGroupsByAreas(
|
||||
|
|
@ -1381,7 +1381,7 @@ export function* generateMap(mapSettings)
|
|||
[areaDesert]);
|
||||
|
||||
g_Map.log("Creating crocodiles");
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createObjectGroupsByAreas(
|
||||
new SimpleGroup([new SimpleObject(oCrocodile, 2, 3, 3, 5)], true, clFood),
|
||||
0,
|
||||
|
|
@ -1467,7 +1467,7 @@ export function* generateMap(mapSettings)
|
|||
avoidCollisions,
|
||||
new NearTileClassConstraint(clPyramid, 10)
|
||||
]);
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing soldiers near pyramids");
|
||||
createObjectGroupsByAreas(
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@ export function* generateMap(mapSettings)
|
|||
new LayeredPainter([tWater, tShore, tMainTerrain], [1, 4]),
|
||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 4),
|
||||
new TileClassPainter(clIsland),
|
||||
new TileClassPainter(isNomad() ? clLand : clPlayer)
|
||||
new TileClassPainter(mapSettings.Nomad ? clLand : clPlayer)
|
||||
]);
|
||||
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
continue;
|
||||
|
||||
const dockLocation =
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
// Den
|
||||
createArea(
|
||||
new ClumpPlacer(diskArea(fractionToTiles(0.1)) / (isNomad() ? 2 : 1), 0.9, 0.3,
|
||||
new ClumpPlacer(diskArea(fractionToTiles(0.1)) / (mapSettings.Nomad ? 2 : 1), 0.9, 0.3,
|
||||
Infinity, playerPosition),
|
||||
[
|
||||
new LayeredPainter([g_Terrains.cliff, base], [3]),
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
let playerIDs = [];
|
||||
let playerPosition = [];
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Finding player locations");
|
||||
[playerIDs, playerPosition] = playerPlacementRandom(sortAllPlayers(),
|
||||
|
|
@ -386,7 +386,7 @@ export function* generateMap(mapSettings)
|
|||
50);
|
||||
yield 80;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating lions");
|
||||
createObjectGroups(
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export function* generateMap(mapSettings)
|
|||
]);
|
||||
yield 45;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing players");
|
||||
const [playerIDs, playerPosition] = createBases(
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ export function* generateMap(mapSettings)
|
|||
}
|
||||
yield 45;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Finding player positions");
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ export function* generateMap(mapSettings)
|
|||
new LayeredPainter([tWater, tShore, tMainTerrain], [1, 4]),
|
||||
new SmoothElevationPainter(ELEVATION_SET, heightLand, 4),
|
||||
new TileClassPainter(clIsland),
|
||||
new TileClassPainter(isNomad() ? clLand : clPlayer)
|
||||
new TileClassPainter(mapSettings.Nomad ? clLand : clPlayer)
|
||||
]);
|
||||
}
|
||||
yield 10;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export function* generateMap(mapSettings)
|
|||
randomAngle(),
|
||||
undefined);
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
createArea(
|
||||
new ClumpPlacer(diskArea(defaultPlayerBaseRadius()), 0.9, 0.5, Infinity,
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export function* generateMap(mapSettings)
|
|||
new SlopeConstraint(2, Infinity));
|
||||
yield 55;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing players");
|
||||
const [playerIDs, playerPosition] = createBases(
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ export function* generateMap(mapSettings)
|
|||
|
||||
const treasures = [{
|
||||
"template": oWoodTreasure,
|
||||
"count": isNomad() ? 16 : 14
|
||||
"count": mapSettings.Nomad ? 16 : 14
|
||||
}];
|
||||
|
||||
g_Map.log("Creating player markets");
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
const marketPos =
|
||||
|
|
@ -188,7 +188,7 @@ export function* generateMap(mapSettings)
|
|||
createFood(
|
||||
[
|
||||
[new SimpleObject(oArcticFox, 1, 2, 0, 3)],
|
||||
[new SimpleObject(isNomad() ? oArcticFox : oArcticWolf, 4, 6, 0, 4)],
|
||||
[new SimpleObject(mapSettings.Nomad ? oArcticFox : oArcticWolf, 4, 6, 0, 4)],
|
||||
[new SimpleObject(oWalrus, 2, 3, 0, 2)],
|
||||
[new SimpleObject(oMuskox, 2, 3, 0, 2)]
|
||||
],
|
||||
|
|
@ -246,7 +246,7 @@ export function* generateMap(mapSettings)
|
|||
setSunElevation(Math.PI * randFloat(1/9, 1/7));
|
||||
}
|
||||
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
{
|
||||
const constraint = avoidClasses(clWater, 4, clMetal, 4, clRock, 4, clHill, 4, clFood, 2);
|
||||
[playerIDs, playerPosition] = placePlayersNomad(clPlayer, constraint);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export function* generateMap(mapSettings)
|
|||
[areaVesuv]);
|
||||
yield 48;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing players");
|
||||
const [playerIDs, playerPosition] = createBases(
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export function* generateMap(mapSettings)
|
|||
]);
|
||||
yield 45;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Placing players");
|
||||
const [playerIDs, playerPosition] = createBases(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Engine.LoadLibrary("rmgen");
|
||||
Engine.LoadLibrary("rmgen-common");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
const tGrass = [
|
||||
"tropic_grass_c",
|
||||
|
|
@ -194,7 +194,7 @@ export function* generateMap()
|
|||
|
||||
yield 40;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Creating gaia");
|
||||
for (let i = 0; i < 2; ++i)
|
||||
|
|
|
|||
|
|
@ -120,12 +120,12 @@ export function* generateMap(mapSettings)
|
|||
]);
|
||||
|
||||
g_Map.log("Creating rivers between opponents");
|
||||
const numRivers = isNomad() ? randIntInclusive(4, 8) : numPlayers;
|
||||
const numRivers = mapSettings.Nomad ? randIntInclusive(4, 8) : numPlayers;
|
||||
const rivers = distributePointsOnCircle(numRivers, startAngle + Math.PI / numRivers,
|
||||
fractionToTiles(0.5), mapCenter)[0];
|
||||
for (let i = 0; i < numRivers; ++i)
|
||||
{
|
||||
if (isNomad() ? randBool() : areAllies(playerIDs[i], playerIDs[(i + 1) % numPlayers]))
|
||||
if (mapSettings.Nomad ? randBool() : areAllies(playerIDs[i], playerIDs[(i + 1) % numPlayers]))
|
||||
continue;
|
||||
|
||||
const shallowLocation = randFloat(0.2, 0.7);
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ var g_PlayerBaseFunctions = [
|
|||
"Decoratives"
|
||||
];
|
||||
|
||||
function isNomad()
|
||||
{
|
||||
return !!g_MapSettings.Nomad;
|
||||
}
|
||||
|
||||
function getNumPlayers()
|
||||
{
|
||||
return g_MapSettings.PlayerData.length - 1;
|
||||
|
|
@ -153,7 +148,7 @@ function placePlayerBases(playerBaseArgs)
|
|||
*/
|
||||
function placePlayerBase(playerBaseArgs)
|
||||
{
|
||||
if (isNomad())
|
||||
if (g_MapSettings.Nomad)
|
||||
return;
|
||||
|
||||
placeCivDefaultStartingEntities(
|
||||
|
|
@ -459,7 +454,7 @@ function placePlayerBaseDecoratives(args)
|
|||
|
||||
function placePlayersNomad(playerClass, constraints)
|
||||
{
|
||||
if (!isNomad())
|
||||
if (!g_MapSettings.Nomad)
|
||||
return undefined;
|
||||
|
||||
g_Map.log("Placing nomad starting units");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Engine.LoadLibrary("rmgen");
|
||||
Engine.LoadLibrary("rmgen-common");
|
||||
|
||||
export function* generateMap()
|
||||
export function* generateMap(mapSettings)
|
||||
{
|
||||
const tMainTerrain = "alpine_snow_a";
|
||||
const tTier1Terrain = "snow rough";
|
||||
|
|
@ -80,7 +80,7 @@ export function* generateMap()
|
|||
|
||||
const [playerIDs, playerPosition] = playerPlacementRiver(startAngle, fractionToTiles(0.6));
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
for (const position of playerPosition)
|
||||
addCivicCenterAreaToClass(position, clPlayer);
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ export function* generateMap(mapSettings)
|
|||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
islandPos[i] = playerPosition[i];
|
||||
createIsland(i, 1, isNomad() ? clLand : clPlayer);
|
||||
createIsland(i, 1, mapSettings.Nomad ? clLand : clPlayer);
|
||||
}
|
||||
|
||||
g_Map.log("Creating connectors");
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ export function* generateMap(mapSettings)
|
|||
}
|
||||
]));
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createBluffsPassages(playerPosition);
|
||||
|
||||
yield 60;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export function* generateMap(mapSettings)
|
|||
g_Map.log("Creating big grass patches around the playerbases");
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
{
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
createArea(
|
||||
new ClumpPlacer(diskArea(defaultPlayerBaseRadius()), 0.9, 0.5, Infinity,
|
||||
playerPosition[i]),
|
||||
|
|
@ -73,7 +73,7 @@ export function* generateMap(mapSettings)
|
|||
new ChainPlacer(
|
||||
2,
|
||||
Math.floor(scaleByMapSize(5, 12)),
|
||||
Math.floor(scaleByMapSize(25, 60)) / (isNomad() ? 2 : 1),
|
||||
Math.floor(scaleByMapSize(25, 60)) / (mapSettings.Nomad ? 2 : 1),
|
||||
Infinity,
|
||||
playerPosition[i],
|
||||
0,
|
||||
|
|
@ -277,7 +277,7 @@ export function* generateMap(mapSettings)
|
|||
stayClasses(clGrass, 3)
|
||||
],
|
||||
clForest,
|
||||
stragglerTrees * (isNomad() ? 3 : 1));
|
||||
stragglerTrees * (mapSettings.Nomad ? 3 : 1));
|
||||
|
||||
placePlayersNomad(clPlayer, avoidClasses(clForest, 1, clMetal, 4, clRock, 4, clHill, 4, clFood, 2));
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ export function* generateMap(mapSettings)
|
|||
}
|
||||
});
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition] =
|
||||
playerPlacementRiver(startAngle + Math.PI / 2, fractionToTiles(0.6));
|
||||
|
|
@ -178,7 +178,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
const startAngle = randomAngle();
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition] =
|
||||
playerPlacementRiver(startAngle + Math.PI / 2, fractionToTiles(0.5));
|
||||
|
|
@ -242,7 +242,7 @@ export function* generateMap(mapSettings)
|
|||
g_StartingTreasures = true;
|
||||
|
||||
const [pIDs, islandPosition] = playerPlacementCircle(fractionToTiles(0.35));
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition] = [pIDs, islandPosition];
|
||||
markPlayerArea("large");
|
||||
|
|
@ -255,7 +255,7 @@ export function* generateMap(mapSettings)
|
|||
new ClumpPlacer(islandSize, 0.8, 0.1, Infinity, islandPosition[i]),
|
||||
landElevationPainter);
|
||||
|
||||
switch (randIntInclusive(1, isNomad() ? 2 : 3))
|
||||
switch (randIntInclusive(1, mapSettings.Nomad ? 2 : 3))
|
||||
{
|
||||
case 1:
|
||||
g_Map.log("Creating archipelago");
|
||||
|
|
@ -319,7 +319,7 @@ export function* generateMap(mapSettings)
|
|||
"Continent": () => {
|
||||
const waterHeight = -5;
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Ensuring player area");
|
||||
[playerIDs, playerPosition] = playerPlacementCircle(fractionToTiles(0.25));
|
||||
|
|
@ -392,7 +392,7 @@ export function* generateMap(mapSettings)
|
|||
new ElevationPainter(heightLand));
|
||||
|
||||
let startAngle;
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
let playerAngle;
|
||||
[playerIDs, playerPosition, playerAngle, startAngle] =
|
||||
|
|
@ -475,7 +475,7 @@ export function* generateMap(mapSettings)
|
|||
new ElevationPainter(heightLand));
|
||||
|
||||
const startAngle = randomAngle();
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
playerIDs = sortAllPlayers();
|
||||
playerPosition =
|
||||
|
|
@ -516,7 +516,7 @@ export function* generateMap(mapSettings)
|
|||
new ElevationPainter(heightLand));
|
||||
|
||||
const startAngle = randomAngle();
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
g_Map.log("Determining player locations");
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ export function* generateMap(mapSettings)
|
|||
new MapBoundsPlacer(),
|
||||
new ElevationPainter(heightLand));
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition] = playerPlacementCircle(fractionToTiles(0.35));
|
||||
markPlayerArea("large");
|
||||
|
|
@ -589,7 +589,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
let playerAngle;
|
||||
let startAngle;
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition, playerAngle, startAngle] =
|
||||
playerPlacementCircle(fractionToTiles(0.35));
|
||||
|
|
@ -688,7 +688,7 @@ export function* generateMap(mapSettings)
|
|||
|
||||
let playerAngle;
|
||||
let startAngle;
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition, playerAngle, startAngle] =
|
||||
playerPlacementCircle(fractionToTiles(0.35));
|
||||
|
|
@ -745,7 +745,7 @@ export function* generateMap(mapSettings)
|
|||
new MapBoundsPlacer(),
|
||||
new ElevationPainter(3));
|
||||
|
||||
if (!isNomad())
|
||||
if (!mapSettings.Nomad)
|
||||
{
|
||||
[playerIDs, playerPosition] = playerPlacementCircle(fractionToTiles(0.35));
|
||||
markPlayerArea("small");
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ export function* generateMap(mapSettings)
|
|||
yield 55;
|
||||
|
||||
g_Map.log("Placing players");
|
||||
if (isNomad())
|
||||
if (mapSettings.Nomad)
|
||||
placePlayersNomad(
|
||||
g_Map.createTileClass(),
|
||||
[
|
||||
|
|
@ -648,12 +648,12 @@ export function* generateMap(mapSettings)
|
|||
placeStartLocationResources(playerPosition[p]);
|
||||
}
|
||||
|
||||
let mercenaryCamps = isNomad() ? 0 : Math.ceil(g_Map.size / 256);
|
||||
let mercenaryCamps = mapSettings.Nomad ? 0 : Math.ceil(g_Map.size / 256);
|
||||
g_Map.log("Placing at most " + mercenaryCamps + " mercenary camps");
|
||||
for (let i = 0; i < resourceSpots.length; ++i)
|
||||
{
|
||||
let radius;
|
||||
const choice = i % (isNomad() ? 4 : 5);
|
||||
const choice = i % (mapSettings.Nomad ? 4 : 5);
|
||||
if (choice == 0)
|
||||
placeMine(resourceSpots[i], g_Gaia.stoneLarge);
|
||||
if (choice == 1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue