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); }