Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/rmgen/randombiome.js
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Randomizes environment, optionally excluding some biome IDs. | * Randomizes environment, optionally excluding some biome IDs. | ||||
*/ | */ | ||||
function randomizeBiome(avoid = []) | function randomizeBiome(avoid = []) | ||||
{ | { | ||||
let biomeIndex; | let biomeIndex; | ||||
do | do | ||||
biomeIndex = randInt(1, 8); | biomeIndex = randIntInclusive(1, 8); | ||||
while (avoid.indexOf(biomeIndex) != -1); | while (avoid.indexOf(biomeIndex) != -1); | ||||
setBiome(biomeIndex); | setBiome(biomeIndex); | ||||
return biomeIndex; | return biomeIndex; | ||||
} | } | ||||
function setBiome(biomeIndex) | function setBiome(biomeIndex) | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | g_Gaia = { | ||||
"fish": "gaia/fauna_fish", | "fish": "gaia/fauna_fish", | ||||
"mainHuntableAnimal": "gaia/fauna_deer", | "mainHuntableAnimal": "gaia/fauna_deer", | ||||
"secondaryHuntableAnimal": "gaia/fauna_sheep", | "secondaryHuntableAnimal": "gaia/fauna_sheep", | ||||
"stoneLarge": "gaia/geology_stonemine_temperate_quarry", | "stoneLarge": "gaia/geology_stonemine_temperate_quarry", | ||||
"stoneSmall": "gaia/geology_stone_temperate", | "stoneSmall": "gaia/geology_stone_temperate", | ||||
"metalLarge": "gaia/geology_metal_temperate_slabs" | "metalLarge": "gaia/geology_metal_temperate_slabs" | ||||
}; | }; | ||||
var random_trees = randInt(3); | var random_trees = randIntInclusive(1, 3); | ||||
if (random_trees == 0) | if (random_trees == 1) | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_oak"; | g_Gaia.tree1 = "gaia/flora_tree_oak"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_oak_large"; | g_Gaia.tree2 = "gaia/flora_tree_oak_large"; | ||||
} | } | ||||
else if (random_trees == 1) | else if (random_trees == 2) | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_poplar"; | g_Gaia.tree1 = "gaia/flora_tree_poplar"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_poplar"; | g_Gaia.tree2 = "gaia/flora_tree_poplar"; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_euro_beech"; | g_Gaia.tree1 = "gaia/flora_tree_euro_beech"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_euro_beech"; | g_Gaia.tree2 = "gaia/flora_tree_euro_beech"; | ||||
} | } | ||||
g_Gaia.tree3 = "gaia/flora_tree_apple"; | g_Gaia.tree3 = "gaia/flora_tree_apple"; | ||||
random_trees = randInt(3); | random_trees = randIntInclusive(1, 3); | ||||
if (random_trees == 0) | if (random_trees == 1) | ||||
{ | { | ||||
g_Gaia.tree4 = "gaia/flora_tree_pine"; | g_Gaia.tree4 = "gaia/flora_tree_pine"; | ||||
g_Gaia.tree5 = "gaia/flora_tree_aleppo_pine"; | g_Gaia.tree5 = "gaia/flora_tree_aleppo_pine"; | ||||
} | } | ||||
else if (random_trees == 1) | else if (random_trees == 2) | ||||
{ | { | ||||
g_Gaia.tree4 = "gaia/flora_tree_pine"; | g_Gaia.tree4 = "gaia/flora_tree_pine"; | ||||
g_Gaia.tree5 = "gaia/flora_tree_pine"; | g_Gaia.tree5 = "gaia/flora_tree_pine"; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
g_Gaia.tree4 = "gaia/flora_tree_aleppo_pine"; | g_Gaia.tree4 = "gaia/flora_tree_aleppo_pine"; | ||||
g_Gaia.tree5 = "gaia/flora_tree_aleppo_pine"; | g_Gaia.tree5 = "gaia/flora_tree_aleppo_pine"; | ||||
▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | g_Gaia = { | ||||
"mainHuntableAnimal": "gaia/fauna_deer", | "mainHuntableAnimal": "gaia/fauna_deer", | ||||
"fish": "gaia/fauna_fish", | "fish": "gaia/fauna_fish", | ||||
"secondaryHuntableAnimal": "gaia/fauna_sheep", | "secondaryHuntableAnimal": "gaia/fauna_sheep", | ||||
"stoneLarge": "gaia/geology_stonemine_medit_quarry", | "stoneLarge": "gaia/geology_stonemine_medit_quarry", | ||||
"stoneSmall": "gaia/geology_stone_mediterranean", | "stoneSmall": "gaia/geology_stone_mediterranean", | ||||
"metalLarge": "gaia/geology_metal_mediterranean_slabs" | "metalLarge": "gaia/geology_metal_mediterranean_slabs" | ||||
}; | }; | ||||
var random_trees = randInt(3); | var random_trees = randIntInclusive(1, 3); | ||||
if (random_trees == 0) | if (random_trees == 1) | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_cretan_date_palm_short"; | g_Gaia.tree1 = "gaia/flora_tree_cretan_date_palm_short"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_cretan_date_palm_tall"; | g_Gaia.tree2 = "gaia/flora_tree_cretan_date_palm_tall"; | ||||
} | } | ||||
else if (random_trees == 1) | else if (random_trees == 2) | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_carob"; | g_Gaia.tree1 = "gaia/flora_tree_carob"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_carob"; | g_Gaia.tree2 = "gaia/flora_tree_carob"; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
g_Gaia.tree1 = "gaia/flora_tree_medit_fan_palm"; | g_Gaia.tree1 = "gaia/flora_tree_medit_fan_palm"; | ||||
g_Gaia.tree2 = "gaia/flora_tree_medit_fan_palm"; | g_Gaia.tree2 = "gaia/flora_tree_medit_fan_palm"; | ||||
▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator