Page 1 of 1

Plant - agricultural tower relations

Posted: Sat May 10, 2025 12:54 pm
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 334 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

Re: Plant - agricultural tower relations

Posted: Mon May 12, 2025 2:47 pm
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.

Re: Plant - agricultural tower relations

Posted: Mon May 12, 2025 5:28 pm
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?

Re: Plant - agricultural tower relations

Posted: Mon May 12, 2025 5:40 pm
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.