예제 #1
0
        public static void Postfix(Pawn __instance, DamageInfo?dinfo, Hediff exactCulprit)
        {
            if (dinfo.HasValue)
            {
                if (dinfo.Value.Instigator != null)
                {
                    Thing         inst      = dinfo.Value.Instigator;
                    DessicatorExt desicator = inst.def.GetModExtension <DessicatorExt>();
                    if (desicator != null)
                    {
                        if (desicator.desicatedDef != null)
                        {
                            FieldInfo corpse = typeof(Pawn).GetField("Corpse", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
                            Traverse.Create(__instance);
                            corpse.SetValue(__instance, ThingMaker.MakeThing(desicator.desicatedDef));
                        }
                        else
                        {
                            CompRottable compRottable = __instance.Corpse.TryGetComp <CompRottable>();
                            compRottable.RotImmediately();
                        }
                    }
                }
            }
            HediffDef def = DefDatabase <HediffDef> .GetNamed("RT_HuskTouch");

            if (__instance.health.hediffSet.HasHediff(def))
            {
                //    Log.Message("husktouch present");
                CompRottable compRottable = __instance.Corpse.TryGetComp <CompRottable>();
                compRottable.RotImmediately();
            }
        }
        public override void Notify_PawnDied()
        {
            CompRottable comp = this.parent.pawn.Corpse.GetComp <CompRottable>();

            if (comp != null)
            {
                if (!GeneticRim_Mod.settings.GR_DisableGreaterScariaRotting)
                {
                    comp.RotImmediately();
                }
                else
                {
                    if (Rand.Chance(Find.Storyteller.difficulty.scariaRotChance))
                    {
                        comp.RotImmediately();
                    }
                }
            }
        }
        public static IEnumerable <Thing> Postfix(IEnumerable <Thing> entries, Corpse __instance, Pawn butcher)
        {
            RotStage stage = __instance.GetRotStage();

            foreach (Thing entry in entries)
            {
                if (stage != RotStage.Fresh)
                {
                    CompRottable comp = entry.TryGetComp <CompRottable>();

                    if (entry.GetStatValue(StatDefOf.DeteriorationRate) > 0.5)
                    {
                        entry.Destroy();
                        continue;
                    }
                    else if (comp != null)
                    {
                        if ((stage == RotStage.Dessicated) || comp.PropsRot.rotDestroys)
                        {
                            entry.Destroy();
                            continue;
                        }
                        else
                        {
                            comp.RotImmediately();
                        }
                    }
                }
                yield return(entry);
            }

            if (stage == RotStage.Rotting)
            {
                butcher.needs.mood.thoughts.memories.TryGainMemory(MyDefOf.LuluButcherRotten_ButcheredRotten);
                FilthMaker.TryMakeFilth(butcher.Position, butcher.Map, ThingDefOf.Filth_CorpseBile, __instance.InnerPawn.LabelIndefinite());
            }
        }