LuaEntity::effect_sources read

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
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: 13223
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.

Post Reply

Return to “Modding interface requests”