Esempio n. 1
0
        public IEnumerable <Gizmo> GetGizmos()
        {
            if (PawnAttackGizmoUtility.CanShowEquipmentGizmos())
            {
                List <ThingWithComps> list = this.AllEquipmentListForReading;
                for (int i = 0; i < list.Count; i++)
                {
                    ThingWithComps eq = list[i];
                    using (IEnumerator <Command> enumerator = eq.GetComp <CompEquippable>().GetVerbsCommands().GetEnumerator())
                    {
                        if (enumerator.MoveNext())
                        {
                            Command command = enumerator.Current;
                            switch (i)
                            {
                            case 0:
                                command.hotKey = KeyBindingDefOf.Misc1;
                                break;

                            case 1:
                                command.hotKey = KeyBindingDefOf.Misc2;
                                break;

                            case 2:
                                command.hotKey = KeyBindingDefOf.Misc3;
                                break;
                            }
                            yield return((Gizmo)command);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                }
            }
            yield break;
IL_0187:
            /*Error near IL_0188: Unexpected return in MoveNext()*/;
        }
Esempio n. 2
0
 public bool TryDropEquipment(ThingWithComps eq, out ThingWithComps resultingEq, IntVec3 pos, bool forbid = true)
 {
     if (!pos.IsValid)
     {
         Log.Error(string.Concat(new object[]
         {
             this.pawn,
             " tried to drop ",
             eq,
             " at invalid cell."
         }));
         resultingEq = null;
         return(false);
     }
     if (this.equipment.TryDrop(eq, pos, this.pawn.MapHeld, ThingPlaceMode.Near, out resultingEq, null))
     {
         if (resultingEq != null)
         {
             resultingEq.SetForbidden(forbid, false);
         }
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 public void Notify_EquipmentRemoved(ThingWithComps eq)
 {
     eq.GetComp <CompEquippable>().Notify_EquipmentLost();
 }
Esempio n. 4
0
 public bool TryTransferEquipmentToContainer(ThingWithComps eq, ThingOwner container)
 {
     return(this.equipment.TryTransferToContainer(eq, container, true));
 }
Esempio n. 5
0
 public void Remove(ThingWithComps eq)
 {
     this.equipment.Remove(eq);
 }
Esempio n. 6
0
        public static ThingOwner TryGetInnerInteractableThingOwner(this Thing thing)
        {
            IThingHolder   thingHolder    = thing as IThingHolder;
            ThingWithComps thingWithComps = thing as ThingWithComps;

            if (thingHolder != null)
            {
                ThingOwner directlyHeldThings = thingHolder.GetDirectlyHeldThings();
                if (directlyHeldThings != null)
                {
                    return(directlyHeldThings);
                }
            }
            if (thingWithComps != null)
            {
                List <ThingComp> allComps = thingWithComps.AllComps;
                for (int i = 0; i < allComps.Count; i++)
                {
                    IThingHolder thingHolder2 = allComps[i] as IThingHolder;
                    if (thingHolder2 != null)
                    {
                        ThingOwner directlyHeldThings2 = thingHolder2.GetDirectlyHeldThings();
                        if (directlyHeldThings2 != null)
                        {
                            return(directlyHeldThings2);
                        }
                    }
                }
            }
            ThingOwnerUtility.tmpHolders.Clear();
            if (thingHolder != null)
            {
                thingHolder.GetChildHolders(ThingOwnerUtility.tmpHolders);
                if (ThingOwnerUtility.tmpHolders.Any <IThingHolder>())
                {
                    ThingOwner directlyHeldThings3 = ThingOwnerUtility.tmpHolders[0].GetDirectlyHeldThings();
                    if (directlyHeldThings3 != null)
                    {
                        return(directlyHeldThings3);
                    }
                }
            }
            if (thingWithComps != null)
            {
                List <ThingComp> allComps2 = thingWithComps.AllComps;
                for (int j = 0; j < allComps2.Count; j++)
                {
                    IThingHolder thingHolder3 = allComps2[j] as IThingHolder;
                    if (thingHolder3 != null)
                    {
                        thingHolder3.GetChildHolders(ThingOwnerUtility.tmpHolders);
                        if (ThingOwnerUtility.tmpHolders.Any <IThingHolder>())
                        {
                            ThingOwner directlyHeldThings4 = ThingOwnerUtility.tmpHolders[0].GetDirectlyHeldThings();
                            if (directlyHeldThings4 != null)
                            {
                                return(directlyHeldThings4);
                            }
                        }
                    }
                }
            }
            ThingOwnerUtility.tmpHolders.Clear();
            return(null);
        }
Esempio n. 7
0
        public override void PostExposeData(object obj)
        {
            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                int num = VersionControl.BuildFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion);
                Pawn_RoyaltyTracker pawn_RoyaltyTracker;
                if ((pawn_RoyaltyTracker = obj as Pawn_RoyaltyTracker) != null && num <= 2575)
                {
                    foreach (RoyalTitle item in pawn_RoyaltyTracker.AllTitlesForReading)
                    {
                        item.conceited = RoyalTitleUtility.ShouldBecomeConceitedOnNewTitle(pawn_RoyaltyTracker.pawn);
                    }
                }
                Pawn_NeedsTracker pawn_NeedsTracker;
                if ((pawn_NeedsTracker = obj as Pawn_NeedsTracker) != null)
                {
                    pawn_NeedsTracker.AllNeeds.RemoveAll((Need n) => n.def.defName == "Authority");
                }
            }
            Pawn pawn;
            Map  map;

            if ((pawn = obj as Pawn) != null)
            {
                if (pawn.abilities == null)
                {
                    pawn.abilities = new Pawn_AbilityTracker(pawn);
                }
                if (pawn.health != null)
                {
                    if (pawn.health.hediffSet.hediffs.RemoveAll((Hediff x) => x == null) != 0)
                    {
                        Log.Error(pawn.ToStringSafe() + " had some null hediffs.");
                    }
                    Hediff hediff = pawn.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf.PsychicHangover);
                    if (hediff != null)
                    {
                        pawn.health.hediffSet.hediffs.Remove(hediff);
                    }
                    Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.WakeUpTolerance);
                    if (firstHediffOfDef != null)
                    {
                        pawn.health.hediffSet.hediffs.Remove(firstHediffOfDef);
                    }
                    Hediff firstHediffOfDef2 = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.GoJuiceTolerance);
                    if (firstHediffOfDef2 != null)
                    {
                        pawn.health.hediffSet.hediffs.Remove(firstHediffOfDef2);
                    }
                }
                if (pawn.equipment == null || pawn.apparel == null || pawn.inventory == null)
                {
                    return;
                }
                List <ThingWithComps> list = null;
                for (int i = 0; i < pawn.equipment.AllEquipmentListForReading.Count; i++)
                {
                    ThingWithComps thingWithComps = pawn.equipment.AllEquipmentListForReading[i];
                    if (thingWithComps.def.defName == "OrbitalTargeterBombardment" || thingWithComps.def.defName == "OrbitalTargeterPowerBeam" || thingWithComps.def.defName == "OrbitalTargeterMechCluster" || thingWithComps.def.defName == "TornadoGenerator")
                    {
                        list = list ?? new List <ThingWithComps>();
                        list.Add(thingWithComps);
                    }
                }
                if (list == null)
                {
                    return;
                }
                foreach (Apparel item2 in list)
                {
                    pawn.equipment.Remove(item2);
                    ResetVerbs(item2);
                    if (pawn.apparel.CanWearWithoutDroppingAnything(item2.def))
                    {
                        pawn.apparel.Wear(item2);
                    }
                    else
                    {
                        pawn.inventory.innerContainer.TryAdd(item2);
                    }
                }
            }
            else if (Scribe.mode == LoadSaveMode.LoadingVars && (map = obj as Map) != null && map.temporaryThingDrawer == null)
            {
                map.temporaryThingDrawer = new TemporaryThingDrawer();
            }
        }
