Пример #1
0
        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);
            }
        }