Esempio n. 1
0
        public static void Ressurrect(Pawn pawn, Thing thing)
        {
            if (thing is HoloEmitter)
            {
                if (pawn.Corpse.holdingOwner != null)
                {
                    pawn.Corpse.GetDirectlyHeldThings().TryTransferToContainer(pawn, pawn.Corpse.holdingOwner, true);
                }
                else if (pawn.Corpse.Spawned)
                {
                    ResurrectionUtility.Resurrect(pawn);
                    PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn);
                    PawnComponentsUtility.AddAndRemoveDynamicComponents(pawn, false);
                    CompOsiris.FixPawnRelationships(pawn);
                    pawn.health.Reset();
                    if (pawn.Corpse != null && pawn.Corpse.Spawned)
                    {
                        pawn.Corpse.DeSpawn();
                    }
                    GenSpawn.Spawn(pawn, pawn.Corpse.Position, pawn.Corpse.Map);
                    GiveSideEffects(pawn);
                }
                if (pawn.Corpse != null)
                {
                    pawn.Corpse.Destroy(DestroyMode.Vanish);
                }
            }
            else
            {
                ResurrectionUtility.Resurrect(pawn);
                PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn);
                CompOsiris.FixPawnRelationships(pawn);
                pawn.health.Reset();
                if (pawn.Corpse != null && pawn.Corpse.Spawned)
                {
                    pawn.Corpse.DeSpawn();
                }
                GenSpawn.Spawn(pawn, thing.Position, thing.Map);
                GiveSideEffects(pawn);

                Building_Casket building_Casket = thing as Building_Casket;
                if (building_Casket != null)
                {
                    building_Casket.GetDirectlyHeldThings().Clear();
                }
            }
        }
Esempio n. 2
0
 public void HealContained()
 {
     if (this.Casket.ContainedThing != null)
     {
         Corpse corpse = this.Casket.ContainedThing as Corpse;
         Pawn   pawn;
         if (corpse != null)
         {
             pawn = corpse.InnerPawn;
         }
         else
         {
             pawn = (this.Casket.ContainedThing as Pawn);
         }
         if (pawn != null)
         {
             if (pawn.Dead)
             {
                 CompOsiris.Ressurrect(pawn, this.parent);
             }
             else
             {
                 pawn.health.Reset();
             }
             if (pawn.RaceProps.Humanlike)
             {
                 pawn.ageTracker.AgeBiologicalTicks = 90000000L;
                 if (Rand.Value < 0.65f)
                 {
                     pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("RD_ReturnedFromTheDeadBad"), null);
                 }
                 else
                 {
                     pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("RD_ReturnedFromTheDeadGood"), null);
                 }
             }
             else if (pawn.RaceProps.Animal)
             {
                 pawn.ageTracker.AgeBiologicalTicks = (long)(pawn.RaceProps.lifeStageAges[2].minAge * 3600000f);
             }
             pawn.health.AddHediff(HediffDef.Named("LuciferiumAddiction"), null, null);
             pawn.health.AddHediff(HediffDef.Named("LuciferiumHigh"), null, null);
         }
     }
 }