private void MakeDowned(DamageInfo?dinfo, Hediff hediff)
 {
     if (this.Downed)
     {
         Log.Error(this.pawn + " tried to do MakeDowned while already downed.", false);
     }
     else
     {
         if (this.pawn.guilt != null && this.pawn.GetLord() != null && this.pawn.GetLord().LordJob != null && this.pawn.GetLord().LordJob.GuiltyOnDowned)
         {
             this.pawn.guilt.Notify_Guilty();
         }
         this.healthState = PawnHealthState.Down;
         PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(this.pawn, dinfo, PawnDiedOrDownedThoughtsKind.Downed);
         if (this.pawn.InMentalState)
         {
             this.pawn.mindState.mentalStateHandler.CurState.RecoverFromState();
         }
         if (this.pawn.Spawned)
         {
             if (this.pawn.IsColonist && dinfo != null && dinfo.Value.Def.externalViolence)
             {
                 Find.StoryWatcher.watcherRampUp.Notify_ColonistViolentlyDownedOrKilled(this.pawn);
             }
             this.pawn.DropAndForbidEverything(true);
             this.pawn.stances.CancelBusyStanceSoft();
         }
         this.pawn.ClearMind(true);
         if (Current.ProgramState == ProgramState.Playing)
         {
             Lord lord = this.pawn.GetLord();
             if (lord != null)
             {
                 lord.Notify_PawnLost(this.pawn, PawnLostCondition.IncappedOrKilled);
             }
         }
         if (this.pawn.Drafted)
         {
             this.pawn.drafter.Drafted = false;
         }
         PortraitsCache.SetDirty(this.pawn);
         if (this.pawn.SpawnedOrAnyParentSpawned)
         {
             GenHostility.Notify_PawnLostForTutor(this.pawn, this.pawn.MapHeld);
         }
         if (this.pawn.RaceProps.Humanlike && Current.ProgramState == ProgramState.Playing && this.pawn.SpawnedOrAnyParentSpawned)
         {
             if (this.pawn.HostileTo(Faction.OfPlayer))
             {
                 LessonAutoActivator.TeachOpportunity(ConceptDefOf.Capturing, this.pawn, OpportunityType.Important);
             }
             if (this.pawn.Faction == Faction.OfPlayer)
             {
                 LessonAutoActivator.TeachOpportunity(ConceptDefOf.Rescuing, this.pawn, OpportunityType.Critical);
             }
         }
         if (dinfo != null && dinfo.Value.Instigator != null)
         {
             Pawn pawn = dinfo.Value.Instigator as Pawn;
             if (pawn != null)
             {
                 RecordsUtility.Notify_PawnDowned(this.pawn, pawn);
             }
         }
         if (this.pawn.Spawned)
         {
             TaleRecorder.RecordTale(TaleDefOf.Downed, new object[]
             {
                 this.pawn,
                 (dinfo == null) ? null : (dinfo.Value.Instigator as Pawn),
                 (dinfo == null) ? null : dinfo.Value.Weapon
             });
             Find.BattleLog.Add(new BattleLogEntry_StateTransition(this.pawn, RulePackDefOf.Transition_Downed, (dinfo == null) ? null : (dinfo.Value.Instigator as Pawn), hediff, (dinfo == null) ? null : dinfo.Value.HitPart));
         }
     }
 }
 private void MakeDowned(DamageInfo?dinfo, Hediff hediff)
 {
     if (Downed)
     {
         Log.Error(string.Concat(this.pawn, " tried to do MakeDowned while already downed."));
         return;
     }
     if (this.pawn.guilt != null && this.pawn.GetLord() != null && this.pawn.GetLord().LordJob != null && this.pawn.GetLord().LordJob.GuiltyOnDowned)
     {
         this.pawn.guilt.Notify_Guilty();
     }
     healthState = PawnHealthState.Down;
     PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(this.pawn, dinfo, PawnDiedOrDownedThoughtsKind.Downed);
     if (this.pawn.InMentalState && this.pawn.MentalStateDef.recoverFromDowned)
     {
         this.pawn.mindState.mentalStateHandler.CurState.RecoverFromState();
     }
     if (this.pawn.Spawned)
     {
         this.pawn.DropAndForbidEverything(keepInventoryAndEquipmentIfInBed: true);
         this.pawn.stances.CancelBusyStanceSoft();
     }
     this.pawn.ClearMind(ifLayingKeepLaying: true, clearInspiration: false, clearMentalState: false);
     if (Current.ProgramState == ProgramState.Playing)
     {
         Lord lord = this.pawn.GetLord();
         if (lord != null && (lord.LordJob == null || lord.LordJob.RemoveDownedPawns))
         {
             lord.Notify_PawnLost(this.pawn, PawnLostCondition.IncappedOrKilled, dinfo);
         }
     }
     if (this.pawn.Drafted)
     {
         this.pawn.drafter.Drafted = false;
     }
     PortraitsCache.SetDirty(this.pawn);
     if (this.pawn.SpawnedOrAnyParentSpawned)
     {
         GenHostility.Notify_PawnLostForTutor(this.pawn, this.pawn.MapHeld);
     }
     if (this.pawn.RaceProps.Humanlike && Current.ProgramState == ProgramState.Playing && this.pawn.SpawnedOrAnyParentSpawned)
     {
         if (this.pawn.HostileTo(Faction.OfPlayer))
         {
             LessonAutoActivator.TeachOpportunity(ConceptDefOf.Capturing, this.pawn, OpportunityType.Important);
         }
         if (this.pawn.Faction == Faction.OfPlayer)
         {
             LessonAutoActivator.TeachOpportunity(ConceptDefOf.Rescuing, this.pawn, OpportunityType.Critical);
         }
     }
     if (dinfo.HasValue && dinfo.Value.Instigator != null)
     {
         Pawn pawn = dinfo.Value.Instigator as Pawn;
         if (pawn != null)
         {
             RecordsUtility.Notify_PawnDowned(this.pawn, pawn);
         }
     }
     if (this.pawn.Spawned)
     {
         TaleRecorder.RecordTale(TaleDefOf.Downed, this.pawn, dinfo.HasValue ? (dinfo.Value.Instigator as Pawn) : null, dinfo.HasValue ? dinfo.Value.Weapon : null);
         Find.BattleLog.Add(new BattleLogEntry_StateTransition(this.pawn, RulePackDefOf.Transition_Downed, dinfo.HasValue ? (dinfo.Value.Instigator as Pawn) : null, hediff, dinfo.HasValue ? dinfo.Value.HitPart : null));
     }
     Find.Storyteller.Notify_PawnEvent(this.pawn, AdaptationEvent.Downed, dinfo);
 }