예제 #1
0
        public SituationBase(Lot lot, Sim worker)
            : base(lot)
        {
            Worker = worker;

            worker.InteractionQueue.CancelAllInteractions();

            worker.AssignRole(this);
        }
 public GiftGiverSituation(Service service, Lot lot, Sim worker, int cost) : base(service, lot, worker, cost)
 {
     GiftGiverSituation.debugMessage("situation instantiated");
     worker.AssignRole(this);
     this.Worker.Autonomy.Motives.MaxEverything();
     this.Worker.Autonomy.Motives.FreezeDecayEverythingExcept(new CommodityKind[0]);
     this.Worker.Autonomy.AllowedToRunMetaAutonomy = false;
     this.Worker.Autonomy.IncrementAutonomyDisabled();       //what the heck does that do? VOV
     base.SetState(new GiftGiverSituation.RouteToLot(this)); //Should be using inherited walk to lot so that he doesn't driver there instead.
     base.ScheduleSwitchWorkerToServiceOutfit();
 }
예제 #3
0
            private void TimeToInviteGuests()
            {
                Sim host = Parent.Host;

                foreach (SimDescription description in Parent.GuestDescriptions)
                {
                    if (host != null)
                    {
                        Sim createdSim = description.CreatedSim;
                        if ((createdSim == null) && (!SimTypes.IsDead(description)) && (!SimTypes.IsSelectable(description)))
                        {
                            createdSim = Instantiation.PerformOffLot(description, host.LotHome, null);
                        }

                        if (createdSim != null)
                        {
                            Parent.Guests.Add(createdSim);
                            createdSim.AssignRole(Parent);
                        }
                    }
                }

                ManagerSituation situations = StoryProgression.Main.Situations;

                foreach (Sim sim3 in Parent.Guests)
                {
                    if (!situations.IsBusy(situations, sim3, true))
                    {
                        continue;
                    }

                    if (StoryProgression.Main.Situations.Allow(StoryProgression.Main.Situations, sim3.SimDescription))
                    {
                        sim3.PushSwitchToOutfitInteraction(Sim.ClothesChangeReason.GoingToSituation, Parent.ClothingStyle);
                    }

                    if (sim3.LotCurrent != Parent.Lot)
                    {
                        Parent.PushComeToParty(sim3);
                    }
                    else
                    {
                        Parent.OnRouteToPartySucceeded(sim3, 0f);
                    }
                }

                if (Parent.Lot != Parent.Host.LotCurrent)
                {
                    Parent.PushComeToParty(host);
                }
            }
예제 #4
0
        public AlienAbductionSituationEx(SimDescription alien, Sim abductee, Lot lot) : base(lot)
        {
            if (alien == null || abductee == null || lot == null)
            {
                Exit();
                return;
            }

            Alien = alien.InstantiateOffScreen(LotManager.GetFarthestLot(lot));
            Alien.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday, 0);
            Alien.AssignRole(this);

            Abductee = abductee;
            Abductee.AssignRole(this);
            SetState(new AbductSimEx(this));
        }
예제 #5
0
            private bool InviteGuestsEx()
            {
                if (!Parent.Host.IsSelectable)
                {
                    Common.DebugNotify("Not IsSelectable");
                    return(false);
                }
                if (!UnpackForeignVisitors(Parent))
                {
                    Common.DebugNotify("Not UnpackForeignVisitors");
                    return(false);
                }

                Sim host = Parent.Host;

                foreach (SimDescription description in Parent.GuestDescriptions)
                {
                    if (host != null)
                    {
                        Sim createdSim = description.CreatedSim;
                        if (createdSim == null)
                        {
                            createdSim = Instantiation.PerformOffLot(description, host.LotHome, null);
                        }

                        if (createdSim != null)
                        {
                            Parent.Guests.Add(createdSim);
                            createdSim.AssignRole(Parent);
                        }
                    }
                }

                foreach (Sim sim in Parent.Guests)
                {
                    if (sim.LotCurrent != Parent.Lot)
                    {
                        Parent.PushComeToLot(sim);
                    }
                    else
                    {
                        Parent.OnRouteToLotSucceeded(sim, 0f);
                    }
                }

                return(true);
            }
