LuaEntity::effect_sources read

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 754
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

LuaEntity::effect_sources read

Post by raiguard »

Currently, there is no easy way to retrieve a list of what beacons are affecting a specific crafter. The method I'm using right now involves taking every beacon in the selection (the mod uses a selection tool), creating a bounding_box that represents its effect area, and iterating over every selected crafter to see if they collide. This is slow, ugly, and expensive.

Ideally it would just be a readable array of LuaEntities, but a function would work too if the game doesn't constantly store and update this information.

Thanks!
Don't forget, you're here forever.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16095
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaEntity::effect_sources read

Post by Rseding91 »

Currently that's how the base game does it as well.

There is a "list" but it's not in any order and so isn't deterministic to let mods read it.
If you want to get ahold of me I'm almost always on Discord.
Bilka
Factorio Staff
Factorio Staff
Posts: 3602
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: LuaEntity::effect_sources read

Post by Bilka »

This was added as LuaEntity::get_beacons().
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Implemented mod requests”