Esempio n. 8
0
        private string CurrentDebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (DebugViewSettings.writeGame)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine((Current.Game != null) ? Current.Game.DebugString() : "Current.Game = null");
            }
            if (DebugViewSettings.writeMusicManagerPlay)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine(Find.MusicManagerPlay.DebugString());
            }
            if (DebugViewSettings.writePlayingSounds)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine("Sustainers:");
                foreach (Sustainer sustainer in Find.SoundRoot.sustainerManager.AllSustainers)
                {
                    stringBuilder.AppendLine(sustainer.DebugString());
                }
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("OneShots:");
                foreach (SampleOneShot sampleOneShot in Find.SoundRoot.oneShotManager.PlayingOneShots)
                {
                    stringBuilder.AppendLine(sampleOneShot.ToString());
                }
            }
            if (DebugViewSettings.writeSoundEventsRecord)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine("Recent sound events:\n       ...");
                stringBuilder.AppendLine(DebugSoundEventsLog.EventsListingDebugString);
            }
            if (DebugViewSettings.writeSteamItems)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine(WorkshopItems.DebugOutput());
            }
            if (DebugViewSettings.writeConcepts)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine(LessonAutoActivator.DebugString());
            }
            if (DebugViewSettings.writeMemoryUsage)
            {
                stringBuilder.AppendLine("---");
                stringBuilder.AppendLine("Total allocated: " + Profiler.GetTotalAllocatedMemoryLong().ToStringBytes("F2"));
                stringBuilder.AppendLine("Total reserved: " + Profiler.GetTotalReservedMemoryLong().ToStringBytes("F2"));
                stringBuilder.AppendLine("Total reserved unused: " + Profiler.GetTotalUnusedReservedMemoryLong().ToStringBytes("F2"));
                stringBuilder.AppendLine("Mono heap size: " + Profiler.GetMonoHeapSizeLong().ToStringBytes("F2"));
                stringBuilder.AppendLine("Mono used size: " + Profiler.GetMonoUsedSizeLong().ToStringBytes("F2"));
            }
            if (Current.ProgramState == ProgramState.Playing)
            {
                stringBuilder.AppendLine("Tick " + Find.TickManager.TicksGame);
                if (DebugViewSettings.writeStoryteller)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.Storyteller.DebugString());
                }
            }
            if (Current.ProgramState == ProgramState.Playing && Find.CurrentMap != null)
            {
                if (DebugViewSettings.writeMapGameConditions)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.gameConditionManager.DebugString());
                }
                if (DebugViewSettings.drawPawnDebug)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.reservationManager.DebugString());
                }
                if (DebugViewSettings.writeMoteSaturation)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine("Mote count: " + Find.CurrentMap.moteCounter.MoteCount);
                    stringBuilder.AppendLine("Mote saturation: " + Find.CurrentMap.moteCounter.Saturation);
                }
                if (DebugViewSettings.writeEcosystem)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.wildAnimalSpawner.DebugString());
                }
                if (DebugViewSettings.writeTotalSnowDepth)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine("Total snow depth: " + Find.CurrentMap.snowGrid.TotalDepth);
                }
                if (DebugViewSettings.writeWind)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.windManager.DebugString());
                }
                if (DebugViewSettings.writeRecentStrikes)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.mineStrikeManager.DebugStrikeRecords());
                }
                if (DebugViewSettings.writeListRepairableBldgs)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.listerBuildingsRepairable.DebugString());
                }
                if (DebugViewSettings.writeListFilthInHomeArea)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.listerFilthInHomeArea.DebugString());
                }
                if (DebugViewSettings.writeListHaulables)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.listerHaulables.DebugString());
                }
                if (DebugViewSettings.writeListMergeables)
                {
                    stringBuilder.AppendLine("---");
                    stringBuilder.AppendLine(Find.CurrentMap.listerMergeables.DebugString());
                }
                if (DebugViewSettings.drawLords)
                {
                    foreach (Lord lord in Find.CurrentMap.lordManager.lords)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine(lord.DebugString());
                    }
                }
                IntVec3 intVec = UI.MouseCell();
                if (intVec.InBounds(Find.CurrentMap))
                {
                    stringBuilder.AppendLine("Inspecting " + intVec.ToString());
                    if (DebugViewSettings.writeTerrain)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine(Find.CurrentMap.terrainGrid.DebugStringAt(intVec));
                    }
                    if (DebugViewSettings.writeAttackTargets)
                    {
                        foreach (Pawn pawn in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).OfType <Pawn>())
                        {
                            stringBuilder.AppendLine("---");
                            stringBuilder.AppendLine("Potential attack targets for " + pawn.LabelShort + ":");
                            List <IAttackTarget> potentialTargetsFor = Find.CurrentMap.attackTargetsCache.GetPotentialTargetsFor(pawn);
                            for (int i = 0; i < potentialTargetsFor.Count; i++)
                            {
                                Thing thing = (Thing)potentialTargetsFor[i];
                                stringBuilder.AppendLine(string.Concat(new object[]
                                {
                                    thing.LabelShort,
                                    ", ",
                                    thing.Faction,
                                    (!potentialTargetsFor[i].ThreatDisabled(null)) ? "" : " (threat disabled)"
                                }));
                            }
                        }
                    }
                    if (DebugViewSettings.writeSnowDepth)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("Snow depth: " + Find.CurrentMap.snowGrid.GetDepth(intVec));
                    }
                    if (DebugViewSettings.drawDeepResources)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("Deep resource def: " + Find.CurrentMap.deepResourceGrid.ThingDefAt(intVec));
                        stringBuilder.AppendLine("Deep resource count: " + Find.CurrentMap.deepResourceGrid.CountAt(intVec));
                    }
                    if (DebugViewSettings.writeCanReachColony)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("CanReachColony: " + Find.CurrentMap.reachability.CanReachColony(UI.MouseCell()));
                    }
                    if (DebugViewSettings.writeMentalStateCalcs)
                    {
                        stringBuilder.AppendLine("---");
                        foreach (Pawn pawn2 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())
                                                where t is Pawn
                                                select t).Cast <Pawn>())
                        {
                            stringBuilder.AppendLine(pawn2.mindState.mentalBreaker.DebugString());
                        }
                    }
                    if (DebugViewSettings.writeWorkSettings)
                    {
                        foreach (Pawn pawn3 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())
                                                where t is Pawn
                                                select t).Cast <Pawn>())
                        {
                            if (pawn3.workSettings != null)
                            {
                                stringBuilder.AppendLine("---");
                                stringBuilder.AppendLine(pawn3.workSettings.DebugString());
                            }
                        }
                    }
                    if (DebugViewSettings.writeApparelScore)
                    {
                        stringBuilder.AppendLine("---");
                        if (intVec.InBounds(Find.CurrentMap))
                        {
                            foreach (Thing thing2 in intVec.GetThingList(Find.CurrentMap))
                            {
                                Apparel apparel = thing2 as Apparel;
                                if (apparel != null)
                                {
                                    stringBuilder.AppendLine(apparel.Label + ": " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel).ToString("F2"));
                                }
                            }
                        }
                    }
                    if (DebugViewSettings.writeCellContents || this.fullMode)
                    {
                        stringBuilder.AppendLine("---");
                        if (intVec.InBounds(Find.CurrentMap))
                        {
                            foreach (Designation designation in Find.CurrentMap.designationManager.AllDesignationsAt(intVec))
                            {
                                stringBuilder.AppendLine(designation.ToString());
                            }
                            foreach (Thing thing3 in Find.CurrentMap.thingGrid.ThingsAt(intVec))
                            {
                                if (!this.fullMode)
                                {
                                    stringBuilder.AppendLine(thing3.LabelCap + " - " + thing3.ToString());
                                }
                                else
                                {
                                    stringBuilder.AppendLine(Scribe.saver.DebugOutputFor(thing3));
                                    stringBuilder.AppendLine();
                                }
                            }
                        }
                    }
                    if (DebugViewSettings.debugApparelOptimize)
                    {
                        stringBuilder.AppendLine("---");
                        foreach (Thing thing4 in Find.CurrentMap.thingGrid.ThingsAt(intVec))
                        {
                            Apparel apparel2 = thing4 as Apparel;
                            if (apparel2 != null)
                            {
                                stringBuilder.AppendLine(apparel2.LabelCap);
                                stringBuilder.AppendLine("   raw: " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel2).ToString("F2"));
                                Pawn pawn4 = Find.Selector.SingleSelectedThing as Pawn;
                                if (pawn4 != null)
                                {
                                    stringBuilder.AppendLine("  Pawn: " + pawn4);
                                    stringBuilder.AppendLine("  gain: " + JobGiver_OptimizeApparel.ApparelScoreGain(pawn4, apparel2).ToString("F2"));
                                }
                            }
                        }
                    }
                    if (DebugViewSettings.drawRegions)
                    {
                        stringBuilder.AppendLine("---");
                        Region regionAt_NoRebuild_InvalidAllowed = Find.CurrentMap.regionGrid.GetRegionAt_NoRebuild_InvalidAllowed(intVec);
                        stringBuilder.AppendLine("Region:\n" + ((regionAt_NoRebuild_InvalidAllowed == null) ? "null" : regionAt_NoRebuild_InvalidAllowed.DebugString));
                    }
                    if (DebugViewSettings.drawRooms)
                    {
                        stringBuilder.AppendLine("---");
                        Room room = intVec.GetRoom(Find.CurrentMap, RegionType.Set_All);
                        if (room != null)
                        {
                            stringBuilder.AppendLine(room.DebugString());
                        }
                        else
                        {
                            stringBuilder.AppendLine("(no room)");
                        }
                    }
                    if (DebugViewSettings.drawRoomGroups)
                    {
                        stringBuilder.AppendLine("---");
                        RoomGroup roomGroup = intVec.GetRoomGroup(Find.CurrentMap);
                        if (roomGroup != null)
                        {
                            stringBuilder.AppendLine(roomGroup.DebugString());
                        }
                        else
                        {
                            stringBuilder.AppendLine("(no room group)");
                        }
                    }
                    if (DebugViewSettings.drawGlow)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("Game glow: " + Find.CurrentMap.glowGrid.GameGlowAt(intVec, false));
                        stringBuilder.AppendLine("Psych glow: " + Find.CurrentMap.glowGrid.PsychGlowAt(intVec));
                        stringBuilder.AppendLine("Visual Glow: " + Find.CurrentMap.glowGrid.VisualGlowAt(intVec));
                        stringBuilder.AppendLine("GlowReport:\n" + ((SectionLayer_LightingOverlay)Find.CurrentMap.mapDrawer.SectionAt(intVec).GetLayer(typeof(SectionLayer_LightingOverlay))).GlowReportAt(intVec));
                        stringBuilder.AppendLine("SkyManager.CurSkyGlow: " + Find.CurrentMap.skyManager.CurSkyGlow);
                    }
                    if (DebugViewSettings.writePathCosts)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("Perceived path cost: " + Find.CurrentMap.pathGrid.PerceivedPathCostAt(intVec));
                        stringBuilder.AppendLine("Real path cost: " + Find.CurrentMap.pathGrid.CalculatedCostAt(intVec, false, IntVec3.Invalid));
                    }
                    if (DebugViewSettings.writeFertility)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("\nFertility: " + Find.CurrentMap.fertilityGrid.FertilityAt(intVec).ToString("##0.00"));
                    }
                    if (DebugViewSettings.writeLinkFlags)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine("\nLinkFlags: ");
                        IEnumerator enumerator11 = Enum.GetValues(typeof(LinkFlags)).GetEnumerator();
                        try
                        {
                            while (enumerator11.MoveNext())
                            {
                                object obj = enumerator11.Current;
                                if ((Find.CurrentMap.linkGrid.LinkFlagsAt(intVec) & (LinkFlags)obj) != LinkFlags.None)
                                {
                                    stringBuilder.Append(" " + obj);
                                }
                            }
                        }
                        finally
                        {
                            IDisposable disposable;
                            if ((disposable = (enumerator11 as IDisposable)) != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
                    if (DebugViewSettings.writeSkyManager)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.AppendLine(Find.CurrentMap.skyManager.DebugString());
                    }
                    if (DebugViewSettings.writeCover)
                    {
                        stringBuilder.AppendLine("---");
                        stringBuilder.Append("Cover: ");
                        Thing thing5 = Find.CurrentMap.coverGrid[intVec];
                        if (thing5 == null)
                        {
                            stringBuilder.AppendLine("null");
                        }
                        else
                        {
                            stringBuilder.AppendLine(thing5.ToString());
                        }
                    }
                    if (DebugViewSettings.drawPower)
                    {
                        stringBuilder.AppendLine("---");
                        foreach (Thing thing6 in Find.CurrentMap.thingGrid.ThingsAt(intVec))
                        {
                            ThingWithComps thingWithComps = thing6 as ThingWithComps;
                            if (thingWithComps != null && thingWithComps.GetComp <CompPowerTrader>() != null)
                            {
                                stringBuilder.AppendLine(" " + thingWithComps.GetComp <CompPowerTrader>().DebugString);
                            }
                        }
                        PowerNet powerNet = Find.CurrentMap.powerNetGrid.TransmittedPowerNetAt(intVec);
                        if (powerNet != null)
                        {
                            stringBuilder.AppendLine("" + powerNet.DebugString());
                        }
                        else
                        {
                            stringBuilder.AppendLine("(no PowerNet here)");
                        }
                    }
                    if (DebugViewSettings.drawPreyInfo)
                    {
                        Pawn pawn5 = Find.Selector.SingleSelectedThing as Pawn;
                        if (pawn5 != null)
                        {
                            List <Thing> thingList = intVec.GetThingList(Find.CurrentMap);
                            for (int j = 0; j < thingList.Count; j++)
                            {
                                Pawn pawn6 = thingList[j] as Pawn;
                                if (pawn6 != null)
                                {
                                    stringBuilder.AppendLine("---");
                                    if (FoodUtility.IsAcceptablePreyFor(pawn5, pawn6))
                                    {
                                        stringBuilder.AppendLine("Prey score: " + FoodUtility.GetPreyScoreFor(pawn5, pawn6));
                                    }
                                    else
                                    {
                                        stringBuilder.AppendLine("Prey score: None");
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(stringBuilder.ToString());
        }
 public void CheckForStateChange(DamageInfo?dinfo, Hediff hediff)
 {
     if (Dead)
     {
         return;
     }
     if (ShouldBeDead())
     {
         if (!pawn.Destroyed)
         {
             pawn.Kill(dinfo, hediff);
         }
     }
     else if (!Downed)
     {
         if (ShouldBeDowned())
         {
             if (!forceIncap && dinfo.HasValue && dinfo.Value.Def.ExternalViolenceFor(pawn) && !pawn.IsWildMan() && (pawn.Faction == null || !pawn.Faction.IsPlayer) && (pawn.HostFaction == null || !pawn.HostFaction.IsPlayer))
             {
                 float num = (pawn.RaceProps.Animal ? 0.5f : ((!pawn.RaceProps.IsMechanoid) ? (HealthTuning.DeathOnDownedChance_NonColonyHumanlikeFromPopulationIntentCurve.Evaluate(StorytellerUtilityPopulation.PopulationIntent) * Find.Storyteller.difficultyValues.enemyDeathOnDownedChanceFactor) : 1f));
                 if (Rand.Chance(num))
                 {
                     if (DebugViewSettings.logCauseOfDeath)
                     {
                         Log.Message("CauseOfDeath: chance on downed " + num.ToStringPercent());
                     }
                     pawn.Kill(dinfo);
                     return;
                 }
             }
             forceIncap = false;
             MakeDowned(dinfo, hediff);
         }
         else
         {
             if (capacities.CapableOf(PawnCapacityDefOf.Manipulation))
             {
                 return;
             }
             if (pawn.carryTracker != null && pawn.carryTracker.CarriedThing != null && pawn.jobs != null && pawn.CurJob != null)
             {
                 pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
             }
             if (pawn.equipment == null || pawn.equipment.Primary == null)
             {
                 return;
             }
             if (pawn.kindDef.destroyGearOnDrop)
             {
                 pawn.equipment.DestroyEquipment(pawn.equipment.Primary);
             }
             else if (pawn.InContainerEnclosed)
             {
                 pawn.equipment.TryTransferEquipmentToContainer(pawn.equipment.Primary, pawn.holdingOwner);
             }
             else if (pawn.SpawnedOrAnyParentSpawned)
             {
                 pawn.equipment.TryDropEquipment(pawn.equipment.Primary, out var _, pawn.PositionHeld);
             }
             else if (pawn.IsCaravanMember())
             {
                 ThingWithComps primary = pawn.equipment.Primary;
                 pawn.equipment.Remove(primary);
                 if (!pawn.inventory.innerContainer.TryAdd(primary))
                 {
                     primary.Destroy();
                 }
             }
             else
             {
                 pawn.equipment.DestroyEquipment(pawn.equipment.Primary);
             }
         }
     }
     else if (!ShouldBeDowned())
     {
         MakeUndowned();
     }
 }