コード例 #1
0
        protected virtual float SpringChance(Pawn p)
        {
            float num;

            if (this.KnowsOfTrap(p))
            {
                num = 0.004f;
                if (!BetaTrapsSettings.getFriendlyFireSettingValue())
                {
                    num = 0f;
                }
            }
            else
            {
                num = this.GetStatValue(StatDefOf.TrapSpringChance, true);
            }

            if (!BetaTrapsSettings.getUseBodySizeValue())
            {
                num *= GenMath.LerpDouble(0.4f, 0.8f, 0f, 1f, 1f);
            }
            else
            {
                num *= GenMath.LerpDouble(0.4f, 0.8f, 0f, 1f, p.BodySize);
            }

            if (BetaTrapsSettings.getAnimalSpringSettingValue())
            {
                if (p.RaceProps.Animal)
                {
                    num *= 0.1f;
                }
            }
            return(Mathf.Clamp01(num));
        }
コード例 #2
0
 public override ushort PathWalkCostFor(Pawn p)
 {
     if (!this.Armed)
     {
         return(0);
     }
     if (this.KnowsOfTrap(p))
     {
         if (BetaTrapsSettings.getSuperSlowTraps())
         {
             return(300);
         }
         return(30);
     }
     return(0);
 }
コード例 #3
0
        public bool KnowsOfTrap(Pawn p)
        {
            if (p.Faction != null && !p.Faction.HostileTo(base.Faction))
            {
                return(true);
            }
            if (p.Faction == null && p.RaceProps.Animal && !p.InAggroMentalState)
            {
                if (BetaTrapsSettings.getWildAnimalsCanTripValue())
                {
                    return(false);
                }
                return(true);
            }
            if (p.guest != null && p.guest.Released)
            {
                return(true);
            }
            Lord lord = p.GetLord();

            return(p.RaceProps.Humanlike && lord != null && lord.LordJob is LordJob_FormAndSendCaravan);
        }