Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/globalscripts/Templates.js
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | function GetTemplateDataHelper(template, player, auraTemplates, resources, damageTypes, modifiers={}) | ||||
{ | { | ||||
ret.deathDamage = { | ret.deathDamage = { | ||||
"friendlyFire": template.DeathDamage.FriendlyFire != "false" | "friendlyFire": template.DeathDamage.FriendlyFire != "false" | ||||
}; | }; | ||||
for (let damageType of damageTypes.GetTypes()) | for (let damageType of damageTypes.GetTypes()) | ||||
ret.deathDamage[damageType] = getEntityValue("DeathDamage/" + damageType); | ret.deathDamage[damageType] = getEntityValue("DeathDamage/" + damageType); | ||||
} | } | ||||
if (template.Auras) | if (template.Auras && auraTemplates) | ||||
{ | { | ||||
ret.auras = {}; | ret.auras = {}; | ||||
for (let auraID of template.Auras._string.split(/\s+/)) | for (let auraID of template.Auras._string.split(/\s+/)) | ||||
{ | { | ||||
let aura = auraTemplates[auraID]; | let aura = auraTemplates[auraID]; | ||||
ret.auras[auraID] = { | ret.auras[auraID] = { | ||||
"name": aura.auraName, | "name": aura.auraName, | ||||
"description": aura.auraDescription || null, | "description": aura.auraDescription || null, | ||||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | function GetTemplateDataHelper(template, player, auraTemplates, resources, damageTypes, modifiers={}) | ||||
} | } | ||||
if (template.Trader) | if (template.Trader) | ||||
ret.trader = { | ret.trader = { | ||||
"GainMultiplier": getEntityValue("Trader/GainMultiplier") | "GainMultiplier": getEntityValue("Trader/GainMultiplier") | ||||
}; | }; | ||||
if (template.WallSet) | if (template.WallSet) | ||||
{ | |||||
ret.wallSet = { | ret.wallSet = { | ||||
"templates": { | "templates": { | ||||
"tower": template.WallSet.Templates.Tower, | "tower": template.WallSet.Templates.Tower, | ||||
"gate": template.WallSet.Templates.Gate, | "gate": template.WallSet.Templates.Gate, | ||||
"fort": template.WallSet.Templates.Fort || "structures/{civ}_fortress", | |||||
"long": template.WallSet.Templates.WallLong, | "long": template.WallSet.Templates.WallLong, | ||||
"medium": template.WallSet.Templates.WallMedium, | "medium": template.WallSet.Templates.WallMedium, | ||||
"short": template.WallSet.Templates.WallShort, | "short": template.WallSet.Templates.WallShort | ||||
}, | }, | ||||
"maxTowerOverlap": +template.WallSet.MaxTowerOverlap, | "maxTowerOverlap": +template.WallSet.MaxTowerOverlap, | ||||
"minTowerOverlap": +template.WallSet.MinTowerOverlap, | "minTowerOverlap": +template.WallSet.MinTowerOverlap | ||||
}; | }; | ||||
if (template.WallSet.Templates.WallEnd) | |||||
ret.wallSet.templates.end = template.WallSet.Templates.WallEnd; | |||||
if (template.WallSet.Templates.WallCurves) | |||||
ret.wallSet.templates.curves = template.WallSet.Templates.WallCurves.split(" "); | |||||
} | |||||
if (template.WallPiece) | if (template.WallPiece) | ||||
ret.wallPiece = { "length": +template.WallPiece.Length }; | ret.wallPiece = { | ||||
"length": +template.WallPiece.Length, | |||||
"angle": +(template.WallPiece.Orientation || 1) * Math.PI, | |||||
"indent": +(template.WallPiece.Indent || 0), | |||||
"bend": +(template.WallPiece.Bend || 0) * Math.PI | |||||
}; | |||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* Get basic information about a technology template. | * Get basic information about a technology template. | ||||
* @param {object} template - A valid template as obtained by loading the tech JSON file. | * @param {object} template - A valid template as obtained by loading the tech JSON file. | ||||
* @param {string} civ - Civilization for which the tech requirements should be calculated. | * @param {string} civ - Civilization for which the tech requirements should be calculated. | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator