Page 1 of 1
entity::is_charted(force)
Posted: Tue Nov 01, 2016 3:32 pm
by Mylon
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.
Re: entity::is_charted(force)
Posted: Tue Nov 01, 2016 3:35 pm
by Klonan
This is already implemented:
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.
Just get the chunk position from the entity position (divide by 32 and floor) and then check if that chunk is charted
Re: entity::is_charted(force)
Posted: Tue Nov 01, 2016 3:45 pm
by Mylon
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{}.
Re: entity::is_charted(force)
Posted: Tue Nov 01, 2016 3:49 pm
by Rseding91
"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.