TL;DR
Add modding API to read/modify/create territory for segmented unitsWhat?
It would be nice to be able to make mods that could make more aggressive segmented units, either for 'Vulcanus deathworld' mods, or for overhaul mods that want to use segmented units (alone or as part of other forces). Allowing mods to read/modify/create segmented unit territory and segmented units would empower mods to add enemies that wouldn't leave the players factory alone.Requests for the API:
1. Get the territory of a segmented unit. LuaEntity::get_territory() → LuaTerritory, or LuaEntity::get_or_create_territory → LuaTerritory + LuaTerritory::get_chunks() → LuaChunkIterator?
2. Given a territory, add or remove squares from it. LuaTerritory::add_chunk(surface, position) + LuaTerritory::remove_chunk(surface, position)?
3. Create a segmented unit (I cannot find an option to associate segments to a segmented unit in runtime, so my apologies if I missed this somewhere, although it wouldn't make much sense without territory options). Either update the docs to make it clearer that this is possible with LuaSurface::create_entity / LuaSurface::create_unit_group. Presumably LuaSurface::create_segmented_unit(entity_ids) or such?
4. Create a territory (possibly by getting a territory that's empty and adding squares to it as needed). Either LuaSurface::create_territory, LuaEntity::get_territory, or LuaEntity::get_or_create_territory.
5. Associate a new segmented unit with a territory (although if creating a segmented unit and then getting and modifying its empty territory works, that'd be fine too). LuaEntity::set_territory.
6. Given a segmented unit and territory, some way to replace the segmented unit (possibly as bulky as copying the territory squares, killing the unit, creating a new one, getting its empty territory, changing its territory to match the old territory).
7. Some way to either allow segmented territories to overlap (maybe the more flexible) or have multiple segmented units assigned to the same territory.