public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency) { using (IEnumerator <Thing> enumerator = InnerPawn.ButcherProducts(butcher, efficiency).GetEnumerator()) { if (enumerator.MoveNext()) { Thing t = enumerator.Current; yield return(t); /*Error: Unable to find new state assignment for yield return*/; } } if (InnerPawn.RaceProps.BloodDef != null) { FilthMaker.MakeFilth(butcher.Position, butcher.Map, InnerPawn.RaceProps.BloodDef, InnerPawn.LabelIndefinite()); } if (InnerPawn.RaceProps.Humanlike) { butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse); foreach (Pawn item in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction)) { if (item != butcher && item.needs != null && item.needs.mood != null && item.needs.mood.thoughts != null) { item.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse); } } TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, butcher); } yield break; IL_0232: /*Error near IL_0233: Unexpected return in MoveNext()*/; }
public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency) { foreach (var t in InnerPawn.ButcherProducts(butcher, efficiency)) { yield return(t); } //Spread blood if (InnerPawn.RaceProps.BloodDef != null) { FilthMaker.MakeFilth(butcher.Position, butcher.Map, InnerPawn.RaceProps.BloodDef, InnerPawn.LabelIndefinite()); } //Thought/tale for butchering humanlike if (InnerPawn.RaceProps.Humanlike) { butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse); foreach (var p in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction)) { if (p == butcher || p.needs == null || p.needs.mood == null || p.needs.mood.thoughts == null) { continue; } p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse); } TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, butcher); } }
public override void TickRare() { base.TickRare(); if (Destroyed) { return; // in case we rot away when ticking base } if (Bugged) { Log.Error(this + " has null innerPawn. Destroying."); Destroy(); return; } InnerPawn.TickRare(); // reset vanishAfterTimestamp to X days from now if not previously set, or if carcass still fresh if (vanishAfterTimestamp < 0 || this.GetRotStage() != RotStage.Dessicated) { vanishAfterTimestamp = Age + VanishAfterTicksSinceDessicated; } if (ShouldVanish) { Destroy(); } }
public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency) { foreach (Thing item in InnerPawn.ButcherProducts(butcher, efficiency)) { yield return(item); } if (InnerPawn.RaceProps.BloodDef != null) { FilthMaker.TryMakeFilth(butcher.Position, butcher.Map, InnerPawn.RaceProps.BloodDef, InnerPawn.LabelIndefinite()); } if (!InnerPawn.RaceProps.Humanlike) { yield break; } if (butcher.needs.mood != null) { butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse); } foreach (Pawn item2 in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction)) { if (item2 != butcher && item2.needs != null && item2.needs.mood != null && item2.needs.mood.thoughts != null) { item2.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse); } } TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, butcher); }
public override IEnumerable <StatDrawEntry> SpecialDisplayStats() { foreach (StatDrawEntry item in base.SpecialDisplayStats()) { yield return(item); } if (this.GetRotStage() == RotStage.Fresh) { StatDef meatAmount = StatDefOf.MeatAmount; yield return(new StatDrawEntry(meatAmount.category, meatAmount, InnerPawn.GetStatValue(meatAmount), StatRequest.For(InnerPawn))); StatDef leatherAmount = StatDefOf.LeatherAmount; yield return(new StatDrawEntry(leatherAmount.category, leatherAmount, InnerPawn.GetStatValue(leatherAmount), StatRequest.For(InnerPawn))); } }
public override IEnumerable <StatDrawEntry> SpecialDisplayStats() { using (IEnumerator <StatDrawEntry> enumerator = base.SpecialDisplayStats().GetEnumerator()) { if (enumerator.MoveNext()) { StatDrawEntry s = enumerator.Current; yield return(s); /*Error: Unable to find new state assignment for yield return*/; } } if (this.GetRotStage() == RotStage.Fresh) { StatDef meatAmount = StatDefOf.MeatAmount; yield return(new StatDrawEntry(meatAmount.category, meatAmount, InnerPawn.GetStatValue(meatAmount), StatRequest.For(InnerPawn))); /*Error: Unable to find new state assignment for yield return*/; } yield break; IL_0197: /*Error near IL_0198: Unexpected return in MoveNext()*/; }
public override void TickRare() { base.TickRare(); if (base.Destroyed) { return; } if (Bugged) { Log.Error(string.Concat(this, " has null innerPawn. Destroying.")); Destroy(); return; } InnerPawn.TickRare(); if (vanishAfterTimestamp < 0 || this.GetRotStage() != RotStage.Dessicated) { vanishAfterTimestamp = Age + 6000000; } if (ShouldVanish) { Destroy(); } }
public override void TickRare() { base.TickRare(); if (!base.Destroyed) { if (Bugged) { Log.Error(this + " has null innerPawn. Destroying."); Destroy(); } else { InnerPawn.TickRare(); if (vanishAfterTimestamp < 0 || this.GetRotStage() != RotStage.Dessicated) { vanishAfterTimestamp = Age + 6000000; } if (ShouldVanish) { Destroy(); } } } }
public Board() { for (int Row = 0; Row < 8; Row++) { for (int Col = 0; Col < 16; Col++) { board[Row, Col] = null; } } // black inner pawns for (int Row = 0; Row < 8; Row++) { board[Row, 10] = new InnerPawn('b'); } // black outer pawns for (int Row = 0; Row < 8; Row++) { board[Row, 13] = new OuterPawn('b'); } //black pieces board[0, 11] = new Rook('b'); board[0, 12] = new Rook('b'); board[7, 11] = new Rook('b'); board[7, 12] = new Rook('b'); board[1, 11] = new Knight('b'); board[1, 12] = new Knight('b'); board[6, 11] = new Knight('b'); board[6, 12] = new Knight('b'); board[2, 11] = new Bishop('b'); board[2, 12] = new Bishop('b'); board[5, 11] = new Bishop('b'); board[5, 12] = new Bishop('b'); board[3, 12] = new Queen('b'); board[4, 12] = new Queen('b'); board[3, 11] = new General('b'); board[4, 11] = new King('b'); // white inner pawns for (int Row = 0; Row < 8; Row++) { board[Row, 5] = new InnerPawn('w'); } // white outer pawns for (int Row = 0; Row < 8; Row++) { board[Row, 2] = new OuterPawn('w'); } //white pieces board[0, 3] = new Rook('w'); board[0, 4] = new Rook('w'); board[7, 3] = new Rook('w'); board[7, 4] = new Rook('w'); board[1, 3] = new Knight('w'); board[1, 4] = new Knight('w'); board[6, 3] = new Knight('w'); board[6, 4] = new Knight('w'); board[2, 3] = new Bishop('w'); board[2, 4] = new Bishop('w'); board[5, 3] = new Bishop('w'); board[5, 4] = new Bishop('w'); board[3, 3] = new Queen('w'); board[4, 3] = new Queen('w'); board[3, 4] = new General('w'); board[4, 4] = new King('w'); }
public void Strip() { InnerPawn.Strip(); }
protected override void IngestedCalculateAmounts(Pawn ingester, float nutritionWanted, out int numTaken, out float nutritionIngested) { BodyPartRecord bodyPartRecord = GetBestBodyPartToEat(ingester, nutritionWanted); if (bodyPartRecord == null) { Log.Error(ingester + " ate " + this + " but no body part was found. Replacing with core part."); bodyPartRecord = InnerPawn.RaceProps.body.corePart; } float bodyPartNutrition = FoodUtility.GetBodyPartNutrition(this, bodyPartRecord); if (bodyPartRecord == InnerPawn.RaceProps.body.corePart) { if (PawnUtility.ShouldSendNotificationAbout(InnerPawn) && InnerPawn.RaceProps.Humanlike) { Messages.Message("MessageEatenByPredator".Translate(InnerPawn.LabelShort, ingester.Named("PREDATOR"), InnerPawn.Named("EATEN")).CapitalizeFirst(), ingester, MessageTypeDefOf.NegativeEvent); } numTaken = 1; } else { Hediff_MissingPart hediff_MissingPart = (Hediff_MissingPart)HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, InnerPawn, bodyPartRecord); hediff_MissingPart.lastInjury = HediffDefOf.Bite; hediff_MissingPart.IsFresh = true; InnerPawn.health.AddHediff(hediff_MissingPart); numTaken = 0; } nutritionIngested = bodyPartNutrition; }
public bool AnythingToStrip() { return(InnerPawn.AnythingToStrip()); }
protected override void IngestedCalculateAmounts(Pawn ingester, float nutritionWanted, out int numTaken, out float nutritionIngested) { //Determine part to take var part = GetBestBodyPartToEat(ingester, nutritionWanted); if (part == null) { Log.Error(ingester + " ate " + this + " but no body part was found. Replacing with core part."); part = InnerPawn.RaceProps.body.corePart; } //Determine the nutrition to gain float nut = FoodUtility.GetBodyPartNutrition(this, part); //Affect this thing //If ate core part, remove the whole corpse //Otherwise, remove the eaten body part if (part == InnerPawn.RaceProps.body.corePart) { if (PawnUtility.ShouldSendNotificationAbout(InnerPawn) && InnerPawn.RaceProps.Humanlike) { Messages.Message("MessageEatenByPredator".Translate(InnerPawn.LabelShort, ingester.Named("PREDATOR"), InnerPawn.Named("EATEN")).CapitalizeFirst(), ingester, MessageTypeDefOf.NegativeEvent); } numTaken = 1; } else { var missing = (Hediff_MissingPart)HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, InnerPawn, part); missing.lastInjury = HediffDefOf.Bite; missing.IsFresh = true; InnerPawn.health.AddHediff(missing); numTaken = 0; } nutritionIngested = nut; }