bahrmichael / factorio-tycoon

GNU General Public License v3.0
8 stars 6 forks source link

bug: used-bottles-store built outside of CITY_RADIUS won't get used bottles #321

Open winex opened 2 months ago

winex commented 2 months ago

reqs

  1. city is already large enough that it builds houses farther than Constants.CITY_RADIUS
  2. player researches bottling, so city must build tycoon-used-bottles-store somewhere outside of that limit

what happens

if any tycoon-used-bottles-store is outside of radius, this code denies to cache it in global.tycoon_cities[N].special_buildings.other[name]: https://github.com/bahrmichael/factorio-tycoon/blob/1bf7bd54538460bfc483e0b6fb7ec6d19491bcc2/util.lua#L288-L297

moving it manually (PickerDollies mod) inside city radius makes it working again...

possible solutions

bahrmichael commented 2 months ago

Thanks for reporting this!

I want to take a slightly different approach: A different mechanism for finding entities that the city places itself. Just as we store the town hall in a dedicated field, I'll do the same with the bottle return station.

        special_buildings = {
            town_hall = nil,
            other = {}
        },

Eventually we may want to restructure that to

        special_buildings = {
            city_owned = {},
            player_owned = {}
        },

I think that way I can just drop the call to list_special_buildings.

Long term I'm thinking about a city radius that expands as the city grows (like a polygon), but that's still a bit further out.