protected override bool PrivateUpdate(ScenarioFrame frame) { Household house = Lot.Household; foreach (GameObject obj in Lot.GetObjects <GameObject>()) { if (!obj.Charred) { RepairableComponent repair = obj.Repairable; if (repair == null) { continue; } if (!repair.TestReplace()) { continue; } } else { if (obj is PlumbBob) { obj.Charred = false; continue; } } try { IncStat("Found: " + obj.CatalogName); } catch { } GameObject go = null; try { go = RepairableComponent.CreateReplaceObject(obj); } catch (Exception e) { Common.DebugException(obj.CatalogName, e); } if (go == null) { continue; } IncStat("Replaced"); if (house != null) { Money.AdjustFunds(house, "Replacement", -obj.Cost); } } return(true); }
protected override OptionResult Run(Lot lot, Household me) { if (lot == null) { return(OptionResult.Failure); } foreach (GameObject obj in lot.GetObjects <GameObject>()) { if ((obj.InUse) || (!obj.InWorld)) { continue; } if (obj.Charred) { obj.Charred = false; if (obj is Windows) { RepairableComponent.CreateReplaceObject(obj); } } RepairableComponent repairable = obj.Repairable; if ((repairable != null) && (repairable.Broken)) { repairable.ForceRepaired(Sim.ActiveActor); } } LotLocation[] burntTiles = World.GetBurntTiles(lot.LotId, LotLocation.Invalid); if (burntTiles.Length > 0x0) { foreach (LotLocation burnt in burntTiles) { if ((lot.LotLocationIsPublicResidential(burnt)) && ((lot.TombRoomManager == null) || !lot.TombRoomManager.IsObjectInATombRoom(burnt))) { World.SetBurnt(lot.LotId, burnt, false); } } } return(OptionResult.SuccessClose); }