Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/gamesetup.js
Show First 20 Lines • Show All 406 Lines • ▼ Show 20 Lines | "settings": [ | ||||
"mapFilter", | "mapFilter", | ||||
"mapSelection", | "mapSelection", | ||||
"mapSize", | "mapSize", | ||||
"biome", | "biome", | ||||
"triggerDifficulty", | "triggerDifficulty", | ||||
"nomad", | "nomad", | ||||
"disableTreasures", | "disableTreasures", | ||||
"exploreMap", | "exploreMap", | ||||
"revealMap" | "revealMap", | ||||
"experimentalLos", | |||||
] | ] | ||||
}, | }, | ||||
{ | { | ||||
"label": translateWithContext("Match settings tab name", "Player"), | "label": translateWithContext("Match settings tab name", "Player"), | ||||
"settings": [ | "settings": [ | ||||
"numPlayers", | "numPlayers", | ||||
"populationCap", | "populationCap", | ||||
"startingResources", | "startingResources", | ||||
▲ Show 20 Lines • Show All 403 Lines • ▼ Show 20 Lines | obj[victoryCondition.Name] = { | ||||
"enabled": () => | "enabled": () => | ||||
g_GameAttributes.mapType != "scenario" && | g_GameAttributes.mapType != "scenario" && | ||||
(!victoryCondition.DisabledWhenChecked || | (!victoryCondition.DisabledWhenChecked || | ||||
victoryCondition.DisabledWhenChecked.every(victoryConditionName => g_GameAttributes.settings.VictoryConditions.indexOf(victoryConditionName) == -1)) | victoryCondition.DisabledWhenChecked.every(victoryConditionName => g_GameAttributes.settings.VictoryConditions.indexOf(victoryConditionName) == -1)) | ||||
}; | }; | ||||
return obj; | return obj; | ||||
}, {}), | }, {}), | ||||
{ | { | ||||
"experimentalLos": { | |||||
"title": () => translate("Experimental vision"), | |||||
"tooltip": () => translate("Toogle whenever terrain should block vision."), | |||||
"default": () => false, | |||||
"defined": () => g_GameAttributes.ExperimentalLos !== undefined, | |||||
"get": () => g_GameAttributes.ExperimentalLos, | |||||
"set": checked => { | |||||
g_GameAttributes.ExperimentalLos = checked; | |||||
}, | |||||
"hidden": () => false, | |||||
"enabled": () => !g_GameAttributes.settings.RevealMap, | |||||
"initOrder": 1000 | |||||
}, | |||||
"regicideGarrison": { | "regicideGarrison": { | ||||
"title": () => translate("Hero Garrison"), | "title": () => translate("Hero Garrison"), | ||||
"tooltip": () => translate("Toggle whether heroes can be garrisoned."), | "tooltip": () => translate("Toggle whether heroes can be garrisoned."), | ||||
"default": () => false, | "default": () => false, | ||||
"defined": () => g_GameAttributes.settings.RegicideGarrison !== undefined, | "defined": () => g_GameAttributes.settings.RegicideGarrison !== undefined, | ||||
"get": () => g_GameAttributes.settings.RegicideGarrison, | "get": () => g_GameAttributes.settings.RegicideGarrison, | ||||
"set": checked => { | "set": checked => { | ||||
g_GameAttributes.settings.RegicideGarrison = checked; | g_GameAttributes.settings.RegicideGarrison = checked; | ||||
Show All 22 Lines | "revealMap": { | ||||
// Translation: Make sure to differentiate between the revealed map and explored map settings! | // Translation: Make sure to differentiate between the revealed map and explored map settings! | ||||
() => translate("Toggle revealed map (see everything)."), | () => translate("Toggle revealed map (see everything)."), | ||||
"default": () => false, | "default": () => false, | ||||
"defined": () => g_GameAttributes.settings.RevealMap !== undefined, | "defined": () => g_GameAttributes.settings.RevealMap !== undefined, | ||||
"get": () => g_GameAttributes.settings.RevealMap, | "get": () => g_GameAttributes.settings.RevealMap, | ||||
"set": checked => { | "set": checked => { | ||||
g_GameAttributes.settings.RevealMap = checked; | g_GameAttributes.settings.RevealMap = checked; | ||||
if (checked) | if (checked) { | ||||
g_Checkboxes.exploreMap.set(true); | g_Checkboxes.exploreMap.set(true); | ||||
g_Checkboxes.experimentalLos.set(false); | |||||
} | |||||
}, | }, | ||||
"enabled": () => g_GameAttributes.mapType != "scenario", | "enabled": () => g_GameAttributes.mapType != "scenario", | ||||
"initOrder": 1000 | "initOrder": 1000 | ||||
}, | }, | ||||
"exploreMap": { | "exploreMap": { | ||||
"title": | "title": | ||||
// Translation: Make sure to differentiate between the revealed map and explored map settings! | // Translation: Make sure to differentiate between the revealed map and explored map settings! | ||||
() => translate("Explored Map"), | () => translate("Explored Map"), | ||||
▲ Show 20 Lines • Show All 1,469 Lines • ▼ Show 20 Lines | function launchGame() | ||||
// Seed used for both map generation and simulation | // Seed used for both map generation and simulation | ||||
g_GameAttributes.settings.Seed = randIntExclusive(0, Math.pow(2, 32)); | g_GameAttributes.settings.Seed = randIntExclusive(0, Math.pow(2, 32)); | ||||
g_GameAttributes.settings.AISeed = randIntExclusive(0, Math.pow(2, 32)); | g_GameAttributes.settings.AISeed = randIntExclusive(0, Math.pow(2, 32)); | ||||
// Used for identifying rated game reports for the lobby | // Used for identifying rated game reports for the lobby | ||||
g_GameAttributes.matchID = Engine.GetMatchID(); | g_GameAttributes.matchID = Engine.GetMatchID(); | ||||
// Set default LOS implementation | |||||
if (g_GameAttributes.ExperimentalLos === undefined) | |||||
g_GameAttributes.ExperimentalLos = false; | |||||
if (g_IsNetworked) | if (g_IsNetworked) | ||||
{ | { | ||||
Engine.SetNetworkGameAttributes(g_GameAttributes); | Engine.SetNetworkGameAttributes(g_GameAttributes); | ||||
Engine.StartNetworkGame(); | Engine.StartNetworkGame(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
// Find the player ID which the user has been assigned to | // Find the player ID which the user has been assigned to | ||||
▲ Show 20 Lines • Show All 405 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator