Line data Source code
1 : // Little helper functions to make applying technology and auras more convenient 2 : 3 : function ApplyValueModificationsToEntity(tech_type, current_value, entity) 4 : { 5 429 : let value = current_value; 6 : 7 : // entity can be an owned entity or a player entity. 8 429 : let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); 9 429 : if (cmpModifiersManager) 10 52 : value = cmpModifiersManager.ApplyModifiers(tech_type, current_value, entity); 11 429 : return value; 12 : } 13 : 14 : function ApplyValueModificationsToTemplate(tech_type, current_value, playerID, template) 15 : { 16 17 : let value = current_value; 17 17 : let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); 18 17 : if (cmpModifiersManager) 19 13 : value = cmpModifiersManager.ApplyTemplateModifiers(tech_type, current_value, template, playerID); 20 17 : return value; 21 : } 22 : 23 21 : Engine.RegisterGlobal("ApplyValueModificationsToEntity", ApplyValueModificationsToEntity); 24 21 : Engine.RegisterGlobal("ApplyValueModificationsToTemplate", ApplyValueModificationsToTemplate);