0ad/binaries/data/mods/public/gui/reference/common/common.js
Ralph Sennhauser 93668e8447
Fix eslint rule 'prefer-const' in gui/reference
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/gui/reference

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-10 18:40:28 +02:00

33 lines
1.1 KiB
JavaScript

/**
* This needs to stay in the global scope, as it is used by various functions
* within gui/common/tooltip.js
*/
var g_ResourceData = new Resources();
var g_Page;
/**
* This is needed because getEntityCostTooltip in tooltip.js needs to get
* the template data of the different wallSet pieces. In the session this
* function does some caching, but here we do that in the TemplateLoader
* class already.
*/
function GetTemplateData(templateName)
{
const template = g_Page.TemplateLoader.loadEntityTemplate(templateName, g_Page.activeCiv);
return GetTemplateDataHelper(template, null, g_Page.TemplateLoader.auraData, g_ResourceData, g_Page.TemplateParser.getModifiers(g_Page.activeCiv));
}
/**
* This would ideally be an Engine method.
* Or part of globalscripts. Either would be better than here.
*/
function TechnologyTemplateExists(templateName)
{
return Engine.FileExists(g_Page.TemplateLoader.TechnologyPath + templateName + ".json");
}
function AuraTemplateExists(templateName)
{
return Engine.FileExists(g_Page.TemplateLoader.AuraPath + templateName + ".json");
}