Exemplo n.º 1
0
        public override void GetNewBorns()
        {
            Pregnancy pregnancy    = Actor.SimDescription.Pregnancy;
            bool      isSelectable = Actor.IsSelectable;

            //if (isSelectable)
            // {
            Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
            // Custom
            //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true); -- was commented
            mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);

            /*
             * }
             * else
             * {
             *  try
             *  {
             *      Simulator.YieldingDisabled = true;
             *
             *      // Custom
             *      //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true);
             *      mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
             *  }
             *  finally
             *  {
             *      Simulator.YieldingDisabled = false;
             *  }
             * }
             */
        }
Exemplo n.º 2
0
        public override void GetNewBorns()
        {
            Pregnancy pregnancy    = Actor.SimDescription.Pregnancy;
            bool      isSelectable = Actor.IsSelectable;

            if (isSelectable)
            {
                Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
                // Custom
                //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true);
                mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
            }
            else
            {
                try
                {
                    Simulator.YieldingDisabled = true;

                    // Custom
                    //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true);
                    mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
                }
                finally
                {
                    Simulator.YieldingDisabled = false;
                }
            }
        }
Exemplo n.º 3
0
        public override void GetNewBorns()
        {
            Pregnancy pregnancy = Actor.SimDescription.Pregnancy;
            bool isSelectable = Actor.IsSelectable;
            if (isSelectable)
            {
                Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
                // Custom
                //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true);
                mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
            }
            else
            {
                try
                {
                    Simulator.YieldingDisabled = true;

                    // Custom
                    //mNewborns = HaveBabyHospitalEx.CreateNewborns(new PregnancyProxy(pregnancy), 0f, isSelectable, true);
                    mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
                }
                finally
                {
                    Simulator.YieldingDisabled = false;
                }
            }
        }
Exemplo n.º 4
0
        public override bool InRabbitHole()
        {
            string msg = "HaveBabyHospitalEx:InRabbitHole" + Common.NewLine;

            try
            {
                while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ExitReason.CanceledByScript))
                {
                    if (BabyShouldBeBorn && (((mDad == null) || !(mDad.CurrentInteraction is Pregnancy.GoToHospital)) || ((SimFollowers != null) && SimFollowers.Contains(mDad))))
                    {
                        break;
                    }
                }

                msg += "A";

                if (!BabyShouldBeBorn && Actor.HasExitReason(ExitReason.CanceledByScript))
                {
                    return(false);
                }

                msg += "B";

                Pregnancy pregnancy = Actor.SimDescription.Pregnancy;
                if (pregnancy != null)
                {
                    // Custom
                    HaveBabyHomeEx.EnsureForeignFather(pregnancy);
                }

                bool isSelectable = Actor.IsSelectable;
                //if (isSelectable)
                //{
                Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
                //mNewborns = CreateNewborns(new HaveBabyHomeEx.PregnancyProxy(pregnancy), kBonusMoodPointsForHospitalBirth, isSelectable, false);
                mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(kBonusMoodPointsForHospitalBirth, isSelectable, false);
                // }
                // else
                // {
                //   try
                // {
                //   Simulator.YieldingDisabled = true;
                //mNewborns = CreateNewborns(new HaveBabyHomeEx.PregnancyProxy(pregnancy), kBonusMoodPointsForHospitalBirth, isSelectable, false); - was commented
                // mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(kBonusMoodPointsForHospitalBirth, isSelectable, false);
                // }
                //// finally
                // {
                //     Simulator.YieldingDisabled = false;
                // }
                // }

                msg += "C";

                Sim dad = Actor.SimDescription.Pregnancy.mDad;

                Actor.SimDescription.SetPregnancy(0f);
                List <Sim> simFollowers = SimFollowers;
                Actor.SimDescription.Pregnancy.PregnancyComplete(mNewborns, simFollowers);

                if (mNewborns.Count == 4)
                {
                    Actor.BuffManager.RemoveElement(BuffNames.ItsABoy);
                    Actor.BuffManager.AddElement(CommonPregnancy.sItsQuadruplets, Origin.FromNewBaby);

                    if (dad != null)
                    {
                        dad.BuffManager.RemoveElement(BuffNames.ItsABoy);
                        dad.BuffManager.AddElement(CommonPregnancy.sItsQuadruplets, Origin.FromNewBaby);
                    }
                }

                msg += "D";

                SpeedTrap.Sleep(0x0);

                List <Sim> list2 = new List <Sim>();
                list2.Add(Actor);

                if (simFollowers != null)
                {
                    foreach (Sim sim in simFollowers)
                    {
                        if (sim.SimDescription.TeenOrAbove && (sim.GetObjectInRightHand() == null))
                        {
                            list2.Add(sim);
                        }
                    }
                }

                msg += "E";

                if (mNewborns.Count <= list2.Count)
                {
                    for (int i = 0x0; 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, 0x0, Vector3.UnitZ) as BabyBasket;
                    basket.AddBabiesToBasket(mNewborns);
                    CarrySystem.EnterWhileHolding(Actor, basket);
                    CarrySystem.VerifyAnimationParent(basket, Actor);
                }

                msg += "F";

                if (Actor.IsSelectable)
                {
                    OccultImaginaryFriend.DeliverDollToHousehold(mNewborns);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, msg, e);
                return(false);
            }
        }
