private void AddAbilityInternal(AbilityDef abilityDef, List <PawnAbility> thelist, bool activenow, float savedTicks)
        {
            PawnAbility pa = (PawnAbility)Activator.CreateInstance(abilityDef.abilityClass);

            //Log.Message(abilityDef.abilityClass.ToString());
            pa.Pawn = this.AbilityUser;
            pa.Def  = abilityDef;
            thelist.Add(pa);
            this.UpdateAbilities();
        }
        public void RemovePawnAbility(AbilityDef abilityDef)
        {
            PawnAbility abilityToRemove = this.CompAbilityUser.Powers.FirstOrDefault(x => x.powerdef.defName == abilityDef.defName);

            if (abilityToRemove != null)
            {
                this.CompAbilityUser.Powers.Remove(abilityToRemove);
            }

            this.CompAbilityUser.UpdateAbilities();
        }
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     for (int i = 0; i < this.AbilityData?.AllPowers.Count; i++)
     {
         PawnAbility ability = this.AbilityData?.AllPowers[i];
         if (ability.ShouldShowGizmo())
         {
             yield return(ability.GetGizmo());
         }
     }
 }
Example #4
0
        public void RemovePawnAbility(AbilityDef abilityDef) => this.RemoveAbilityInternal(abilityDef, ref this.Powers); public void RemoveWeaponAbility(AbilityDef abilityDef) => this.RemoveAbilityInternal(abilityDef, ref this.temporaryWeaponPowers); public void RemoveApparelAbility(AbilityDef abilityDef) => this.RemoveAbilityInternal(abilityDef, ref this.temporaryApparelPowers); private void RemoveAbilityInternal(AbilityDef abilityDef, ref List <PawnAbility> thelist)
        {
            PawnAbility abilityToRemove = thelist.FirstOrDefault(x => x.powerdef.defName == abilityDef.defName);

            if (abilityToRemove != null)
            {
                thelist.Remove(abilityToRemove);
            }

            this.UpdateAbilities();
        }
Example #5
0
        //        public Dictionary<PawnAbility, Verb_UseAbility> pawnAbilities = new Dictionary<PawnAbility, Verb_UseAbility>();

        /*
         * if (!this.Powers.Any(x => x.powerdef.defName == abilityDef.defName))
         * {
         *  this.Powers.Add(new PawnAbility(this.abilityUser, abilityDef));
         * }
         *
         * this.UpdateAbilities();
         */
        public void AddPawnAbility(AbilityDef abilityDef, bool activenow = true) => this.AddAbilityInternal(abilityDef, ref this.Powers, activenow); public void AddWeaponAbility(AbilityDef abilityDef, bool activenow = true) => this.AddAbilityInternal(abilityDef, ref this.temporaryWeaponPowers, activenow); public void AddApparelAbility(AbilityDef abilityDef, bool activenow = true) => this.AddAbilityInternal(abilityDef, ref this.temporaryApparelPowers, activenow); private void AddAbilityInternal(AbilityDef abilityDef, ref List <PawnAbility> thelist, bool activenow)
        {
            PawnAbility pa = new PawnAbility(this.AbilityUser, abilityDef);

            if (activenow == false)
            {
                pa.TicksUntilCasting = (int)(pa.powerdef.MainVerb.SecondsToRecharge * GenTicks.TicksPerRealSecond);
            }
            thelist.Add(pa);
            this.UpdateAbilities();
        }
        private void RemoveAbilityInternal(AbilityDef abilityDef, List <PawnAbility> thelist)
        {
            PawnAbility abilityToRemove = thelist.FirstOrDefault(x => x.Def == abilityDef);

            if (abilityToRemove != null)
            {
                thelist.Remove(abilityToRemove);
            }
            abilityToRemove = this.AbilityData.Powers.FirstOrDefault(x => x.Def == abilityDef);
            if (abilityToRemove != null)
            {
                this.AbilityData.Powers.Remove(abilityToRemove);
            }
            this.UpdateAbilities();
        }
 public Command_PawnAbility(CompAbilityUser compAbilityUser, PawnAbility ability, int ticks)
 {
     this.compAbilityUser = compAbilityUser;
     pawnAbility          = ability;
     curTicks             = ticks;
 }
 public Command_PawnAbility(CompAbilityUser compAbilityUser, PawnAbility ability)
 {
     this.compAbilityUser = compAbilityUser;
     this.pawnAbility     = ability;
 }