Index: ps/trunk/binaries/data/mods/public/gui/common/gamedescription.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/common/gamedescription.js +++ ps/trunk/binaries/data/mods/public/gui/common/gamedescription.js @@ -348,6 +348,15 @@ translate("Sorry, no description available."), }); + if (g_GameAttributes.settings.Biome) + { + let biome = g_Settings.Biomes.find(biome => biome.Id == g_GameAttributes.settings.Biome); + titles.push({ + "label": translate("Biome"), + "value": biome ? biome.Title : translateWithContext("biome", "Random") + }); + } + if (extended) { titles.push({ Index: ps/trunk/binaries/data/mods/public/gui/common/settings.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/common/settings.js +++ ps/trunk/binaries/data/mods/public/gui/common/settings.js @@ -15,6 +15,12 @@ const g_SettingsDirectory = "simulation/data/settings/"; /** + * Directory containing all biomes supported for random map scripts. + */ +const g_BiomesDirectory = "maps/random/rmbiome/biomes/"; + + +/** * An object containing all values given by setting name. * Used by lobby, gamesetup, session, summary screen and replay menu. */ @@ -36,7 +42,7 @@ "GameSpeeds": loadSettingValuesFile("game_speeds.json"), "MapTypes": loadMapTypes(), "MapSizes": loadSettingValuesFile("map_sizes.json"), - "Biomes": loadSettingValuesFile("biomes.json"), + "Biomes": loadBiomes(), "PlayerDefaults": loadPlayerDefaults(), "PopulationCapacities": loadPopulationCapacities(), "StartingResources": loadSettingValuesFile("starting_resources.json"), @@ -203,6 +209,18 @@ ]; } +function loadBiomes() +{ + return Engine.BuildDirEntList(g_BiomesDirectory, "*.json", false).map(file => { + let description = Engine.ReadJSONFile(file).Description; + return { + "Id": file.substr(g_BiomesDirectory.length).slice(0, -".json".length), + "Title": translateWithContext("biome definition", description.Title), + "Description": translateWithContext("biome definition", description.Description) + }; + }); +} + /** * Loads available gametypes. * Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -472,7 +472,7 @@ }, "biome": { "title": () => translate("Biome"), - "tooltip": (hoverIdx) => translate("Select the flora and fauna."), + "tooltip": (hoverIdx) => g_BiomeList && g_BiomeList.Description && g_BiomeList.Description[hoverIdx] || translate("Select the flora and fauna."), "labels": () => g_BiomeList ? g_BiomeList.Title : [], "colors": (idx) => g_BiomeList ? g_BiomeList.Color : [], "ids": () => g_BiomeList ? g_BiomeList.Id : [], @@ -1501,14 +1501,8 @@ if (g_GameAttributes.settings.SupportedBiomes === true) biomeList = g_Settings.Biomes; else - { biomeList = g_Settings.Biomes.filter( biome => g_GameAttributes.settings.SupportedBiomes.indexOf(biome.Id) != -1); - - for (let biome of g_GameAttributes.settings.SupportedBiomes) - if (g_Settings.Biomes.every(bio => bio.Id != biome)) - warn("Map '" + g_GameAttributes.map + "' contains unknown biome '" + biome + "'") - } } g_BiomeList = biomeList && prepareForDropdown( Index: ps/trunk/binaries/data/mods/public/l10n/messages.json =================================================================== --- ps/trunk/binaries/data/mods/public/l10n/messages.json +++ ps/trunk/binaries/data/mods/public/l10n/messages.json @@ -665,6 +665,19 @@ } } } + }, + { + "extractor": "json", + "filemasks": [ + "maps/random/rmbiome/biomes/**.json" + ], + "options": { + "keywords": [ + "Title", + "Description" + ], + "context": "biome definition" + } } ] }, Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/alpine.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/alpine.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/alpine.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Alpine", + "Description": "A region in the high snowy mountains. Biting winds sweep through the abundant conifer forests, making even the more resilient deer and mountain goats shiver." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/autumn.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/autumn.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/autumn.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Autumn", + "Description": "Autumn at its peak. The landscape is a dazzling dash of colors irrevocably intertwined. The native beech and oak trees of this temperate zone display a multi-coloured foliage while the evergreen pines look on with indifference at the approaching winter." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/desert.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/desert.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/desert.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Desert", + "Description": "A semi-desert area that boasts numerous clumps of date palms and tamarix trees. Herds of camels roam the wild and the occasional gazelle jumps up in fright at being disturbed." + }, "Environment": { "SunColor": { "r": 0.733, "g": 0.746, "b": 0.574 }, "Water": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/mediterranean.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/mediterranean.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/mediterranean.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Mediterranean", + "Description": "Start in a region blessed with the Mediterranean climate, a warm and inviting land. The cypresses are in a perpetual struggle with the dominant fan palms while deer graze in their shadows, blissfully unaware." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/savanna.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/savanna.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/savanna.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Savanna", + "Description": "The savanna, a dry climate in which only the hardy Baobab trees thrive. Solitary gazelles graze the sparse grass, while herds of zebras, wildebeest, giraffes or elephants roam the wild in search of food." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/snowy.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/snowy.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/snowy.json @@ -1,6 +1,9 @@ { - "Environment": - { + "Description": { + "Title": "Snowy", + "Description": "Settle in the cold regions of the North, the native habitat of the wooly muskox. Here you can pine away to your content and also hunt the occasional walrus or two." + }, + "Environment": { "SunColor": { "r": 0.550, "g": 0.601, "b": 0.644 }, "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/temperate.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/temperate.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/temperate.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Temperate", + "Description": "Lush grasslands carpet the land, in places giving way to magnificent and diverse broadleaf forests. Poplars, pines, beeches and oaks all vie for supremacy but this root-war is a neverending struggle. Numerous apple trees dot the land, deer and sheep gorge themselves on this years fallen fruit." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/tropic.json =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/tropic.json +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/biomes/tropic.json @@ -1,4 +1,8 @@ { + "Description": { + "Title": "Tropic", + "Description": "Explore the mysterious tropics. An extremely green, but also extremely humid environment awaits. The tall Toona trees look on disapprovingly at this invasion of their privacy and ferocious tigers are determined to defend their territory at all costs." + }, "Environment": { "Water": { "WaterBody": { Index: ps/trunk/binaries/data/mods/public/maps/random/rmbiome/randombiome.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/rmbiome/randombiome.js +++ ps/trunk/binaries/data/mods/public/maps/random/rmbiome/randombiome.js @@ -62,7 +62,8 @@ }; for (let rmsGlobal in biome) - copyProperties(biome[rmsGlobal], global["g_" + rmsGlobal]); + if (rmsGlobal != "Description") + copyProperties(biome[rmsGlobal], global["g_" + rmsGlobal]); } function rBiomeTreeCount(multiplier = 1) Index: ps/trunk/binaries/data/mods/public/maps/random/unknown_nomad.js =================================================================== --- ps/trunk/binaries/data/mods/public/maps/random/unknown_nomad.js +++ ps/trunk/binaries/data/mods/public/maps/random/unknown_nomad.js @@ -1611,12 +1611,8 @@ ); } -var planetm = 1; -if (rt==7) -{ - planetm = 8; -} -//create small grass tufts +var planetm = currentBiome() == "tropic" ? 8 : 1; + log("Creating small grass tufts..."); group = new SimpleGroup( [new SimpleObject(aGrassShort, 1,2, 0,1, -PI/8,PI/8)] Index: ps/trunk/binaries/data/mods/public/simulation/data/settings/biomes.json =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/data/settings/biomes.json +++ ps/trunk/binaries/data/mods/public/simulation/data/settings/biomes.json @@ -1,38 +0,0 @@ -{ - "TranslatedKeys": ["Title"], - "Data": - [ - { - "Id": "temperate", - "Title": "Temperate" - }, - { - "Id": "snowy", - "Title": "Snowy" - }, - { - "Id": "desert", - "Title": "Desert" - }, - { - "Id": "alpine", - "Title": "Alpine" - }, - { - "Id": "mediterranean", - "Title": "Mediterranean" - }, - { - "Id": "savanna", - "Title": "Savanna" - }, - { - "Id": "tropic", - "Title": "Tropic" - }, - { - "Id": "autumn", - "Title": "Autumn" - } - ] -}