Include Player Placement setting in Game Description

The option was missing, so player placement was not shown in the game
description part of the game setup, and it was not shown in the objectives
page in-game.
This commit is contained in:
Feldfeld 2024-12-22 20:59:15 +01:00 committed by phosit
parent 683a9cb06e
commit b5256ce014
6 changed files with 44 additions and 30 deletions

View file

@ -47,32 +47,3 @@ GameSettings.prototype.Attributes.PlayerPlacement = class PlayerPlacement extend
return true;
}
};
GameSettings.prototype.Attributes.PlayerPlacement.prototype.StartingPositions = [
{
"Id": "circle",
"Name": translateWithContext("player placement", "Circle"),
"Description": translate("Players are placed in a circle spanning the map.")
},
{
"Id": "river",
"Name": translateWithContext("player placement", "River"),
"Description": translate("Allied players are placed on two parallel lines.")
},
{
"Id": "groupedLines",
"Name": translateWithContext("player placement", "Grouped lines"),
"Description": translate("Allied players are placed along opposing radial lines"),
},
{
"Id": "randomGroup",
"Name": translateWithContext("player placement", "Random Group"),
"Description": translate("Allied players are grouped, but otherwise placed randomly on the map."),
},
{
"Id": "stronghold",
"Name": translateWithContext("player placement", "Stronghold"),
"Description": translate("Allied players are grouped in one random place of the map."),
}
];

View file

@ -317,6 +317,15 @@ function getGameDescription(initAttributes, mapCache)
});
}
if (initAttributes.settings.PlayerPlacement)
{
const playerPlacement = g_Settings.PlayerPlacements.find(placement => placement.Id === initAttributes.settings.PlayerPlacement);
titles.push({
"label": playerPlacement ? playerPlacement.Name : translateWithContext("player placement", "Random Player Placement"),
"value": playerPlacement ? playerPlacement.Description : translate("Randomly select a player placement from the list.")
});
}
if (initAttributes.settings.Biome)
{
let biome = g_Settings.Biomes.find(b => b.Id == initAttributes.settings.Biome);

View file

@ -41,6 +41,7 @@ function loadSettingsValues()
"GameSpeeds": loadSettingValuesFile("game_speeds.json"),
"MapTypes": loadMapTypes(),
"MapSizes": loadSettingValuesFile("map_sizes.json"),
"PlayerPlacements": loadSettingValuesFile("player_placements.json"),
"Biomes": loadBiomes(),
"PlayerDefaults": loadPlayerDefaults(),
"PopulationCapacities": loadSettingValuesFile("population_capacities.json"),

View file

@ -26,7 +26,7 @@ GameSettingControls.PlayerPlacement = class PlayerPlacement extends GameSettingC
let patterns = [randomItem];
for (let pattern of g_GameSettings.playerPlacement.available)
patterns.push(g_GameSettings.playerPlacement.StartingPositions
patterns.push(g_Settings.PlayerPlacements
.find(pObj => pObj.Id == pattern));
this.values = prepareForDropdown(patterns);

View file

@ -26,6 +26,7 @@ class GameDescription
g_GameSettings.mapExploration.watch(update, ["allied"]);
g_GameSettings.nomad.watch(update, ["enabled"]);
g_GameSettings.population.watch(update, ["perPlayer", "cap", "capType"]);
g_GameSettings.playerPlacement.watch(update, ["value"]);
g_GameSettings.rating.watch(update, ["enabled"]);
g_GameSettings.regicideGarrison.watch(update, ["enabled"]);
g_GameSettings.relic.watch(update, ["count", "duration"]);

View file

@ -0,0 +1,32 @@
{
"TranslatedKeys": ["Name", "Description"],
"TranslationContext": "player placement",
"Data":
[
{
"Id": "circle",
"Name": "Circle",
"Description": "Players are placed in a circle spanning the map."
},
{
"Id": "river",
"Name": "River",
"Description": "Allied players are placed on two parallel lines."
},
{
"Id": "groupedLines",
"Name": "Grouped Lines",
"Description": "Allied players are placed along opposing radial lines."
},
{
"Id": "randomGroup",
"Name": "Random Group",
"Description": "Allied players are grouped, but otherwise placed randomly on the map."
},
{
"Id": "stronghold",
"Name": "Stronghold",
"Description": "Allied players are tightly grouped together."
}
]
}