// Token: 0x06000061 RID: 97 RVA: 0x00005EB0 File Offset: 0x000040B0
        public static void DoMSCondom(Pawn p, ThingDef t)
        {
            HediffDef named = DefDatabase <HediffDef> .GetNamed("MSCondom_High", false);

            float SeverityToApply = 0.5f;

            MSHediffEffecter.HediffEffect(named, SeverityToApply, p, null, out _);
        }
        // Token: 0x0600005A RID: 90 RVA: 0x00005ACC File Offset: 0x00003CCC
        public static void DoMSBattleStim(Pawn p, ThingDef t)
        {
            var named = DefDatabase <HediffDef> .GetNamed("MSBattleStim_High", false);

            var SeverityToApply = 0.5f;

            MSHediffEffecter.HediffEffect(named, SeverityToApply, p, null, out _);
        }
 // Token: 0x0600005B RID: 91 RVA: 0x00005AF8 File Offset: 0x00003CF8
 public static void ChkMSBattleStim(Pawn p, out string Reason, out bool Passed)
 {
     Reason = null;
     if (!p.RaceProps.Humanlike)
     {
         Passed = false;
         Reason = "MSExotic.NotHumanLike".Translate(p?.LabelShort.CapitalizeFirst());
         return;
     }
     if (MSHediffEffecter.HasHediff(p, DefDatabase <HediffDef> .GetNamed("MSBattleStim_High", true)))
     {
         Passed = false;
         Reason = "MSExoctic.AlreadyStimmed".Translate(p?.LabelShort.CapitalizeFirst());
         return;
     }
     Passed = true;
 }
示例#4
0
        public static void PostFix(ref Job __result, Pawn pawn)
        {
            if (__result != null && !MSHediffEffecter.HasHediff(pawn, DefDatabase <HediffDef> .GetNamed("MSCondom_High", false)))
            {
                JobDef CondomJobDef = DefDatabase <JobDef> .GetNamed("MSWearCondom", true);

                if (CondomJobDef != null)
                {
                    Pawn pawn2 = pawn;
                    if ((pawn2?.Map) != null && pawn.Spawned)
                    {
                        ThingDef CondomDef = DefDatabase <ThingDef> .GetNamed("MSCondom", false);

                        if (CondomDef != null)
                        {
                            TraverseParms     TravParms = TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.None, false);
                            Predicate <Thing> validator = delegate(Thing t)
                            {
                                Pawn pawn3 = pawn;
                                if ((pawn3?.GetRoom(RegionType.Set_Passable)) != null)
                                {
                                    Pawn pawn4 = pawn;
                                    if ((pawn4?.GetRoom(RegionType.Set_Passable)) == (t?.GetRoom(RegionType.Set_Passable)))
                                    {
                                        return(true);
                                    }
                                }
                                return(false);
                            };
                            Thing Condom = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(CondomDef), PathEndMode.ClosestTouch, TravParms, 20f, validator, null, 0, -1, false, RegionType.Set_Passable, false);
                            if (Condom != null)
                            {
                                Job JobCondom = new Job(CondomJobDef, Condom);
                                __result = JobCondom;
                            }
                        }
                    }
                }
            }
        }
示例#5
0
 // Token: 0x06000064 RID: 100 RVA: 0x00005F24 File Offset: 0x00004124
 internal static bool HediffEffect(HediffDef hediffdef, float SeverityToApply, Pawn pawn, BodyPartRecord part, out bool immune)
 {
     immune = false;
     if (!pawn.RaceProps.IsMechanoid && hediffdef != null)
     {
         if (!MSHediffEffecter.ImmuneTo(pawn, hediffdef))
         {
             if (!pawn.health.WouldDieAfterAddingHediff(hediffdef, part, SeverityToApply))
             {
                 Pawn_HealthTracker health = pawn.health;
                 Hediff             hediff;
                 if (health == null)
                 {
                     hediff = null;
                 }
                 else
                 {
                     HediffSet hediffSet = health.hediffSet;
                     hediff = (hediffSet?.GetFirstHediffOfDef(hediffdef, false));
                 }
                 Hediff hashediff = hediff;
                 if (hashediff != null)
                 {
                     hashediff.Severity += SeverityToApply;
                     return(true);
                 }
                 Hediff addhediff = HediffMaker.MakeHediff(hediffdef, pawn, part);
                 addhediff.Severity = SeverityToApply;
                 pawn.health.AddHediff(addhediff, part, null, null);
                 return(true);
             }
         }
         else
         {
             immune = true;
         }
     }
     return(false);
 }
        public static void PostFix(ref Job __result, Pawn pawn)
        {
            if (__result == null ||
                MSHediffEffecter.HasHediff(pawn, DefDatabase <HediffDef> .GetNamed("MSCondom_High", false)))
            {
                return;
            }

            var CondomJobDef = DefDatabase <JobDef> .GetNamed("MSWearCondom");

            if (CondomJobDef == null)
            {
                return;
            }

            var pawn2 = pawn;

            if (pawn2?.Map == null || !pawn.Spawned)
            {
                return;
            }

            var CondomDef = DefDatabase <ThingDef> .GetNamed("MSCondom", false);

            if (CondomDef == null)
            {
                return;
            }

            var TravParms = TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.None);

            bool Validator(Thing t)
            {
                var pawn3 = pawn;

                if (pawn3.GetRoom() == null)
                {
                    return(false);
                }

                var pawn4 = pawn;

                if (pawn4.GetRoom() == t?.GetRoom())
                {
                    return(true);
                }

                return(false);
            }

            var Condom = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map,
                                                          ThingRequest.ForDef(CondomDef), PathEndMode.ClosestTouch, TravParms, 20f, Validator);

            if (Condom == null)
            {
                return;
            }

            var JobCondom = new Job(CondomJobDef, Condom);

            __result = JobCondom;
        }