entity::is_charted(force)

Things that we aren't going to implement
Post Reply
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

entity::is_charted(force)

Post 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.
Last edited by Mylon on Tue Nov 01, 2016 3:42 pm, edited 1 time in total.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: entity::is_charted(force)

Post 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

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: entity::is_charted(force)

Post 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{}.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13235
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: entity::is_charted(force)

Post 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.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”