Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/globalscripts/Templates.js
/** | /** | ||||
* Loads history and gameplay data of all civs. | * Loads history and gameplay data of all civs. | ||||
* | * | ||||
* @param selectableOnly {boolean} - Only load civs that can be selected | * @param selectableOnly {boolean} - Only load civs that can be selected | ||||
* in the gamesetup. Scenario maps might set non-selectable civs. | * in the gamesetup. Scenario maps might set non-selectable civs. | ||||
*/ | */ | ||||
function loadCivFiles(selectableOnly) | function loadCivFiles(selectableOnly) | ||||
{ | { | ||||
let propertyNames = [ | let propertyNames = [ | ||||
"Code", "Culture", "Name", "Emblem", "History", "Music", "Factions", "CivBonuses", "TeamBonuses", | "Code", "Culture", "Name", "Emblem", "History", "Music", "Factions", "CivBonuses", "TeamBonuses", | ||||
"Structures", "StartEntities", "Formations", "AINames", "SkirmishReplacements", "SelectableInGameSetup"]; | "Structures", "StartEntities", "Formations", "AINames", "SkirmishReplacements", "SelectableInGameSetup"]; | ||||
Stan: I didn't manage to get it work, can you try whether it works for you ? | |||||
let civData = {}; | let civData = {}; | ||||
for (let filename of Engine.ListDirectoryFiles("simulation/data/civs/", "*.json", false)) | for (let filename of Engine.ListDirectoryFiles("simulation/data/civs/", "*.json", false)) | ||||
{ | { | ||||
let data = Engine.ReadJSONFile(filename); | let data = Engine.ReadJSONFile(filename); | ||||
for (let prop of propertyNames) | for (let prop of propertyNames) | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | for (let type in template.Attack) | ||||
ret.attack[type].splash = { | ret.attack[type].splash = { | ||||
// true if undefined | // true if undefined | ||||
"friendlyFire": template.Attack[type].Splash.FriendlyFire != "false", | "friendlyFire": template.Attack[type].Splash.FriendlyFire != "false", | ||||
"shape": template.Attack[type].Splash.Shape | "shape": template.Attack[type].Splash.Shape | ||||
}; | }; | ||||
for (let damageType of damageTypes.GetTypes()) | for (let damageType of damageTypes.GetTypes()) | ||||
ret.attack[type].splash[damageType] = getAttackStat("Splash/" + damageType); | ret.attack[type].splash[damageType] = getAttackStat("Splash/" + damageType); | ||||
} | } | ||||
if (template.Attack[type].Bonuses) | |||||
{ | |||||
ret.attack[type].bonuses = {}; | |||||
for (let bonus in template.Attack[type].Bonuses) { | |||||
ret.attack[type].bonuses[bonus] = { | |||||
"classes": template.Attack[type].Bonuses[bonus].Classes, | |||||
"multiplier": getAttackStat("Bonuses/" + bonus + "/Multiplier") | |||||
FreagarachAuthorUnsubmitted Done Inline Actions.toFixed(x) perhaps? If upgrading of bunuses will be introduced. Freagarach: .toFixed(x) perhaps? If upgrading of bunuses will be introduced. | |||||
StanUnsubmitted Done Inline Actions.toFixed(8) like used below. Stan: .toFixed(8) like used below. | |||||
}; | |||||
} | |||||
} | |||||
Done Inline Actions{} can be removed since it contains only one statement elexis: {} can be removed since it contains only one statement
still mising semicolon x = y; (check… | |||||
} | } | ||||
} | } | ||||
if (template.DeathDamage) | if (template.DeathDamage) | ||||
{ | { | ||||
ret.deathDamage = { | ret.deathDamage = { | ||||
"friendlyFire": template.DeathDamage.FriendlyFire != "false" | "friendlyFire": template.DeathDamage.FriendlyFire != "false" | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
I didn't manage to get it work, can you try whether it works for you ?