public override bool Run() { if (this.Target.Parent != this.Actor && !CarrySystem.PickUp(this.Actor, this.Target)) { return(false); } if (this.Actor.GetObjectInRightHand() == null) { return(false); } if (this.mJT == null) { Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); return(false); } if (!this.Actor.RouteToObjectRadialRange(this.mJT, 0.5f, 1.5f)) { Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); return(false); } ObjectGuid containedObject = Slots.GetContainedObject(this.mJT.ObjectId, 2820733094u); if (containedObject != ObjectGuid.InvalidObjectGuid) { Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); return(false); } if (this.Target.ParentToSlot(this.mJT, 2820733094u)) { CarrySystem.ExitCarry(this.Actor); return(true); } Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); return(false); }
public override bool Test(Sim a, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!a.SkillManager.HasElement(EWHerbLoreSkill.SkillNameID)) { return(false); } PlantableComponent plantable = target.Plantable; if (plantable == null) { return(false); } if (plantable.PlantDef == null) { return(false); } if (plantable.PlantDef.LimitedAvailability) { return(false); } ITreasureSpawnableObject treasureSpawnableObject = target as ITreasureSpawnableObject; if (treasureSpawnableObject != null && treasureSpawnableObject.IsOnSpawner) { return(false); } return(!target.InUse && CarrySystem.CouldPickUp(target as ICarryable)); }
public override bool RunBehavior() { GameObject gameObject = this.mDestination.Object.GetContainedObject(this.mDestination.PlacementSlot) as GameObject; TrueBlood tb = gameObject as TrueBlood; if (tb != null) { int num; if (this.RunPaymentBehavior(out num)) { Sim instanceActor = this.LinkedInteractionInstance.InstanceActor; Bartending bartending = (Bartending)instanceActor.SkillManager.AddElement(SkillNames.Bartending); if (bartending != null) { Sim simInChargeOfBar = this.GetSimInChargeOfBar(); bartending.OnServedSim(this.Actor, simInChargeOfBar, num, Quality.Nice, this.Target.LotCurrent, DrinkDescription); instanceActor.ModifyFunds(num); } if (CarrySystem.PickUpWithoutRouting(this.Actor, tb, true)) { tb.PushEatHeldFoodInteraction(this.Actor); } else { gameObject.FadeOut(false, true); } return(true); } gameObject.FadeOut(true, true); } return(false); }
public static bool CreateFoodAndPushConsumeOnSim(ConcessionsStand.BaseFoodData baseFoodData, Sim sim) { CommonMethods.ShowMessage(baseFoodData.mFoodType.ToString() + " " + baseFoodData); bool result = true; switch (baseFoodData.mFoodType) { case ConcessionsStand.FoodType.HotBeverage: case ConcessionsStand.FoodType.ColdBeverage: { BaseFoodStand.BaseFoodStandBeverage baseFoodStandBeverage = CreateBeverage(baseFoodData.FoodType == BaseFoodStand.FoodType.HotBeverage, sim); if (baseFoodStandBeverage != null) { BaseFoodStand.FoodType foodType = baseFoodData.FoodType; baseFoodStandBeverage.IsColdResortDrink = (foodType == BaseFoodStand.FoodType.ColdBeverage); float tempChangePerSip = (foodType == BaseFoodStand.FoodType.HotBeverage) ? ConcessionsStand.kTempChangePerSipHotDrink : ConcessionsStand.kTempChangePerSipColdDrink; baseFoodStandBeverage.InitData(baseFoodData.DrinkNameLocKey, baseFoodData.BevFoodUnits, baseFoodData.BuffToAdd, tempChangePerSip); baseFoodData = null; baseFoodStandBeverage.SetOpacity(0f, 0f); if (sim.ParentToRightHand(baseFoodStandBeverage)) { CarrySystem.EnterWhileHolding(sim, baseFoodStandBeverage); baseFoodStandBeverage.FadeIn(true); sim.Wander(ConcessionsStand.kMinMaxWanderBeforeDrink[0], ConcessionsStand.kMinMaxWanderBeforeDrink[1], false, RouteDistancePreference.NoPreference, false); result = baseFoodStandBeverage.PushDrinkAsContinuation(sim); } else { baseFoodStandBeverage.Destroy(); result = false; } } break; //string instanceName = (selectedFood.mFoodType == ConcessionsStand.FoodType.HotBeverage) ? "beverageCupHot" : "beverageCupCold"; //ConcessionsStand.ConcessionsBeverage concessionsBeverage = GlobalFunctions.CreateObject(instanceName, ProductVersion.EP8, sim.Position, 1, Vector3.UnitZ, null, null) as ConcessionsStand.ConcessionsBeverage; //if (concessionsBeverage != null) //{ // float tempChangePerSip = (selectedFood.mFoodType == BaseFoodStand.FoodType.HotBeverage) ? ConcessionsStand.kTempChangePerSipHotDrink : ConcessionsStand.kTempChangePerSipColdDrink; // concessionsBeverage.InitData(selectedFood.DrinkNameLocKey, selectedFood.BevFoodUnits, selectedFood.BuffToAdd, tempChangePerSip); // // concessionsBeverage.InitData(selectedFood.mFoodType, selectedFood.mDrinkNameLocKey, selectedFood.mBevFoodUnits, selectedFood.mBuffToAdd); // concessionsBeverage.SetOpacity(0f, 0f); // if (sim.ParentToRightHand(concessionsBeverage)) // { // CarrySystem.EnterWhileHolding(sim, concessionsBeverage); // concessionsBeverage.FadeIn(true); // sim.Wander(ConcessionsStand.kMinMaxWanderBeforeDrink[0], ConcessionsStand.kMinMaxWanderBeforeDrink[1], false, RouteDistancePreference.NoPreference, false); // result = concessionsBeverage.PushDrinkAsContinuation(sim); // } // else // { // concessionsBeverage.Destroy(); // result = false; // } //} //break; } } return(result); }
private ISurface placeOnSurface() { //find a valid nearby surface and place the checkbook on it. List <ISurface> surfaces = new List <ISurface>(base.Actor.LotCurrent.GetObjects <ISurface>()); ISurface surface = GlobalFunctions.FindNearestSurfaceOfType(base.Actor, SurfaceType.Homework, this.Target, surfaces, true); CarrySystem.PutDownOnNearestSurface(base.Actor, surfaces, SurfaceType.Homework, true, true, true); return(surface); }
public override bool RunMakeBehavior() { Recipe recipe = Recipe.NameToRecipeHash["TrueBlood"]; TrueBlood tb = GlobalFunctions.CreateObjectOutOfWorld(recipe.ObjectToCreateInFridge, recipe.CodeVersion) as TrueBlood; tb.ParentToSlot(this.Actor, Sim.ContainmentSlots.RightHand); CarrySystem.EnterWhileHolding(this.Actor, tb); return(true); }
public override void CleanupAfterExitReason() { if (this.Actor.IsHoldingAnything()) { if (this.Actor.CarryStateMachine == null) { CarrySystem.EnterWhileHolding(this.Actor, this.Actor.GetObjectInRightHand() as ICarryable); } Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); } base.CleanupAfterExitReason(); }
public override bool Run() { if (!CarrySystem.PickUp(base.Actor, base.Target)) { return(false); } if (!CarrySystem.PutInSimInventory(base.Actor)) { return(false); } return(true); }
public bool CreateFinalCookingObjectAndExit(TrueBlood trueBlood) { this.Target.SimStateMachineClient.SetActor((trueBlood as IMicrowavable).ActorNameForMicrowave, trueBlood); this.Target.SimStateMachineClient.RequestState("x", "Exit - " + "BowlLarge"); CarrySystem.EnterWhileHolding(this.Actor, trueBlood as ICarryable); if (this.CheckForCancelAndCleanup()) { return(false); } trueBlood.PushEatSnack(this.Actor); return(true); }
public bool BuyAndEatConcessionsFood(Sim sim, bool autonomous) { bool result = true; //Find the counter the cash register is on bool registerFound = false; int cupLevel = 1; Vector3 cupPosition = sim.Position; if (base.Target.SimDescription.HasActiveRole && base.Target.SimDescription.AssignedRole != null && base.Target.SimDescription.AssignedRole.RoleGivingObject != null) { if (base.Target.SimDescription.AssignedRole.RoleGivingObject.Parent != null) { registerFound = true; } } if (registerFound) { cupLevel = base.Target.SimDescription.AssignedRole.RoleGivingObject.Level + 100; cupPosition = base.Target.SimDescription.AssignedRole.RoleGivingObject.Position; } HotBeverageMachine.Cup cup = GlobalFunctions.CreateObject("CoffeeCup", cupPosition, cupLevel, Vector3.UnitZ) as HotBeverageMachine.Cup; if (cup != null) { cup.Contents = new HotBeverageMachine.CustomDrinkRecipe(); if (sim.ParentToRightHand(cup)) { CarrySystem.EnterWhileHolding(sim, cup); cup.PushDrinkAsContinuation(sim); cup.StartEffects(); result = true; } else { cup.Destroy(); result = false; } } //HotBeverageMachine.Cup cup = GlobalFunctions.CreateObject("CoffeeCup", cupPosition, cupLevel, Vector3.UnitZ) as HotBeverageMachine.Cup; //cup.Contents = new HotBeverageMachine.CustomDrinkRecipe(); //CarrySystem.PickUp(sim, cup); //// CarrySystem.EnterWhileHolding(sim, cup); //cup.PushDrinkAsContinuation(sim); return(result); }
public override bool Run() { Counter parent = base.Target.Parent as Counter; if (parent == null) { return(false); } if (!SurfaceUtil.RouteToObjectOnSurface(parent, base.Actor, base.Target)) { return(false); } base.StandardEntry(); HotBeverageMachine.Cup actor = GlobalFunctions.CreateObject("CoffeeCup", base.Target.Parent.Position, base.Target.Level, Vector3.UnitZ) as HotBeverageMachine.Cup; try { actor.AddToUseList(base.Actor); actor.Contents = (base.InteractionDefinition as Definition).Drink; actor.SetHiddenFlags(HiddenFlags.Model); HotBeverageMachine.EnterStateMachine(this); base.SetActor("coffeeCup", actor); base.BeginCommodityUpdates(); base.AnimateSim("Make One Drink"); base.EndCommodityUpdates(true); CarrySystem.VerifyAnimationParent(actor, base.Actor); } finally { actor.RemoveFromUseList(base.Actor); } //pay for drink CommonMethods.PayForCoffee(base.Actor, base.Target.LotCurrent); CarrySystem.EnterWhileHolding(base.Actor, actor); actor.PushDrinkAsContinuation(base.Actor); if (parent.IsCleanable) { parent.Cleanable.DirtyInc(base.Actor); } base.mCurrentStateMachine.Dispose(); actor.StartEffects(); base.StandardExit(); return(true); }
public override bool Run() { this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet; if (mClothingPile == null) { ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesInDryer.Singleton, (IGameObject)closestObject1, true); return(true); } WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesInDryer.Singleton, (IGameObject)closestObject2, true); return(true); } return(false); } if (!this.Target.RouteToDryerAndCheckInUse((InteractionInstance)this) || this.Target.CurDryerState != Dryer.DryerState.Empty) { CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutdownAnimationEvent), 102U); return(false); } this.StandardEntry(); this.Target.mDryerStateMachine = StateMachineClient.Acquire((IHasScriptProxy)this.Target, "dryer"); StateMachineClient dryerStateMachine = this.Target.mDryerStateMachine; dryerStateMachine.SetActor("x", (IHasScriptProxy)this.Actor); dryerStateMachine.SetActor("clothesBag", (IHasScriptProxy)this.mClothingPile); dryerStateMachine.SetActor("dryer", (IHasScriptProxy)this.Target); dryerStateMachine.EnterState("x", "Enter"); dryerStateMachine.EnterState("dryer", "Enter"); dryerStateMachine.AddPersistentScriptEventHandler(0U, new SacsEventHandler(this.OnAnimationEvent)); this.BeginCommodityUpdates(); CarrySystem.ExitAndKeepHolding(this.Actor); dryerStateMachine.RequestState(false, "dryer", "Start Dryer"); dryerStateMachine.RequestState(true, "x", "Start Dryer"); this.EndCommodityUpdates(true); dryerStateMachine.RequestState(false, "dryer", "Loop Operate"); dryerStateMachine.RequestState(true, "x", "Exit Add Clothes"); Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry); this.StandardExit(); return(true); }
public override bool Run() { Counter parent = base.Target.Parent as Counter; if (parent == null) { return(false); } if (!SurfaceUtil.RouteToObjectOnSurface(parent, base.Actor, base.Target)) { return(false); } base.StandardEntry(); this.Cup = this.MakeCup() as HotBeverageMachine.Cup; this.Cup.SetHiddenFlags(HiddenFlags.Model); this.BarTray = GlobalFunctions.CreateObject("barTray", (base.Target.Parent ?? base.Target).Position, base.Target.Level, Vector3.UnitZ) as BarTray; this.BarTray.SetHiddenFlags(HiddenFlags.Model); this.BarTray.AddInteraction(CallForCoffee.Singleton); base.Target.mLastCreatedTrayOfDrinksId = this.BarTray.ObjectId; HotBeverageMachine.EnterStateMachine(this); base.AddOneShotScriptEventHandler(100, new SacsEventHandler(this.FillTray)); base.SetActor("coffeeCup", this.Cup); base.SetActor("barTray", this.BarTray); base.BeginCommodityUpdates(); base.AnimateSim("Make Many Drinks"); base.EndCommodityUpdates(true); base.StandardExit(); CarrySystem.VerifyAnimationParent(this.BarTray, base.Actor); CarrySystem.EnterWhileHolding(base.Actor, this.BarTray); CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true); //if ((!base.Autonomous || !base.Actor.HasBuffsToPreventSleepiness()) && CarrySystem.PickUp(base.Actor, this.Cup)) //{ // this.Cup.PushDrinkAsContinuation(base.Actor); //} base.mCurrentStateMachine.Dispose(); this.Cup.StartEffects(); if (parent.IsCleanable) { parent.Cleanable.DirtyInc(base.Actor); } return(true); }
public override bool Run() { this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet; if (mClothingPile == null) { ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesOnClothesline.Singleton, (IGameObject)closestObject1, true); return(true); } WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesOnClothesline.Singleton, (IGameObject)closestObject2, true); return(true); } return(false); } int slotIndex; if (!this.Target.RouteToClotheslineAndCheckInUse((InteractionInstance)this, out slotIndex) || this.Target.CurClothesState != Dryer.DryerState.Empty) { CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutDownAnimationEvent), 102U); return(false); } this.StandardEntry(); this.EnterStateMachine("ClothesLine", "Enter", "x", "clothesLine"); this.SetActor("clothesbag", (IHasScriptProxy)this.mClothingPile); this.SetParameter("isMirrored", slotIndex == 0); this.AddOneShotScriptEventHandler(101U, new SacsEventHandler(this.OnAnimationEvent)); this.AddOneShotScriptEventHandler(102U, new SacsEventHandler(this.OnAnimationEvent)); this.BeginCommodityUpdates(); CarrySystem.ExitAndKeepHolding(this.Actor); this.Actor.BuffManager.AddElement(BuffNames.SavingEnergy, Origin.FromClothesline, ProductVersion.EP2, TraitNames.EnvironmentallyConscious); this.AnimateSim("Exit Hang Clothes"); this.EndCommodityUpdates(true); this.StandardExit(); Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry); return(true); }
public override bool Run() { Route r = base.Actor.CreateRoute(); r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true); r.PlanToPointRadialRange(base.Target.Position, 0.5f, 3f, Vector3.UnitZ, 360f, RouteDistancePreference.PreferNearestToRouteOrigin, RouteOrientationPreference.TowardsObject); if (!base.Actor.DoRoute(r)) { base.Actor.AddExitReason(ExitReason.RouteFailed); return(false); } if (!base.Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), BarTray.kTimeToWaitInLine)) { return(false); } List <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup> randomList = new List <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup>(); foreach (Slot slot in base.Target.GetContainmentSlots()) { Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup containedObject = base.Target.GetContainedObject(slot) as Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup; if ((containedObject != null) && !containedObject.InUse) { randomList.Add(containedObject); } } if (randomList.Count == 0) { return(false); } Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup randomObjectFromList = RandomUtil.GetRandomObjectFromList <Sims3.Gameplay.Objects.Appliances.HotBeverageMachine.Cup>(randomList); if ((randomObjectFromList != null) && CarrySystem.PickUp(base.Actor, randomObjectFromList)) { //Pay for the coffee CommonMethods.PayForCoffee(base.Actor, base.Target.LotCurrent); InteractionInstance instance = EatHeldFood.Singleton.CreateInstance(randomObjectFromList, base.Actor, base.Actor.InheritedPriority(), false, true); return(Actor.InteractionQueue.PushAsContinuation(instance, false)); } return(false); }
protected override bool Run() { if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f)) { return(false); } //move in close to the object and if not possible quit the interaction. if (!CarrySystem.PickUp(base.Actor, base.Target)) { return(false); } //pick up object and then bring it to a surface. CAS.SimDescription receiver = getSimSelection(); if (receiver != null) { String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100"); //must parse the string into an integer int amount = 0; if (int.TryParse(samount, out amount) && receiver != null) { transferFunds(base.Actor.SimDescription, receiver, amount); } else { base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking); return(false); //exit interaction when user enters invalid value } } else { return(false); } checkAnimation(); //end with animation return(true); //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true); }
private bool StartCookingProcessWithFoodTray(string menuText, string[] menuPath, Recipe.MealDestination destination, Recipe.MealQuantity quantity, Recipe.MealRepetition repetition) { List <Ingredient> ingredientsUsed = new List <Ingredient>(); if (!this.Actor.IsNPC && !AniRecipe.UseUpIngredientsFrom(this.ChosenRecipe, this.Actor, ref ingredientsUsed, quantity, false)) { return(false); } this.Actor.SkillManager.AddElement(SkillNames.Cooking); FoodTray foodTray = (FoodTray)GlobalFunctions.CreateObject("FoodTray", Vector3.OutOfWorld, 0, Vector3.UnitZ); foodTray.CookingProcess = new CookingProcess(this.ChosenRecipe, ingredientsUsed, this.Target, this.Target.LotCurrent, destination, quantity, repetition, menuText, menuPath, foodTray, this.Actor); foodTray.CreateFoodProp(Slots.Hash("Slot_0"), foodTray.CookingProcess.Recipe.ModelsAndMaterials.GrillModel_FoodTray); CookingProcess.MoveToNextStep(foodTray, this.Actor); CookingProcess.MoveToNextStep(foodTray, this.Actor); CookingProcess.MoveToNextStep(foodTray, this.Actor); StateMachineClient stateMachineClient = StateMachineClient.Acquire(this.Actor.Proxy.ObjectId, "Grill"); if (stateMachineClient == null) { return(false); } stateMachineClient.AddInterest <TraitNames>(TraitNames.Clumsy); stateMachineClient.SetActor("x", this.Actor); stateMachineClient.SetActor("FoodTray", foodTray); stateMachineClient.EnterState("x", "Enter - Hands Empty"); stateMachineClient.RequestState("x", "Take Out Food Tray"); stateMachineClient.RequestState("x", "Exit - Holding Food Tray"); if (this.Actor.HasExitReason(ExitReason.Canceled)) { CarrySystem.EnterWhileHolding(this.Actor, foodTray); Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal); return(false); } CarrySystem.EnterWhileHolding(this.Actor, foodTray); InteractionInstance instance = FoodTray_Prepare.Singleton.CreateInstance(foodTray, this.Actor, this.Actor.InheritedPriority(), base.Autonomous, true); return(this.Actor.InteractionQueue.PushAsContinuation(instance, true)); }
public static bool CreateAndCarryshoppingBag(Sim sim) { bool flag = false; Suitcase suitcase = (GlobalFunctions.CreateObjectOutOfWorld("suitcaseVintage", ProductVersion.EP9) as Suitcase); //if (suitcase != null) //{ // if (sim.ParentToRightHand(suitcase)) // { // CarrySystem.EnterWhileHolding(sim, suitcase); // } //} if (suitcase != null) { flag = sim.TryAddObjectToInventory(suitcase); if (flag) { flag = CarrySystem.PickUpFromSimInventory(sim, suitcase, true); } } return(flag); }
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); } }
public override bool InRabbitHole() { string msg = "HaveAlienBabyHosptial:InRabbitHole" + "\n"; try { while (!Actor.WaitForExitReason(Sim.kWaitForExitReasonDefaultTime, ExitReason.CanceledByScript)) { if (BabyShouldBeBorn) { break; } } msg += "A"; if (!BabyShouldBeBorn && Actor.HasExitReason(ExitReason.CanceledByScript)) { return(false); } msg += "B"; Pregnancy pregnancy = Actor.SimDescription.Pregnancy; bool isSelectable = Actor.IsSelectable; Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave"); mNewborns = new PregnancyProxy(pregnancy).CreateNewborns(Pregnancy.HaveBabyHospital.kBonusMoodPointsForHospitalBirth, isSelectable, false); msg += "C"; Actor.SimDescription.SetPregnancy(0f); List <Sim> simFollowers = SimFollowers; new PregnancyProxy(pregnancy).PregnancyComplete(mNewborns, simFollowers); /* * if (mNewborns.Count == 4) * { * Actor.BuffManager.RemoveElement(BuffNames.ItsABoy); * Actor.BuffManager.AddElement(CommonPregnancy.sItsQuadruplets, Origin.FromNewBaby); * } */ msg += "D"; Simulator.Sleep(0u); //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 = 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)) { Simulator.Sleep(0u); //SpeedTrap.Sleep(); } try { ChildUtils.CarryChild(target, actor, false); } catch (Exception e) { Logger.WriteExceptionLog(e, this, "HaveAlienBabyHospital.Run() Error - CarryChild()"); } 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); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Logger.WriteExceptionLog(e, this, "HaveAlienBabyHospital.Run() Error"); return(false); } }
public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; if (interactionDefinition == null) { return(false); } ObjectGuid mObject = interactionDefinition.mObject; int mCost = interactionDefinition.mCost; if (mObject == ObjectGuid.InvalidObjectGuid) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); if (!Autonomous && Actor.IsSelectable) { List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); foreach (ObjectGuid current in objectsICanBuyInDisplay) { GameObject obj = GlobalFunctions.ConvertGuidToObject <GameObject>(current); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(current, new List <ObjectPicker.ColumnInfo> { new ObjectPicker.ThumbAndTextColumn(obj.GetThumbnailKey(), obj.GetLocalizedName()), new ObjectPicker.MoneyColumn(DisplayHelper.ComputeFinalPriceOnObject(obj, true)) }); list.Add(item); } List <ObjectPicker.HeaderInfo> list2 = new List <ObjectPicker.HeaderInfo>(); List <ObjectPicker.TabInfo> list3 = new List <ObjectPicker.TabInfo>(); list2.Add(new ObjectPicker.HeaderInfo(ShoppingRegister.sLocalizationKey + ":BuyFoodColumnName", ShoppingRegister.sLocalizationKey + ":BuyFoodColumnTooltip", 200)); list2.Add(new ObjectPicker.HeaderInfo("Ui/Caption/Shopping/Cart:Price", "Ui/Tooltip/Shopping/Cart:Price")); list3.Add(new ObjectPicker.TabInfo("", ShoppingRegister.LocalizeString("AvailableFoods"), list)); List <ObjectPicker.RowInfo> list4 = SimplePurchaseDialog.Show(ShoppingRegister.LocalizeString("BuyFoodTitle"), Actor.FamilyFunds, list3, list2, true); if (list4 == null || list4.Count != 1) { return(false); } mObject = (ObjectGuid)list4[0].Item; mCost = ((ObjectPicker.MoneyColumn)list4[0].ColumnInfo[1]).Value; } else { RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay); int familyFunds = base.Actor.FamilyFunds; for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { int cost = DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]); if (cost <= familyFunds) { //Definition continuationDefinition = new Definition(objectsICanBuyInDisplay[i], cost, false); //base.TryPushAsContinuation(continuationDefinition); //return true; mObject = objectsICanBuyInDisplay[i]; mCost = cost; break; } } //return false; } } if (mObject == ObjectGuid.InvalidObjectGuid) { return(false); } if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping())) { return(false); } base.Actor.RouteTurnToFace(base.Target.Position); if (!DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target).Contains(mObject)) { return(false); } if (base.Actor.FamilyFunds < mCost) { return(false); } GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(mObject); if (target == null) { return(false); } base.StandardEntry(); base.BeginCommodityUpdates(); string swipeAnimationName = base.Target.GetSwipeAnimationName(target); if (Actor.SimDescription.Child) { swipeAnimationName = "c" + swipeAnimationName.Substring(1); } base.Actor.PlaySoloAnimation(swipeAnimationName, true); VisualEffect effect = VisualEffect.Create(base.Target.GetSwipeVfxName()); Vector3 zero = Vector3.Zero; Vector3 axis = Vector3.Zero; if (Slots.AttachToBone(effect.ObjectId, base.Target.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref axis, 0f) == TransformParentingReturnCode.Success) { effect.SetAutoDestroy(true); effect.Start(); } else { effect.Dispose(); effect = null; } //bool flag = false; //bool flag2 = false; bool succeeded = false; bool addInteractions = true; string tnsKey = null; if (target.IsLiveDraggingEnabled() && !target.InUse && (interactionDefinition.mPushEat || (target.ItemComp != null && target.ItemComp.CanAddToInventory(base.Actor.Inventory) && base.Actor.Inventory.CanAdd(target)))) //&& base.Actor.Inventory.TryToAdd(target))) { ServingContainerGroup groupServing = null; if (interactionDefinition.mSingleServing) { groupServing = target as ServingContainerGroup; if (groupServing != null) { target = groupServing.CookingProcess.CreateSingleServingOfFood(groupServing, true, true); addInteractions = false; } } if (interactionDefinition.mPushEat) { target.SetOpacity(0f, 0f); if (Actor.ParentToRightHand(target)) { succeeded = true; CarrySystem.EnterWhileHolding(Actor, target as ICarryable); } target.FadeIn(); } else if (Actor.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInPersonalInventory"; } if (succeeded) { if (groupServing != null) { groupServing.DecrementServings(); if (groupServing.NumServingsLeft == 0) { groupServing.FadeOut(false, true); } } } else if (groupServing != null && target != null) { target.Destroy(); } } else if (!target.InUse && base.Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInFamilyInventory"; } //bool succeeded = flag || flag2; if (succeeded) { if (addInteractions) { Target.OnHandToolChildUnslotted(target, Slot.None); if (target is Snack) { target.AddInteraction(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton, true); target.AddInteraction(Snack_CleanUp.Singleton, true); } } /*if (flag2) * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInFamilyInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * } * else * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInPersonalInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * }*/ if (tnsKey != null) { Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(Actor.IsFemale, tnsKey, new object[] { Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); } base.Target.GiveMarkupBuffs(base.Actor, mObject); base.Actor.ModifyFunds(-mCost); base.Target.GiveLotOwnerMoney(mCost, base.Actor); base.Target.AccumulateRevenue(mCost); if (interactionDefinition.mPushEat) { (target as IFoodContainer).PushEatHeldFoodInteraction(Actor); } } base.EndCommodityUpdates(succeeded); base.StandardExit(); return(succeeded); }
protected override bool Run() { if (base.Actor.Inventory.Contains(base.Target)) { if (!CarrySystem.PickUpFromSimInventory(base.Actor, this.Target)) { return(false); } } else if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f)) { if (!CarrySystem.PickUp(base.Actor, base.Target)) { return(false); } //pick up object and then bring it to a surface. return(false); } //move in close to the object and if not possible quit the interaction. //alternate path depending on whether the checkbook is already in the inventory. //place on surface and then enter the chair placeOnSurface(); /* * if (this.mCheckBookSurface != null) { * SurfaceSlot surfaceSlotFramContainedObject = this.mCheckBookSurface.Surface.GetSurfaceSlotFromContainedObject(this.Target); * this.mChecBookSlot = surfaceSlotFramContainedObject.ContainmentSlot; * Slot chairslot = surfaceSlotFramContainedObject.ChairSlots[0]; * ISittable Chair = (ISittable) mCheckBookSurface.GetContainedObject(chairslot); * InteractionInstance sitOnChair = Chair.RouteToForSitting(base.Actor, chairslot, true,; * //base.Actor.RouteToSlot(this.Target, mChecBookSlot); * ChildUtils.SetPosturePrecondition(this, CommodityKind.Sitting, new CommodityKind[] * { * CommodityKind.InFrontOfSurfaceForTarget, * CommodityKind.ChairScootedIntoSurface * }); * * } * */ CAS.SimDescription receiver = getSimSelection(); if (receiver != null) { String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100"); //must parse the string into an integer int amount = 0; if (int.TryParse(samount, out amount) && receiver != null) { transferFunds(base.Actor.SimDescription, receiver, amount); } else { base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking); return(false); //exit interaction when user enters invalid value } } else { return(false); } checkAnimation(); //end with animation base.Actor.ShowTNSIfSelectable("Ended animation.", StyledNotification.NotificationStyle.kSimTalking); //CarrySystem.AnimateIntoSimInventory(base.Actor); animation errors out in null. Probably because of table base.Actor.ShowTNSIfSelectable("Ended animate into.", StyledNotification.NotificationStyle.kSimTalking); base.Actor.Inventory.TryToAdd(this.Target); base.Actor.ShowTNSIfSelectable("Ended method", StyledNotification.NotificationStyle.kSimTalking); return(true); //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true); }
public override bool Run() { try { BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee); if ((element != null) && (element.mTimeoutCount <= Urinal.kTimeoutRemainingForBladderEmergency)) { RequestWalkStyle(Sim.WalkStyle.Run); } if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Urinal.kTimeToWaitInLine)) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } ClearRequestedWalkStyles(); if (Shooless.Settings.GetPrivacy(Target)) { mSituation = Urinal.UrinalSituation.Create(Actor, Actor.LotCurrent); } if (mSituation != null) { if (!mSituation.Start()) { return(false); } if (!Target.RouteToUrinalAndCheckInUse(Actor)) { return(false); } } CancellableByPlayer = false; StandardEntry(); mCurrentStateMachine = Target.GetStateMachine(Actor); Glass.CarryingGlassPosture posture = Actor.Posture as Glass.CarryingGlassPosture; if (posture != null) { mDrinkInHand = posture.ObjectBeingCarried as Glass; CarrySystem.ExitCarry(Actor); mDrinkInHand.FadeOut(true); mDrinkInHand.UnParent(); Actor.PopPosture(); SetParameter("hasDrink", true); SetActor("drink", mDrinkInHand); if (Target.HasDrinkSlot && (Target.GetContainedObject(Slot.ContainmentSlot_0) == null)) { mDrinkInHand.ParentToSlot(Target, Slot.ContainmentSlot_0); mDrinkInHand.FadeIn(); } } mCensorEnabled = true; Actor.EnableCensor(Sim.CensorType.LowerBody); AddOneShotScriptEventHandler(0x78, OnAnimationEvent); AnimateSim("use"); if (element != null) { element.mTimeoutPaused = true; } if (Actor.HasTrait(TraitNames.Inappropriate)) { mWillFart = RandomUtil.RandomChance01(Urinal.kChanceInappropriateFart); if (mWillFart) { mFartTime = RandomUtil.RandomFloatGaussianDistribution(0.1f, 0.9f); } } BeginCommodityUpdate(CommodityKind.Bladder, 0f); BeginCommodityUpdates(); bool succeeded = false; try { Actor.Motives.LerpToFill(this, CommodityKind.Bladder, Urinal.kMaxLengthUseToilet); StartStages(); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext), new Interaction <Sim, Urinal> .InsideLoopFunction(LoopFunc), mCurrentStateMachine); } finally { EndCommodityUpdates(succeeded); } if (succeeded) { Motive motive = Actor.Motives.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } if (element != null) { element.mTimeoutPaused = false; } if (Target.IsCleanable) { Target.Cleanable.DirtyInc(Actor); } bool flag2 = Target.Line.MemberCount() > 0x1; InteractionInstance instance = null; if ((mSituation == null) || !mSituation.SomeoneDidIntrude) { if (Target.AutoFlushes) { Target.FlushToilet(Actor, mCurrentStateMachine, false); } else { Target.ToiletVolume++; if (Target.ShouldFlush(Actor, Autonomous)) { Target.FlushToilet(Actor, mCurrentStateMachine, true); } } if (((mDrinkInHand == null) && Urinal.ShouldWashHands(Actor)) && !flag2) { Sink target = Toilet.FindClosestSink(Actor); if (target != null) { instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true); } } } AddOneShotScriptEventHandler(0x68, OnAnimationEvent); AddOneShotScriptEventHandler(0x64, OnAnimationEvent); AnimateSim("exit"); if (mSituation != null) { mSituation.ExitUrinalSituation(); } if (mDrinkInHand != null) { CarrySystem.EnterWhileHolding(Actor, mDrinkInHand); Actor.Posture = new Glass.CarryingGlassPosture(Actor, mDrinkInHand); mDrinkInHand.FadeIn(); } if (flag2) { PrivacySituation.RouteToAdjacentRoom(Actor); } StandardExit(); if (instance != null) { Actor.InteractionQueue.PushAsContinuation(instance, true); } if (!flag2 && (instance == null)) { Actor.RouteAway(Urinal.kMinDistanceToMoveAwayAfterUsingUrinal, Urinal.kMaxDistanceToMoveAwayAfterUsingUrinal, false, GetPriority(), true, true, true, RouteDistancePreference.NoPreference); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override bool Run() { try { if (this.CheckForCancelAndCleanup()) { return(false); } if (!this.Target.RouteToOpen(this, true)) { return(false); } if (this.Target.InUse) { this.Actor.AddExitReason(ExitReason.RouteFailed); return(false); } this.mImpassableRegion.AddMember(this.Actor); this.mImpassableRegion.AddMember(this.Target); this.mImpassableRegion.UpdateFootprint(); base.StandardEntry(); if (this.Actor.SimDescription.TeenOrAbove && !this.ChosenRecipe.IsSnack) { this.Actor.SkillManager.AddElement(SkillNames.Cooking); } bool flag = true; List <Ingredient> ingredientsUsed = new List <Ingredient>(); if (AniRecipe.UseUpIngredientsFrom(this.ChosenRecipe, this.Actor, ref ingredientsUsed, this.Quantity, this.ChosenRecipe.IsSnack) || this.Actor.IsNPC) { //If the food is a snack, remove ingredient if (this.ChosenRecipe.IsSnack && !this.Actor.IsNPC) { Recipe snack = AniRecipe.ReturnSnackIngredientRecipe(this.Actor, this.ChosenRecipe); if (snack != null) { //Create new temp ingredient list foreach (var item in ingredientsUsed) { item.Destroy(); } ingredientsUsed.Clear(); } } //CommonMethods.PrintMessage("Snack: " + this.ChosenRecipe.IsSnack + " / " + ingredientsUsed.Count.ToString()); Fridge.EnterStateMachine(this); IRemovableFromFridgeAsInitialRecipeStep removableFromFridgeAsInitialRecipeStep = GlobalFunctions.CreateObjectOutOfWorld(this.ChosenRecipe.ObjectToCreateInFridge, this.ChosenRecipe.ModelCodeVersion) as IRemovableFromFridgeAsInitialRecipeStep; GameObject gameObject = removableFromFridgeAsInitialRecipeStep as GameObject; gameObject.AddToUseList(this.Actor); try { this.Target.PutOnFridgeShelf(gameObject); this.mThingToPrepareOrEat = (removableFromFridgeAsInitialRecipeStep as IPartOfCookingProcess); this.mThingToPrepareOrEat.CookingProcess = new CookingProcess(this.ChosenRecipe, ingredientsUsed, this.ObjectClickedOn, this.Target.LotCurrent, this.Destination, this.Quantity, this.Repetition, this.MenuText, this.MenuPath, removableFromFridgeAsInitialRecipeStep as IPartOfCookingProcess, this.Actor); removableFromFridgeAsInitialRecipeStep.InitializeForRecipe(this.ChosenRecipe, false); CookingProcess.MoveToNextStep(removableFromFridgeAsInitialRecipeStep as IPartOfCookingProcess, this.Actor); base.SetActor(removableFromFridgeAsInitialRecipeStep.ActorNameForFridge, gameObject); if (this.mbWasHaveSomething) { base.AnimateSim("Ponder"); } base.AnimateSim("Remove - " + removableFromFridgeAsInitialRecipeStep.ActorNameForFridge); this.TriggerWatchCookingReactionBroadcaster(); } catch (Exception ex) { if (ex == null) { } gameObject.Destroy(); throw; } CarrySystem.EnterWhileHolding(this.Actor, removableFromFridgeAsInitialRecipeStep, false); if (this.CheckForCancelAndCleanup()) { return(false); } if (this.Actor.HasTrait(TraitNames.NaturalCook)) { TraitTipsManager.ShowTraitTip(13271263770231522448uL, this.Actor, TraitTipsManager.TraitTipCounterIndex.NaturalCook, TraitTipsManager.kNaturalCookCountOfMealsCooked); } if (this.Actor.HasTrait(TraitNames.Vegetarian)) { TraitTipsManager.ShowTraitTip(13271263770231522928uL, this.Actor, TraitTipsManager.TraitTipCounterIndex.Vegetarian, TraitTipsManager.kVegetarianCountOfMealsCooked); } this.PushNextInteraction(removableFromFridgeAsInitialRecipeStep, gameObject); base.AnimateSim("Exit - Standing"); } else { flag = false; } base.StandardExit(); if (flag) { ActiveTopic.AddToSim(this.Actor, "Has Made Food"); } return(flag); } catch (Exception ex) { CommonMethods.PrintMessage("Fridge: " + ex.Message); return(false); } }
public override bool Run() { try { if ((Book == null) || Book.HasBeenDestroyed) { return(false); } Book.AddToReferenceList(Actor); mAddedToReferenceList = true; InteractionDefinition readToSleepSingleton = null; InteractionDefinition beReadToSleepSingleton = null; // Custom IReadToSleepObject myBed = Target.Bed as IReadToSleepObject; if (myBed != null) { if (myBed.TestReadToSleep(Actor, Target)) { readToSleepSingleton = myBed.GetReadToSleepSingleton(); beReadToSleepSingleton = myBed.GetBeReadToSleepSingleton(); } } if (beReadToSleepSingleton == null) { for (int i = 0; i < 2; i++) { foreach (IReadToSleepObject obj2 in Target.LotCurrent.GetObjects <IReadToSleepObject>()) { if ((i == 0) && (myBed != null)) { if (myBed.RoomId != obj2.RoomId) { continue; } } if (obj2.TestReadToSleep(Actor, Target)) { readToSleepSingleton = obj2.GetReadToSleepSingleton(); beReadToSleepSingleton = obj2.GetBeReadToSleepSingleton(); break; } } if (beReadToSleepSingleton != null) { break; } } } if ((readToSleepSingleton == null) && (beReadToSleepSingleton == null)) { return(false); } InteractionInstance entry = null; if (beReadToSleepSingleton != null) { entry = beReadToSleepSingleton.CreateInstanceWithCallbacks(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer, new Callback(OnChildStarted), new Callback(OnChildCompleted), new Callback(OnChildFailed)); entry.LinkedInteractionInstance = this; if (!Target.InteractionQueue.Add(entry)) { return(false); } } if (Book.InInventory) { if (!Actor.Inventory.Contains(Book)) { IGameObject closestBookshelf; Bookshelf_GetBook.Definition definition3 = new Bookshelf_GetBook.Definition(Book); if (kAlwaysUseClosestBookshelf && (ClosestBookshelf != null)) { closestBookshelf = ClosestBookshelf; } else { closestBookshelf = Book.ItemComp.InventoryParent.Owner; } if (!definition3.CreateInstance(closestBookshelf, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction()) { return(false); } } } else { if (!CarrySystem.PickUp(Actor, Book)) { return(false); } if (!CarrySystem.PutInSimInventory(Actor)) { return(false); } } if (!Actor.Inventory.Contains(Book)) { return(false); } if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { return(false); } LinkedInteractionInstance = null; InteractionInstance instance = readToSleepSingleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer); instance.LinkedInteractionInstance = entry; (instance as IReadToSleepInteraction).ReservedBook = Book; return(Actor.InteractionQueue.PushAsContinuation(instance, true)); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override bool Run() { try { if (!Target.IsActorUsingMe(Actor)) { List <ISurface> objectsInRoom = Actor.LotCurrent.GetObjectsInRoom <ISurface>(Actor.RoomId); if (!CarrySystem.PutDownOnNearestSurface(Actor, objectsInRoom, SurfaceType.Normal, false, false, true)) { CarrySystem.PutDownOnFloor(Actor); } if (!Actor.RouteToSlotList(Target, Target.UseableSlots(Actor, false, true), out mSlotIndex)) { return(false); } Target.SetRoutingSlotInUse(mSlotIndex); if (Actor.HasExitReason()) { return(false); } SetPriority(new InteractionPriority(InteractionPriorityLevel.High)); mActorFairy = Actor.SimDescription.OccultManager.GetOccultType(OccultTypes.Fairy) as OccultFairy; StandardEntry(); BeginCommodityUpdates(); EnterStateMachine("fairyhouseaccess", "Enter", "x"); SetParameter("Slot", FairyHouse.kSlotToCompass[mSlotIndex]); if (mActorFairy != null) { mActorFairy.AttachTrueFairyFormToAnimation(mCurrentStateMachine); } AddOneShotScriptEventHandler(0x65, OnHideActorEx); AnimateSim("Fly In"); if (mActorFairy != null) { mActorFairy.HideFairyTrueFormHardStop(); } FairyHouse.FairyHousePosture posture = new FairyHouse.FairyHousePosture(Actor, Target, mCurrentStateMachine); Actor.Posture = posture; Actor.BridgeOrigin = posture.Idle(); PlumbBob.Reparent(); if (!Target.IsLightOn()) { Target.TurnOnLight(); } EndCommodityUpdates(true); StandardExit(false, false); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
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); }
public CarryHandler(CarrySystem mod) => Mod = mod;
public CarryHandler(CarrySystem system) => System = system;
public override bool Run() { if (this.Target.Parent != this.Actor && !(CarrySystem.PickUp(this.Actor, (ICustomCarryable)this.Target, new SacsEventHandler(this.Target.OnPickUp), 0U))) { Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:cannot_pickUp_clothingPile"); return(false); } this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail; this.BeginCommodityUpdates(); if (this.ActiveStage != null) { ClothingPileDry currentPile; do { currentPile = (this.ActiveStage as RoomVsLotStage <ClothingPileDry>).GetNext(); if (currentPile != null) { if (this.Actor.RouteToObjectRadiusAndCheckInUse((IGameObject)currentPile, currentPile.CarryRouteToObjectRadius) && currentPile.Parent == null) { this.Actor.CarryStateMachine.AddOneShotScriptEventHandler(113U, (SacsEventHandler)((A_1, A_2) => currentPile.FadeOut(false))); this.Actor.CarryStateMachine.RequestState("x", "PickUpAnother"); this.Actor.CarryStateMachine.RequestState("x", "Carry"); this.Target.AddClothingPile(currentPile); currentPile.Destroy(); } this.Actor.RemoveExitReason(ExitReason.RouteFailed | ExitReason.ObjectInUse); } }while(currentPile != null && !this.Actor.HasExitReason()); } this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail; this.Stages = (List <Sims3.Gameplay.Interactions.Stage>)null; this.Actor.InteractionQueue.FireQueueChanged(); if (!this.Actor.HasExitReason()) { this.EndCommodityUpdates(true); Hamper closestObject1 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.Position, ClothingPileDry.kRadiusToConsiderHampers), (IGameObject)this.Actor, new Predicate <Hamper>(ClothingPileDry.CleanUp.DoesHamperHaveSpaceLeft)); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject1, true); return(true); } if (!this.Autonomous || !this.Target.LotCurrent.LaundryManager.GivesFreshClothingBuff) { WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor, new Predicate <WashingMachine>(ClothingPileDry.CleanUp.IsWashingMachineUsable)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject2, true); return(true); } } Hamper closestObject3 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.LotCurrent), (IGameObject)this.Actor); if (closestObject3 != null) { this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject3, true); return(true); } WashingMachine closestObject4 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor); if (closestObject4 == null) { return(this.Target.PutInInventory(this.Actor)); } this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject4, false); return(true); } Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:this.Actor.HasExitReason():" + this.Actor.ExitReason); this.EndCommodityUpdates(false); return(false); }