protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); if (mPush) { Sim createdSim = Job.OwnerDescription.CreatedSim; if (createdSim != null) { if ((SimTypes.IsSelectable(Job.OwnerDescription)) || (!NpcParty.IsHostAtNpcParty(createdSim))) { foreach (InteractionInstance instance in createdSim.InteractionQueue.InteractionList) { if (instance is ICountsAsWorking) { IncStat("Already Queued"); return(false); } } VisitSituation.AnnounceTimeToGoToWork(createdSim); createdSim.InteractionQueue.Add(CareerPushScenario.GetWorkInteraction(Job)); } } if (GetValue <AllowGoHomePushOption, bool>(Sim)) { Manager.AddAlarm(new GoHomePushScenario(Sim)); } } return(true); }
protected static Party TryGetPartyOnLot(Lot lot) { NpcParty npcParty = NpcParty.TryGetNpcPartyOnLot(lot); if (npcParty != null) { return(npcParty); } return(null); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Sim host = Event.TargetObject as Sim; foreach (Situation situation in Situation.sAllSituations) { NpcParty party = situation as NpcParty; if (party == null) { continue; } if (party.Host != host) { continue; } NpcParty.WaitForSelectableGuestToArrive child = party.Child as NpcParty.WaitForSelectableGuestToArrive; if (child == null) { IncStat("Wrong Child Situation"); continue; } // Doing so stops the game from teleporting the other guests onto the lot child.selectableSimEnteredLot = true; new PopulatePartyTask(this, party).AddToSimulator(); IncStat("Party Altered"); return(true); } IncStat("Find Fail"); return(false); }
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)); }
public PopulatePartyTask(NPCPartyArriveScenario scenario, NpcParty party) { mScenario = scenario; mParty = party; }