mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 06:13:55 -07:00
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
binaries/data/mods/public/simulation/helpers
Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
24 lines
993 B
JavaScript
24 lines
993 B
JavaScript
// Little helper functions to make applying technology and auras more convenient
|
|
|
|
function ApplyValueModificationsToEntity(tech_type, current_value, entity)
|
|
{
|
|
let value = current_value;
|
|
|
|
// entity can be an owned entity or a player entity.
|
|
const cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager);
|
|
if (cmpModifiersManager)
|
|
value = cmpModifiersManager.ApplyModifiers(tech_type, current_value, entity);
|
|
return value;
|
|
}
|
|
|
|
function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template)
|
|
{
|
|
let value = current_value;
|
|
const cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager);
|
|
if (cmpModifiersManager)
|
|
value = cmpModifiersManager.ApplyTemplateModifiers(tech_type, current_value, template, playerID);
|
|
return value;
|
|
}
|
|
|
|
Engine.RegisterGlobal("ApplyValueModificationsToEntity", ApplyValueModificationsToEntity);
|
|
Engine.RegisterGlobal("ApplyValueModificationsToTemplate", ApplyValueModificationsToTemplate);
|