Example #1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Household rentalOwner = null;

            if (Lot.ResidentialLotSubType == ResidentialLotSubType.kEP10_PrivateLot)
            {
                foreach (Household house in Household.GetHouseholdsLivingInWorld())
                {
                    if (house.RealEstateManager == null)
                    {
                        continue;
                    }

                    PropertyData data = house.RealEstateManager.FindProperty(Lot);
                    if (data == null)
                    {
                        continue;
                    }

                    if (data.PropertyType == RealEstatePropertyType.PrivateLot)
                    {
                        continue;
                    }

                    rentalOwner = house;
                    break;
                }
            }
            else if (!RentalHelper.IsRentable(Money, Lot))
            {
                rentalOwner = Money.GetDeedOwner(Lot);
            }

            if (rentalOwner == null)
            {
                return(false);
            }

            SimDescription headOfFamily = SimTypes.HeadOfFamily(rentalOwner);

            if ((headOfFamily != null) && (headOfFamily.CreatedSim != null))
            {
                RentalHelper.SellRentalLot(Money, headOfFamily.CreatedSim, Lot);

                IncStat("Sold");
            }
            return(true);
        }