Ejemplo n.º 1
0
        protected void LearnWeaponGroup(ThingDef weapon, Pawn pawn, CompKnowledge techComp)
        {
            bool groupRanged = ModBaseHumanResources.LearnRangedWeaponsByGroup && weapon.IsRangedWeapon;
            bool groupMelee  = ModBaseHumanResources.LearnMeleeWeaponsByGroup && weapon.IsMeleeWeapon;

            if (Extension_Research.TechByWeapon.ContainsKey(weapon) && (groupRanged || groupMelee))
            {
                foreach (ThingDef sister in Extension_Research.WeaponsByTech[Extension_Research.TechByWeapon[weapon]])
                {
                    if ((groupRanged && sister.IsRangedWeapon) || (groupMelee && sister.IsMeleeWeapon))
                    {
                        techComp.LearnWeapon(sister);
                        Messages.Message("MessageTrainingComplete".Translate(pawn, sister), MessageTypeDefOf.TaskCompletion);
                    }
                }
            }
            else
            {
                techComp.LearnWeapon(weapon);
                Messages.Message("MessageTrainingComplete".Translate(pawn, weapon), MessageTypeDefOf.TaskCompletion);
            }
        }
        protected void LearnWeaponGroup(ThingDef weapon, Pawn pawn, CompKnowledge techComp)
        {
            bool groupRanged = ModBaseHumanResources.LearnRangedWeaponsByGroup && weapon.IsRangedWeapon;
            bool groupMelee  = ModBaseHumanResources.LearnMeleeWeaponsByGroup && weapon.IsMeleeWeapon;

            if (TechTracker.FindTechs(weapon).Any() && (groupRanged || groupMelee))
            {
                foreach (ThingDef sister in TechTracker.FindTech(weapon).Weapons)
                {
                    if ((groupRanged && sister.IsRangedWeapon) || (groupMelee && sister.IsMeleeWeapon))
                    {
                        techComp.LearnWeapon(sister);
                        Messages.Message("MessageTrainingComplete".Translate(pawn, sister), MessageTypeDefOf.TaskCompletion);
                    }
                }
            }
            else
            {
                techComp.LearnWeapon(weapon);
                Messages.Message("MessageTrainingComplete".Translate(pawn, weapon), MessageTypeDefOf.TaskCompletion);
            }
        }