Plant - agricultural tower relations
Posted: Sat May 10, 2025 12:54 pm
When an agricultural tower is hovered over, the plants that it seeded are shown:
[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
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