bahrmichael / factorio-tycoon

GNU General Public License v3.0
10 stars 7 forks source link

refactor how we keep track of entities #323

Open bahrmichael opened 6 months ago

bahrmichael commented 6 months ago

For https://github.com/bahrmichael/factorio-tycoon/issues/321

We currently have a couple different ways to keep track of entities. This has evolved over time, and with https://github.com/bahrmichael/factorio-tycoon/issues/321 we may now have a good reason to refactor that. For example the town hall is stored as a field on the city, and other supply buildings are stored on a separate field which is invalidated and repopulated occasionally. And treasuries? No idea.

I'll document the current approaches here in more detail, and will then come up with a unified approach.

Todo: document calls to surface.create_entity, that should be easier than reading all the code

winex commented 6 months ago

i'd like to point to such calls as well as i think it fits here https://github.com/bahrmichael/factorio-tycoon/blob/fa921c720f4f255df11ee254911fb9872eaad27e/construction-event-handler.lua#L34-L40