Beispiel #1
0
        public static void MagicallyCleanUp(Lot lot, bool bAlsoRepair)
        {
            foreach (GameObject obj2 in lot.FindAllObjectsToClean())
            {
                if (!obj2.InUse)
                {
                    if (obj2.IsCleanable)
                    {
                        obj2.Cleanable.ForceClean();
                    }
                    IThrowAwayable awayable = obj2 as IThrowAwayable;
                    if (awayable != null)
                    {
                        awayable.ThrowAwayImmediately();
                    }
                    if (obj2 is Book)
                    {
                        Book book = obj2 as Book;
                        if (book.MyShelf != null)
                        {
                            if (!book.InInventory)
                            {
                                book.MyShelf.Inventory.TryToAdd(book);
                            }
                        }
                        else
                        {
                            Lot ownerLot = book.GetOwnerLot();
                            if (ownerLot == null)
                            {
                                ownerLot = lot;
                            }

                            List <Bookshelf> shelves = new List <Bookshelf> (ownerLot.GetObjects <Bookshelf> ());

                            if (shelves.Count > 0)
                            {
                                shelves[0].Inventory.TryToAdd(book);
                            }
                            else if (ownerLot.LotId == Sim.ActiveActor.LotHome.LotId)
                            {
                                Sim.ActiveActor.Household.SharedFamilyInventory.Inventory.TryToAdd(book);
                            }
                            else
                            {
                                book.FadeOut(false, true);
                            }
                        }
                    }
                }
            }
            LotLocation[] puddles = World.GetPuddles(lot.LotCurrent.LotId, LotLocation.Invalid);
            if (puddles.Length > 0)
            {
                foreach (LotLocation location in puddles)
                {
                    PuddleManager.RemovePuddle(lot.LotCurrent.LotId, location);
                }
            }
            LotLocation[] burntTiles = World.GetBurntTiles(lot.LotCurrent.LotId, LotLocation.Invalid);
            if (burntTiles.Length > 0)
            {
                foreach (LotLocation location2 in burntTiles)
                {
                    World.SetBurnt(lot.LotId, location2, false);
                }
            }
            if (bAlsoRepair)
            {
                lot.RepairAllObjects();
            }
        }