public override bool Test(Sim a, ClothingPileWet target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (Sims3.Gameplay.Queries.CountObjects <Clothesline>(target.LotCurrent) == 0U) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(ClothingPileWet.DryClothesOnClothesline.NoClotheslinesOnLotToolTip); return(false); } if (Clothesline.FindClosestAvailibleClothesline((GameObject)target, a) == null) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(ClothingPileWet.DryClothesOnClothesline.NoAvailibleClotheslinesOnLot); return(false); } 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() { 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); }
protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); LaundryState state; if (!mPushed.TryGetValue(Sim.Household, out state)) { state = new LaundryState(); mPushed.Add(Sim.Household, state); } List <GameObject> broken = new List <GameObject>(); if (!state.mDryer) { List <ClothingPileWet> wetPiles = new List <ClothingPileWet>(Sim.LotHome.GetObjects <ClothingPileWet>()); foreach (ICanDryClothes obj in Sim.LotHome.GetObjects <ICanDryClothes>()) { if (obj.IsAvailible()) { continue; } Clothesline line = obj as Clothesline; if (line != null) { IncStat("Try Empty Line"); if (Situations.PushInteraction(this, Sim, line, Clothesline.GetCleanLaundry.Singleton)) { state.mDryer = true; IncStat("Push Empty Line"); return(true); } if (wetPiles.Count > 0) { ClothingPileWet pile = RandomUtil.GetRandomObjectFromList(wetPiles); wetPiles.Remove(pile); if (Situations.PushInteraction(this, Sim, pile, ClothingPileWet.DryClothesOnClothesline.Singleton)) { state.mDryer = true; IncStat("Hang Wet Pile"); return(true); } } } else { Dryer dryer = obj as Dryer; if (dryer != null) { IncStat("Try Empty Dryer"); if (Situations.PushInteraction(this, Sim, dryer, Dryer.GetCleanLaundry.Singleton)) { state.mDryer = true; IncStat("Push Empty Dryer"); return(true); } if (wetPiles.Count > 0) { ClothingPileWet pile = RandomUtil.GetRandomObjectFromList(wetPiles); wetPiles.Remove(pile); if (Situations.PushInteraction(this, Sim, pile, ClothingPileWet.DryClothesInDryer.Singleton)) { state.mDryer = true; IncStat("Dry Wet Pile"); return(true); } } if ((dryer.Repairable != null) && (dryer.Repairable.Broken)) { broken.Add(dryer); } } } } } if (!state.mWasher) { foreach (WashingMachine machine in Sim.LotHome.GetObjects <WashingMachine>()) { if (machine.mWashState == WashingMachine.WashState.HasCleanLaundry) { if (WashingMachine.DryClothesBase.DoesClotheslineExist(Sim.LotHome)) { IncStat("Try Clothesline"); if (Situations.PushInteraction(this, Sim, machine, WashingMachine.DryClothesOnClothesline.Singleton)) { state.mWasher = true; IncStat("Push Clothesline"); return(true); } } else { IncStat("Try Dryer"); if (Situations.PushInteraction(this, Sim, machine, WashingMachine.DryClothesInDryer.Singleton)) { state.mWasher = true; IncStat("Push Dryer"); return(true); } } } else if (machine.CanDoLaundry()) { IncStat("Try Washer"); if (Situations.PushInteraction(this, Sim, machine, WashingMachine.DoLaundry.Singleton)) { state.mWasher = true; IncStat("Push Washer"); return(true); } } if ((machine.Repairable != null) && (machine.Repairable.Broken)) { broken.Add(machine); } } } if (broken.Count > 0) { IncStat("Repair Push"); Add(frame, new ScheduledRepairScenario(Sim, RandomUtil.GetRandomObjectFromList(broken)), ScenarioResult.Start); return(true); } return(false); }