Skill CreateSkill(int skill_index, int skill_cfgid) { LogicWorld logic_world = GetLogicWorld(); SkillManager skill_manager = logic_world.GetSkillManager(); IConfigProvider config = logic_world.GetConfigProvider(); ObjectTypeData skill_data = config.GetSkillData(skill_cfgid); if (skill_data == null) { m_index2id[skill_index] = -1; return(null); } ObjectCreationContext object_context = new ObjectCreationContext(); object_context.m_object_type_id = skill_cfgid; object_context.m_type_data = skill_data; object_context.m_logic_world = logic_world; object_context.m_owner_id = ParentObject.ID; Skill skill = skill_manager.CreateObject(object_context); m_index2id[skill_index] = skill.ID; if (skill_index == DEFAULT_SKILL_INDEX) { m_default_skill_id = skill.ID; } if (skill.GetDefinitionComponent().StartsActive) { skill.Activate(GetCurrentTime()); } return(skill); }