8000 bug: used-bottles-store built outside of CITY_RADIUS won't get used bottles · Issue #321 · bahrmichael/factorio-tycoon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
winex opened this issue May 5, 2024 · 1 comment · Fixed by #332
Closed

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

winex opened this issue May 5, 2024 · 1 comment · Fixed by #332
Assignees
Labels
bug Something isn't working

Comments

@winex
Copy link
Contributor
winex commented May 5, 2024

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]:

factorio-tycoon/util.lua

Lines 288 to 297 in 1bf7bd5

if city.special_buildings.other[name] ~= nil and #city.special_buildings.other[name] > 0 then
entities = city.special_buildings.other[name]
else
entities = game.surfaces[city.surface_index].find_entities_filtered{
name=name,
position=city.center,
radius=Constants.CITY_RADIUS,
}
city.special_buildings.other[name] = entities
end

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

possible solutions

  • bad: increase search radius for all special buildings
  • good 1/3: such special buildings should never be built outside of city radius. make some space closer to center somehow (shoot some houses?)
  • good 2/3: building locations should be iterated in spiral from the center, adding some "bad" weight to queue in case of failure, so that very bad locations will be checked very rarely instead of linear iteration
  • good 3/3: increase attempts (10 currently) and check that this works... ;)
@bahrmichael
Copy link
Owner

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.

@bahrmichael bahrmichael self-assigned this May 6, 2024
@bahrmichael bahrmichael added the bug Something isn't working label May 6, 2024
@bahrmichael bahrmichael added this to the 1.0 Release Candidate milestone Jul 14, 2024
@bahrmichael bahrmichael mentioned this issue Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0