Example #1
0
        // Lacks the "greater than eight" restriction
        public static bool GhostToPlayableGhost(Urnstone ths, Household newHousehold, Vector3 ghostPosition)
        {
            SimDescription simDescription = ths.DeadSimsDescription;

            if (!simDescription.IsValidDescription)
            {
                simDescription.Fixup();
            }

            if (simDescription.Household != null)
            {
                simDescription.Household.Remove(simDescription, !simDescription.Household.IsSpecialHousehold);
            }

            if (!newHousehold.Contains(simDescription))
            {
                newHousehold.Add(simDescription);
            }

            Sim ghost = Instantiation.Perform(simDescription, ghostPosition, null, null);

            if (ghost == null)
            {
                return(false);
            }

            ths.GhostSetup(ghost, true);

            ths.RemoveMourningRelatedBuffs(ghost);

            simDescription.ShowSocialsOnSim  = true;
            simDescription.IsNeverSelectable = false;
            simDescription.Marryable         = true;
            simDescription.Contactable       = true;

            if (!simDescription.IsEP11Bot)
            {
                simDescription.AgingEnabled = true;
                simDescription.AgingState.ResetAndExtendAgingStage(0f);
                simDescription.PushAgingEnabledToAgingManager();
            }

            string failureReason;

            if (!Inventories.TryToMove(ths, ghost.Inventory, true, out failureReason))
            {
                Common.DebugNotify(failureReason);
            }
            //Inventories.TryToMove(ths, ghost);

            if (simDescription.Child || simDescription.Teen)
            {
                simDescription.AssignSchool();
            }

            if (ghost.IsSelectable)
            {
                ghost.OnBecameSelectable();
            }

            return(true);
        }