mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 03:13:56 +00:00
5a9968f88d
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>
25 lines
993 B
JavaScript
25 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);
|