position :: Position and position :: ChunkPosition
Posted: Thu Jan 17, 2019 11:47 pm
Heya,
Currently, everything wants a position, whether it's an actual Position or a ChunkPosition. It would be nice if parameters that wanted a ChunkPosition would be renamed to indicate that they want a ChunkPosition. In the overview of classes (https://lua-api.factorio.com/latest/Classes.html) and the overview of the class itself (https://lua-api.factorio.com/latest/LuaSurface.html) it's impossible to tell what type of position functions want. You have to go down to the function-level documentation (https://lua-api.factorio.com/latest/Lua ... _generated) to find if you need to provide a Position or a ChunkPosition. Therefore, it would be nice if the position parameter were renamed to something like chunk when a function wants a ChunkPosition. The suggestion of chunk is made since regenerate_entity takes chunks, though on a personal level I would find chunk_position a little more clear.
Examples:
is_chunk_generated(position)
Parameters
position :: ChunkPosition: The chunk's position.
request_to_generate_chunks(position, radius)
Parameters
position :: Position: Where to generate the new chunks.
regenerate_entity(entities, chunks)
Parameters
chunks :: array of ChunkPosition
Thanks.
Currently, everything wants a position, whether it's an actual Position or a ChunkPosition. It would be nice if parameters that wanted a ChunkPosition would be renamed to indicate that they want a ChunkPosition. In the overview of classes (https://lua-api.factorio.com/latest/Classes.html) and the overview of the class itself (https://lua-api.factorio.com/latest/LuaSurface.html) it's impossible to tell what type of position functions want. You have to go down to the function-level documentation (https://lua-api.factorio.com/latest/Lua ... _generated) to find if you need to provide a Position or a ChunkPosition. Therefore, it would be nice if the position parameter were renamed to something like chunk when a function wants a ChunkPosition. The suggestion of chunk is made since regenerate_entity takes chunks, though on a personal level I would find chunk_position a little more clear.
Examples:
is_chunk_generated(position)
Parameters
position :: ChunkPosition: The chunk's position.
request_to_generate_chunks(position, radius)
Parameters
position :: Position: Where to generate the new chunks.
regenerate_entity(entities, chunks)
Parameters
chunks :: array of ChunkPosition
Thanks.