Exemplo n.º 5
0
        public override bool InRabbitHole()
        {
            string msg = "HaveBabyHospitalEx:InRabbitHole" + Common.NewLine;

            try
            {
                while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ExitReason.CanceledByScript))
                {
                    if (BabyShouldBeBorn && (((mDad == null) || !(mDad.CurrentInteraction is Pregnancy.GoToHospital)) || ((SimFollowers != null) && SimFollowers.Contains(mDad))))
                    {
                        break;
                    }
                }

                msg += "A";

                if (!BabyShouldBeBorn && Actor.HasExitReason(ExitReason.CanceledByScript))
                {
                    return false;
                }

                msg += "B";

                Pregnancy pregnancy = Actor.SimDescription.Pregnancy;
                if (pregnancy != null)
                {
                    // Custom
                    HaveBabyHomeEx.EnsureForeignFather(pregnancy);
                }

                bool isSelectable = Actor.IsSelectable;
                //if (isSelectable)
                //{
                    Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
                    //mNewborns = CreateNewborns(new HaveBabyHomeEx.PregnancyProxy(pregnancy), kBonusMoodPointsForHospitalBirth, isSelectable, false);
                    mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(kBonusMoodPointsForHospitalBirth, isSelectable, false);
               // }
               // else
               // {
                 //   try
                   // {
                     //   Simulator.YieldingDisabled = true;
                        //mNewborns = CreateNewborns(new HaveBabyHomeEx.PregnancyProxy(pregnancy), kBonusMoodPointsForHospitalBirth, isSelectable, false); - was commented
                       // mNewborns = new Proxies.PregnancyProxy(pregnancy).CreateNewborns(kBonusMoodPointsForHospitalBirth, isSelectable, false);
                   // }
                   //// finally
                   // {
                   //     Simulator.YieldingDisabled = false;
                   // }
               // }

                msg += "C";

                Sim dad = Actor.SimDescription.Pregnancy.mDad;

                Actor.SimDescription.SetPregnancy(0f);
                List<Sim> simFollowers = SimFollowers;
                Actor.SimDescription.Pregnancy.PregnancyComplete(mNewborns, simFollowers);

                if (mNewborns.Count == 4)
                {
                    Actor.BuffManager.RemoveElement(BuffNames.ItsABoy);
                    Actor.BuffManager.AddElement(CommonPregnancy.sItsQuadruplets, Origin.FromNewBaby);

                    if (dad != null)
                    {
                        dad.BuffManager.RemoveElement(BuffNames.ItsABoy);
                        dad.BuffManager.AddElement(CommonPregnancy.sItsQuadruplets, Origin.FromNewBaby);
                    }
                }

                msg += "D";

                SpeedTrap.Sleep(0x0);

                List<Sim> list2 = new List<Sim>();
                list2.Add(Actor);

                if (simFollowers != null)
                {
                    foreach (Sim sim in simFollowers)
                    {
                        if (sim.SimDescription.TeenOrAbove && (sim.GetObjectInRightHand() == null))
                        {
                            list2.Add(sim);
                        }
                    }
                }

                msg += "E";

                if (mNewborns.Count <= list2.Count)
                {
                    for (int i = 0x0; 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, 0x0, Vector3.UnitZ) as BabyBasket;
                    basket.AddBabiesToBasket(mNewborns);
                    CarrySystem.EnterWhileHolding(Actor, basket);
                    CarrySystem.VerifyAnimationParent(basket, Actor);
                }

                msg += "F";

                if (Actor.IsSelectable)
                {
                    OccultImaginaryFriend.DeliverDollToHousehold(mNewborns);
                }
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, msg, e);
                return false;
            }
        }