public override bool Test(Sim a, Clothesline target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.LotCurrent.GetObjects <ClothingPileWet>().Length == 0 && (a.GetObjectInRightHand() as ClothingPileWet) == null && GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone)) == null) { return(false); } return(target.CurClothesState == Dryer.DryerState.Empty); }
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 Test(Sim a, WashingMachine target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.mWashState != WashingMachine.WashState.HasCleanLaundry) { return(false); } if (!WashingMachine.DryClothesBase.DoesClotheslineExist(target.LotCurrent)) { if (!target.LotCurrent.IsCommunityLot && !WashingMachine.DryClothesBase.DoesDryerExist(target.LotCurrent)) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(WashingMachine.DryClothesOnClothesline.NoClotheslinesOnLotToolTip); } return(false); } if (Clothesline.FindClosestAvailibleClothesline((GameObject)target, a) == null) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(WashingMachine.DryClothesOnClothesline.NoAvailibleClotheslinesOnLot); return(false); } return(true); }
private void Start() { clothesline = GetComponentInParent <Clothesline>(); }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanup Laundromat"); foreach (Lot lot in LotManager.AllLots) { if (!Allow(lot)) { continue; } foreach (GameObject obj in lot.GetObjects <GameObject>()) { WashingMachine washing = obj as WashingMachine; if (washing != null) { if (washing.mWashState != WashingMachine.WashState.Empty) { Overwatch.Log("Washer Emptied"); washing.SetObjectToReset(); washing.RemoveClothes(); } } else { Dryer dryer = obj as Dryer; if (dryer != null) { if (dryer.CurDryerState != Dryer.DryerState.Empty) { Overwatch.Log("Dryer Emptied"); dryer.ForceDryerDone(); dryer.TakeClothes(false); dryer.SetGeometryState("empty"); } } else { Clothesline line = obj as Clothesline; if (line != null) { if (line.CurClothesState != Dryer.DryerState.Empty) { Overwatch.Log("Line Emptied"); if (line.mDripFX == null) { line.StartDrying(); } line.ForceClothesDry(); line.ClothesTaken(); } } } } } } if (prompt) { Overwatch.AlarmNotify(Common.Localize("CleanupLaundromat:Complete")); } } catch (Exception e) { Common.Exception(Name, e); } }
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); }
public override bool Test(Sim a, Clothesline target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return(target.CurClothesState == Dryer.DryerState.Done); }
private void Start() { clothesline = GetComponentInParent <Clothesline>(); col = GetComponent <Collider2D>(); }