Plant - agricultural tower relations

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
HermanyAI
Burner Inserter
Burner Inserter
Posts: 6
Joined: Fri Dec 16, 2016 11:35 pm
Contact:

Plant - agricultural tower relations

Post by HermanyAI »

When an agricultural tower is hovered over, the plants that it seeded are shown:
05-10-2025, 14-39-11.png
05-10-2025, 14-39-11.png (1.56 MiB) Viewed 158 times
It would be nice to have that exposed in runtime API, say with this signature:

[AgriculturalTower only] LuaEntity::get_owned_plants() -> array[LuaEntity]

I imagine the game engine doesn't keep track of the reverse relation, and really only this is enough. But in case it's not too hard and conflicting to introduce, something along the lines of

[Plant only] LuaEntity::plant_owner -> read LuaEntity?

would also be very appreciated.

My use cases for both are yet again for Item Cam 2. Plants can be followed, or well, stared at as they grow, and when chopped I change focus from plant to mining result item in origin tower. Without being able to make a direct relation right now, I have to make an assumption - I switch focus to first nearby tower that it thinks is within its planting bounds, which can fail if there are multiple
Genhis
Factorio Staff
Factorio Staff
Posts: 817
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: Plant - agricultural tower relations

Post by Genhis »

We don't track plant owners at the moment, so I added only LuaEntity::owned_plants for 2.0.49. Keep in mind that a plant can be registered in multiple agricultural towers.
HermanyAI
Burner Inserter
Burner Inserter
Posts: 6
Joined: Fri Dec 16, 2016 11:35 pm
Contact:

Re: Plant - agricultural tower relations

Post by HermanyAI »

Thank you, genuinely! You lot are the best. This can be considered implemented in my opinion
Genhis wrote: Mon May 12, 2025 2:47 pm Keep in mind that a plant can be registered in multiple agricultural towers.
Curious, would this mean that any one of the agricultural towers may mine that plant, or does it imply something else?
Genhis
Factorio Staff
Factorio Staff
Posts: 817
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: Plant - agricultural tower relations

Post by Genhis »

HermanyAI wrote: Mon May 12, 2025 5:28 pm Curious, would this mean that any one of the agricultural towers may mine that plant, or does it imply something else?
Correct, any of the towers can mine it.
Post Reply

Return to “Modding interface requests”