I'd like the ability to test if an entity is visible to a specific force. Like the ability to only target enemy bases that the player knows about.
Alternatively, add a filter to find_nearest_enemy{} to include a check to see if the entity is known or not.
entity::is_charted(force)
entity::is_charted(force)
Last edited by Mylon on Tue Nov 01, 2016 3:42 pm, edited 1 time in total.
Re: entity::is_charted(force)
This is already implemented:
http://lua-api.factorio.com/latest/LuaF ... nk_charted
Just get the chunk position from the entity position (divide by 32 and floor) and then check if that chunk is charted
http://lua-api.factorio.com/latest/LuaF ... nk_charted
Code: Select all
is_chunk_charted(surface, position) → boolean
Has a chunk been charted?
Parameters
surface :: SurfaceSpecification
position :: ChunkPosition: Position of the chunk.
Re: entity::is_charted(force)
It's possible for entities to be on a charted chunk, but not known. Like when something is built in the fog of war.
For example, Robot Army looks for an enemy, then checks to see if the chunk is charted. Then goes towards that enemy. This can cause them to rush towards an empty spot on the map only to discover an enemy base that they shouldn't know about!
Also, an alternative would be to to add the check to find_nearest_enemy{}.
For example, Robot Army looks for an enemy, then checks to see if the chunk is charted. Then goes towards that enemy. This can cause them to rush towards an empty spot on the map only to discover an enemy base that they shouldn't know about!
Also, an alternative would be to to add the check to find_nearest_enemy{}.
Re: entity::is_charted(force)
"has this entity been rendered when the chunk was charted" is not something that is possible to know. That data isn't saved in the result chart image.
If you want to get ahold of me I'm almost always on Discord.