public override void Cleanup() { AlienPregnancyProxy pregnancy = new AlienPregnancyProxy(Actor.SimDescription.Pregnancy); bool wasPregnant = pregnancy != null; try { if (!Actor.SimDescription.IsVampire) { Actor.Motives.CreateMotive(CommodityKind.Hunger); } try { if (mNewborns == null) { mNewborns = new List <Sim>(); } if (!Actor.HasBeenDestroyed) { pregnancy.PregnancyComplete(mNewborns, null); } base.Cleanup(); } catch (ResetException) { throw; } catch (Exception e) { if (pregnancy != null) { Common.Exception(Actor, Target, e); } } Sims3.Gameplay.Gameflow.Singleton.EnableSave(this); Actor.BuffManager.RemoveElement(BuffsAndTraits.sXenogenesis); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { Sims3.Gameplay.Gameflow.Singleton.EnableSave(this); } }
public override bool InRabbitHole() { string msg = "HaveAlienBabyHospital.InRabbitHole" + Common.NewLine; bool result; try { while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ExitReason.CanceledByScript) && !BabyShouldBeBorn) { } msg += "A"; if (!BabyShouldBeBorn && Actor.HasExitReason(ExitReason.CanceledByScript)) { result = false; } else { msg += "B"; AlienPregnancyProxy pregnancy = new AlienPregnancyProxy(Actor.SimDescription.Pregnancy); if (Actor.IsSelectable) { Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave"); } mNewborns = pregnancy.CreateNewborns(Pregnancy.HaveBabyHospital.kBonusMoodPointsForHospitalBirth, Actor.IsSelectable, false); for (int i = 0; i < mNewborns.Count; i++) { Relationship.Get(Actor, mNewborns[i], true).LTR.ForceChangeState(LongTermRelationshipTypes.Friend); } msg += "C"; Actor.SimDescription.SetPregnancy(0f); List <Sim> followers = SimFollowers; pregnancy.PregnancyComplete(mNewborns, followers); msg += "D"; SpeedTrap.Sleep(0u); List <Sim> list2 = new List <Sim>(); list2.Add(Actor); if (followers != null) { foreach (Sim sim in followers) { if (sim.SimDescription.TeenOrAbove && sim.GetObjectInRightHand() == null) { list2.Add(sim); } } } msg += "E"; if (mNewborns.Count <= list2.Count) { for (int i = 0; i < mNewborns.Count; i++) { Sim target = list2[i]; Posture posture = target.Posture; target.Posture = null; Sim actor = mNewborns[i]; InteractionInstance entry = Pregnancy.PregnancyPlaceholderInteraction.Singleton.CreateInstance(target, actor, new InteractionPriority(InteractionPriorityLevel.Zero), false, false); actor.InteractionQueue.Add(entry); while (actor.CurrentInteraction != entry && actor.InteractionQueue.HasInteraction(entry)) { SpeedTrap.Sleep(); } try { ChildUtils.CarryChild(target, actor, false); } catch (Exception e) { Common.Exception(actor, target, e); } target.Posture = posture; AddFollower(mNewborns[i]); } } else { BabyBasket basket = GlobalFunctions.CreateObject("BabyBasket", Vector3.OutOfWorld, 0, Vector3.UnitZ) as BabyBasket; basket.AddBabiesToBasket(mNewborns); CarrySystem.EnterWhileHolding(Actor, basket); CarrySystem.VerifyAnimationParent(basket, Actor); } msg += "F"; if (Actor.IsSelectable) { OccultImaginaryFriend.DeliverDollToHousehold(mNewborns); } result = true; } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, msg, e); result = false; } Common.DebugNotify(msg); return(result); }