// Token: 0x06000048 RID: 72 RVA: 0x00002EFC File Offset: 0x000010FC public bool FindFilth() { bool flag = this.currentFilth != null; bool result; if (flag) { result = true; } else { Filth filth = (Filth)this.parent.Position.GetThingList(this.parent.Map).Find((Thing f) => f is Filth); bool flag2 = filth != null; if (flag2) { this.currentFilth = filth; result = true; } else { result = false; } } return(result); }
public override void Print(SectionLayer layer, Thing thing) { Vector3 a = thing.TrueCenter(); Rand.PushState(); Rand.Seed = thing.Position.GetHashCode(); Filth filth = thing as Filth; int num; if (filth == null) { num = 3; } else { num = filth.thickness; } for (int i = 0; i < num; i++) { Material matSingle = this.MatSingle; Vector3 center = a + new Vector3(Rand.Range(-0.45f, 0.45f), 0f, Rand.Range(-0.45f, 0.45f)); Vector2 size = new Vector2(Rand.Range(0.8f, 1.2f), Rand.Range(0.8f, 1.2f)); float rot = (float)Rand.RangeInclusive(0, 360); bool flipUv = Rand.Value < 0.5f; Printer_Plane.PrintPlane(layer, center, size, matSingle, rot, flipUv, null, null, 0.01f, 0f); } Rand.PopState(); }
private static Thing LoadRockRubble(Map map, BinaryReader reader, IntVec3 cell) { ushort defId = reader.ReadUInt16(); if (defId == 0) { return(null); } int id = reader.ReadInt32(); byte thickness = reader.ReadByte(); int growTick = reader.ReadInt32(); ThingDef def = thingDefsByShortHash[defId]; Filth thing = (Filth)Activator.CreateInstance(def.thingClass); thing.def = def; thing.thingIDNumber = id; thing.thickness = thickness; thing.growTick = growTick; thing.SetPositionDirect(cell); return(thing); }
public override bool HasJobOnThing(Pawn pawn, Thing t) { Filth filth = t as Filth; return(filth != null && (OG_Util.FindOutpostArea() != null) && OG_Util.FindOutpostArea().ActiveCells.Contains(t.Position) && pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1) && filth.TicksSinceThickened >= this.MinTicksSinceThickened); }
public static bool HasJobOnThing(ref bool __result, Pawn pawn, Thing t, bool forced = false) { Filth filth = t as Filth; if (filth?.Map?.areaManager?.Home != null && pawn != null) { __result = filth.Map.areaManager.Home[filth.Position] && pawn.CanReserve(t, 1, -1, null, forced) && filth.TicksSinceThickened >= MinTicksSinceThickened; } return(false); }
public bool HasJobOnThing(Pawn pawn, Thing t) { if (pawn.Faction != Faction.OfColony) { return(false); } Filth filth = t as Filth; return(filth != null && Find.AreaHome[filth.Position] && pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1) && filth.TicksSinceThickened >= this.MinTicksSinceThickened); }
public bool FilthIsInCleaningArea(Filth filth) { for (int i = 0; i < priorityList.Count; i++) { if (priorityList[i][filth.Position]) { return(true); } } return(false); }
public void Notify_PawnApproaching(Pawn pawn) { List <Filth> carriedFilth = (List <Filth>)carriedFilthList.GetValue(pawn.filth); if (!carriedFilth.NullOrEmpty()) { Filth filth = carriedFilth.RandomElement(); FilthMaker.TryMakeFilth(Position, Map, filth.def, filth.sources); carriedFilthList.SetValue(pawn.filth, new List <Filth>()); } }
private bool TryAddCarriedFilth(Filth filth) { var totalFilth = CarriedFilth.Sum(f => f.thickness); if (totalFilth + filth.thickness <= MaxFilth) { CarriedFilth.Add(filth); return(true); } return(false); }
public bool FilthIsInCleaningArea(Filth filth) { foreach (var area in priorityList) { if (area[filth.Position]) { return(true); } } return(false); }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { Filth filth = t as Filth; if (pawn.Faction == Faction.OfPlayer && filth != null && (pawn.Map.GetCleaningManager().FilthIsInPriorityAreaSafe(filth) || (forced && pawn.Map.GetCleaningManager().FilthIsInCleaningArea(filth)))) { LocalTargetInfo target = t; return(pawn.CanReserve(target, 1, -1, null, forced) && filth.TicksSinceThickened >= MinTicksSinceThickened); } return(false); }
protected override IEnumerable <Toil> MakeNewToils() { Toil initExtractTargetFromQueue = Toils_JobTransforms.ClearDespawnedNullOrForbiddenQueuedTargets(TargetIndex.A, null); yield return(initExtractTargetFromQueue); yield return(Toils_JobTransforms.SucceedOnNoTargetInQueue(TargetIndex.A)); yield return(Toils_JobTransforms.ExtractNextTargetFromQueue(TargetIndex.A, true)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).JumpIfDespawnedOrNullOrForbidden(TargetIndex.A, initExtractTargetFromQueue)); Toil clean = new Toil { initAction = delegate() { cleaningWorkDone = 0f; totalCleaningWorkDone = 0f; totalCleaningWorkRequired = Filth.def.filth.cleaningWorkToReduceThickness * Filth.thickness; } }; clean.tickAction = delegate() { Filth filth = Filth; cleaningWorkDone += 1f; totalCleaningWorkDone += 1f; if (cleaningWorkDone > filth.def.filth.cleaningWorkToReduceThickness) { filth.ThinFilth(); cleaningWorkDone = 0f; if (filth.Destroyed) { clean.actor.records.Increment(RecordDefOf.MessesCleaned); ReadyForNextToil(); return; } } }; clean.defaultCompleteMode = ToilCompleteMode.Never; clean.WithEffect(EffecterDefOf.Clean, TargetIndex.A); clean.WithProgressBar(TargetIndex.A, () => totalCleaningWorkDone / totalCleaningWorkRequired, true, -0.5f); clean.PlaySustainerOrSound(() => SoundDefOf.Interact_CleanFilth); clean.JumpIfDespawnedOrNullOrForbidden(TargetIndex.A, initExtractTargetFromQueue); yield return(clean); yield return(Toils_Jump.Jump(initExtractTargetFromQueue)); yield break; }
public void OnFilthDespawned(Filth despawned) { foreach (Area area in filthDictionary.Keys.ToList()) { if (area is Area_Home) { filthDictionary[area] = map.listerFilthInHomeArea.FilthInHomeArea; } else { filthDictionary[area].Remove(despawned); } } }
public void OnFilthSpawned(Filth spawned) { foreach (Area area in filthDictionary.Keys.ToList()) { if (area is Area_Home) { filthDictionary[area] = map.listerFilthInHomeArea.FilthInHomeArea; } else if (area[spawned.Position]) { filthDictionary[area].Add(spawned); } } }
public static void Postfix(ref Filth __instance, ref bool __result, ref IntVec3 c, ref Map map) { if (__result) { return; } BuildableDef buildableDef = map.terrainGrid.TerrainAt(c); var chkfilth = __instance; if (buildableDef.fertility > 0f && IsGGFilth(chkfilth)) { __result = true; } }
private void CleanTile(Filth filth) { filth.ThinFilth(); if (filth.thickness > 0 && TryAddCarriedFilth(filth)) { filth.Destroy(); } _degradationToAdd += DegradationPerClean; if (_degradationToAdd >= 1) { HitPoints -= 1; _degradationToAdd -= 1; } }
public bool FindFilth() { if (currentFilth != null) { return(true); } var filth = (Filth)parent.Position.GetThingList(parent.Map).Find(f => f is Filth); if (filth != null) { currentFilth = filth; return(true); } return(false); }
private static void SaveRockRubble(Map map, BinaryWriter writer, IntVec3 cell) { Filth thing = (Filth)map.thingGrid.ThingsListAt(cell).Find(IsSaveRockRubble); if (thing != null) { writer.Write(thing.def.shortHash); writer.Write(thing.thingIDNumber); writer.Write((byte)thing.thickness); writer.Write(thing.growTick); } else { writer.Write((ushort)0); } }
// Token: 0x06004C58 RID: 19544 RVA: 0x001987D8 File Offset: 0x001969D8 private static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable <string> sources, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None) { Filth filth = (Filth)(from t in c.GetThingList(map) where t.def == filthDef select t).FirstOrDefault <Thing>(); if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened)) { if (shouldPropagate) { List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized(); for (int i = 0; i < 8; i++) { IntVec3 c2 = c + list[i]; if (c2.InBounds(map) && AvP_Pawn_HealthTracker_DropBloodFilth_Xenoblood_Patch.TryMakeFilth(c2, map, filthDef, sources, false, FilthSourceFlags.None)) { return(true); } } } if (filth != null) { filth.AddSources(sources); } return(false); } if (filth != null) { filth.ThickenFilth(); filth.AddSources(sources); } else { if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags)) { return(false); } Filth filth2 = (Filth)ThingMaker.MakeThing(filthDef, null); filth2.AddSources(sources); Filth_AddAcidDamage filth_ = filth2 as Filth_AddAcidDamage; filth_.destroyTick = 600; GenSpawn.Spawn(filth2, c, map, WipeMode.Vanish); } // FilthMonitor.Notify_FilthSpawned(); return(true); }
public static Toil makeCleanToil(TargetIndex progListIndex, TargetIndex filthListIndex, Toil nextTarget) { Toil toil = new Toil(); toil.initAction = delegate() { Filth filth = toil.actor.jobs.curJob.GetTarget(filthListIndex).Thing as Filth; var progQue = toil.actor.jobs.curJob.GetTargetQueue(progListIndex); progQue[0] = new IntVec3(0, 0, (int)filth.def.filth.cleaningWorkToReduceThickness * filth.thickness); }; toil.tickAction = delegate() { Filth filth = toil.actor.jobs.curJob.GetTarget(filthListIndex).Thing as Filth; var progQue = toil.actor.jobs.curJob.GetTargetQueue(progListIndex); IntVec3 iv = progQue[0].Cell; iv.x += 1; iv.y += 1; if (iv.x > filth.def.filth.cleaningWorkToReduceThickness) { filth.ThinFilth(); iv.x = 0; if (filth.Destroyed) { toil.actor.records.Increment(RecordDefOf.MessesCleaned); toil.actor.jobs.curDriver.ReadyForNextToil(); return; } } progQue[0] = iv; }; toil.defaultCompleteMode = ToilCompleteMode.Never; toil.WithEffect(EffecterDefOf.Clean, filthListIndex); toil.WithProgressBar(filthListIndex, delegate() { var q = toil.actor.CurJob.GetTargetQueue(progListIndex)[0]; float result = (float)q.Cell.y / q.Cell.z; return(result); } , true, -0.5f); toil.PlaySustainerOrSound(() => SoundDefOf.Interact_CleanFilth); toil.JumpIfDespawnedOrNullOrForbidden(filthListIndex, nextTarget); toil.JumpIfOutsideHomeArea(filthListIndex, nextTarget); toil.FailOnDestroyedOrNull(TargetIndex.A); return(toil); }
public static bool CleanFilthPrefix(JobDriver_CleanFilth __instance) { if (!Settings.RainCleanWaterPuddles) { foreach (LocalTargetInfo localTargetInfo in __instance.job.targetQueueA) { Thing thing = localTargetInfo.Thing; Filth filth = thing as Filth; if (filth != null && (filth.def.defName == "FilthWater" || filth.def.defName == "FilthWaterSpatter") && thing.GetRoom(RegionType.Set_Passable).UsesOutdoorTemperature&& !thing.Map.roofGrid.Roofed(thing.Position)) { return(false); } } return(true); } return(true); }
public void FinishClean() { if (currentFilth == null) { Log.Warning("Cannot finish clean for filth because there is no filth selected. Canceling."); return; } currentFilth.ThinFilth(); if (currentFilth.Destroyed) { currentFilth = null; } else { cleanProgress = float.NaN; } }
// 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(); } } }
protected static bool IsValidFilth(Pawn pawn, Thing t) { if (pawn.Faction != Faction.OfPlayer) { return(false); } Filth filth = t as Filth; if (filth == null) { return(false); } if (!filth.Map.areaManager.Home[filth.Position]) { return(false); } LocalTargetInfo target = t; return(pawn.CanReserve(target, 1, -1, null, true) && filth.TicksSinceThickened >= 600); }
// 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: 0x06000003 RID: 3 RVA: 0x000021D8 File Offset: 0x000003D8 private void DoCaltropBurst(Pawn p, string mode, Filth caltrop) { if (caltrop == null || caltrop.Map == null) { return; } var pos = caltrop.Position; var map = caltrop.Map; var radius = 1.9f; var dmgdef = DamageDefOf.Smoke; var dmg = 0; var postTD = ThingDefOf.Gas_Smoke; var postChance = 1f; var postNum = 1; ThingDef preTD = null; var preChance = 0f; var preNum = 0; var fireChance = 0f; if (mode != "TM" && p is { Map : { } })
public IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency) { butcher.skills.Learn(SkillDefOf.Cooking, LearnRates.XpPerPawnSizeButchered * sourcePawn.def.race.bodySize); { Filth blood = (Filth)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("FilthBlood")); blood.sources.Add(sourcePawn.Label); GenPlace.TryPlaceThing(blood, butcher.Position, ThingPlaceMode.Near); } if (sourcePawn.RaceDef.humanoid) { butcher.psychology.thoughts.GainThought(ThoughtDef.Named("ButcheredHumanoidCorpse")); } { Thing meat = ThingMaker.MakeThing(sourcePawn.def.race.meatDef); meat.stackCount = Mathf.RoundToInt(BaseButcherProductAmount * sourcePawn.def.race.bodySize * efficiency); yield return(meat); } }
public bool HasJobOnThing(Pawn pawn, Thing t) { Filth filth = t as Filth; if (filth == null) { return(false); } if (!filth.Map.areaManager.Home[filth.Position]) { return(false); } if (!pawn.CanReserve(t, 1, -1, null)) { return(false); } if (filth.TicksSinceThickened < MinTicksSinceThickened) { return(false); } return(true); }
public static void Vomit(Map map) { var vomitDef = ThingDef.Named("DropPodIncoming"); vomitDef.label = "vomit (incoming)"; vomitDef.graphicData.texPath = "Things/Filth/PoolSoft"; var vomit = new Filth(); vomit.def = ThingDefOf.Filth_Vomit; IntVec3 intVec; if (!GetRandomVec3(vomitDef, map, out intVec)) { return; } SkyfallerMaker.SpawnSkyfaller(vomitDef, new List <Thing> { vomit }, intVec, map); }
public void Notify_PawnApproaching(Pawn pawn) { if (!pawn.IsPrisonerOfColony && (pawn.Faction == null || pawn.Faction.HostileTo(Faction.OfPlayer))) { return; } if (pawn.Drafted || pawn.health.hediffSet.BleedRateTotal > 0.01) { return; } if (pawn.CurJob != null && (pawn.CurJobDef == JobDefOf.Flee || pawn.CurJobDef == JobDefOf.FleeAndCower || pawn.CurJobDef == JobDefOf.TendPatient || pawn.CurJobDef.driverClass == typeof(JobDriver_TakeToBed))) { return; } List <Filth> carriedFilth = (List <Filth>)carriedFilthList.GetValue(pawn.filth); if (!carriedFilth.NullOrEmpty()) { Filth filth = carriedFilth.RandomElement(); FilthMaker.TryMakeFilth(Position, Map, filth.def, filth.sources); carriedFilthList.SetValue(pawn.filth, new List <Filth>()); } }