// Token: 0x06000003 RID: 3 RVA: 0x0000211C File Offset: 0x0000031C public static bool Prefix(Pawn_FilthTracker __instance) { var traverse = Traverse.Create(__instance); var value = traverse.Field("pawn").GetValue <Pawn>(); if (!value.Spawned || !value.RaceProps.Humanlike) { return(true); } foreach (var apparel in value.apparel.WornApparel) { if (apparel.def.defName != "Apparel_DustproofBoots") { continue; } var value2 = traverse.Field("carriedFilth").GetValue <List <Filth> >(); value2.Clear(); traverse.Field("carriedFilth").SetValue(value2); return(false); } return(true); }
static void Postfix(Pawn_FilthTracker __instance) { // A copy of the normal human-like filth generation, only with a much higher chance to generate filth. Pawn pawn = AccessTools.Field(typeof(Pawn_FilthTracker), "pawn").GetValue(__instance) as Pawn; if (pawn?.story?.traits?.HasTrait(GMT_DefOf.GMT_Slob) ?? false) { if (Rand.Value < PawnUtility.HumanFilthChancePerCell(pawn.def, pawn.BodySize) * GMT_Slob_Helper.slob_factor) { ThingDef filth_Trash; ThingDef lastTerrainFilthDef = AccessTools.Field(typeof(Pawn_FilthTracker), "lastTerrainFilthDef").GetValue(__instance) as ThingDef; if (lastTerrainFilthDef != null && Rand.Chance(0.66f)) { filth_Trash = lastTerrainFilthDef; } else { filth_Trash = ThingDefOf.Filth_Trash; } if (FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, filth_Trash, 1, (FilthSourceFlags)AccessTools.Method(typeof(Pawn_FilthTracker), "get_AdditionalFilthSourceFlags").Invoke(__instance, null))) { AccessTools.TypeByName("RimWorld.FilthMonitor").GetMethod("Notify_FilthHumanGenerated").Invoke(null, null); } } } }
private void Init() { pather = new Pawn_PathFollower(this); stances = new Pawn_StanceTracker(this); health = new Pawn_HealthTracker(this); jobs = new Pawn_JobTracker(this); filth = new Pawn_FilthTracker(this); }
// Token: 0x06000006 RID: 6 RVA: 0x00002624 File Offset: 0x00000824 private static void Postfix(Pawn_FilthTracker __instance, Pawn ___pawn) { if (___pawn == null) { return; } List <Thing> thingList = ___pawn.Position.GetThingList(___pawn.Map); for (int i = thingList.Count - 1; i >= 0; i--) { Filth filth = thingList[i] as Filth; if (filth != null && !(filth.def == RGDefOf.RG_Filth_Water)) { __instance.GainFilth(RGDefOf.RG_Filth_WaterSpatter, filth.sources); filth.ThinFilth(); } } }
// Token: 0x06000006 RID: 6 RVA: 0x00002624 File Offset: 0x00000824 private static void Postfix(Pawn_FilthTracker __instance) { Pawn pawn = HarmonyPatches.PawnFieldInfo_FilthTracker.GetValue(__instance) as Pawn; if (pawn == null) { return; } List <Thing> thingList = pawn.Position.GetThingList(pawn.Map); for (int i = thingList.Count - 1; i >= 0; i--) { Filth filth = thingList[i] as Filth; if (filth != null && !(filth.def.defName != "FilthWater")) { __instance.GainFilth(ThingDef.Named("FilthWaterSpatter"), filth.sources); filth.ThinFilth(); } } }
// Token: 0x06000002 RID: 2 RVA: 0x00002068 File Offset: 0x00000268 public static bool Prefix(Pawn_FilthTracker __instance) { var traverse = Traverse.Create(__instance); var value = traverse.Field("pawn").GetValue <Pawn>(); if (!value.Spawned || !value.RaceProps.Humanlike) { return(true); } foreach (var apparel in value.apparel.WornApparel) { if (apparel.def.defName == "Apparel_DustproofBoots") { return(false); } } return(true); }