예제 #6
0
        public GoToLotSituation(Sim simA, Sim simB, Lot lot, FirstActionDelegate firstAction)
            : base(lot)
        {
            Sim.sOnLotChangedDelegates += OnLotChanged;

            mFirstAction = firstAction;

            foreach (Situation situation in new List <Situation>(simA.Autonomy.SituationComponent.Situations))
            {
                if (situation is GroupingSituation)
                {
                    try
                    {
                        situation.Exit();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(mSimA, e);
                    }
                }
            }

            foreach (Situation situation in new List <Situation>(simB.Autonomy.SituationComponent.Situations))
            {
                if (situation is GroupingSituation)
                {
                    try
                    {
                        situation.Exit();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(mSimB, e);
                    }
                }
            }

            mSimA = simA.AssignRole(this);
            mSimB = simB.AssignRole(this);

            AlarmManager.RemoveAlarm(mPulse);
            mPulse = AlarmManager.AddAlarmRepeating((float)Sims3.Gameplay.Situations.InviteToLotSituation.kPulseMinutes, TimeUnit.Minutes, Pulse, (float)Sims3.Gameplay.Situations.InviteToLotSituation.kPulseMinutes, TimeUnit.Minutes, "InviteToLot pulse", AlarmType.NeverPersisted, mSimA);

            SetState(new BothGoToLot(this));
        }
예제 #7
0
        public AlienAbductionSituationEx(SimDescription alien, Sim abductee, Lot lot) : base(lot)
        {
            if (alien == null || abductee == null || lot == null)
            {
                if (alien == null)
                {
                    Common.DebugNotify("Alien Abduction Situation Ex: Alien is null");
                }

                if (abductee == null)
                {
                    Common.DebugNotify("Alien Abduction Situtaion Ex: Abductee is null");
                }

                if (lot == null)
                {
                    Common.DebugNotify("Alien Abduction Situation Ex: Lot is null");
                }

                Exit();
                return;
            }

            Alien = alien.InstantiateOffScreen(LotManager.GetFarthestLot(lot));
            Alien.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday, 0);
            Abductee = abductee;

            if (Alien != null && Abductee != null)
            {
                Alien.AssignRole(this);
                Abductee.AssignRole(this);
                SetState(new AbductSim(this));
                return;
            }

            Alien.Destroy();
            Exit();
        }
예제 #8
0
            protected override void OnPerform()
            {
                mScenario.IncStat("PopulatePartyTask");

                mParty.mPlaceNpcGuestsFunction = null;
                mParty.SomeGuestsHaveArrived   = true;

                Lot lotHome = mParty.Host.LotHome;

                GatheringScenario.PushBuffetInteractions(mScenario, mParty.Host.SimDescription, lotHome);

                List <Sim> sims = new List <Sim>(HouseholdsEx.AllSims(lotHome.Household));

                SimDescription host = mParty.Host.SimDescription;

                foreach (SimDescription sim in mParty.GuestDescriptions)
                {
                    if (!NpcParty.NpcGuestTest(sim, host))
                    {
                        continue;
                    }

                    if (!mScenario.Situations.Allow(mScenario, sim))
                    {
                        mScenario.IncStat("NpcParty Push User Denied");
                        continue;
                    }

                    Sim createdSim = sim.CreatedSim;
                    if (createdSim == null)
                    {
                        createdSim = Instantiation.PerformOffLot(sim, lotHome, null);
                    }

                    if (createdSim != null)
                    {
                        if (createdSim.LotCurrent != lotHome)
                        {
                            if (!mScenario.Situations.PushVisit(mScenario, sim, lotHome))
                            {
                                mScenario.IncStat("NpcParty Push Fail");
                                continue;
                            }
                        }

                        mParty.Guests.Add(createdSim);
                        createdSim.AssignRole(mParty);

                        VisitSituation.SetVisitToGreeted(createdSim);

                        sims.Add(createdSim);
                    }
                }

                foreach (Sim sim in sims)
                {
                    if (sim.LotCurrent == lotHome)
                    {
                        sim.Motives.SetMax(CommodityKind.Energy);
                        sim.Motives.SetMax(CommodityKind.Hygiene);

                        sim.PushSwitchToOutfitInteraction(Sims3.Gameplay.Actors.Sim.ClothesChangeReason.Force, mParty.ClothingStyle);
                    }
                }

                EventTracker.SendEvent(new PartyEvent(EventTypeId.kPartyBegan, mParty.Host, host, mParty));

                mParty.SetState(new NpcParty.Happening(mParty));
            }