Add modding API to read/modify/create territory for segmented units

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
berggen
Inserter
Inserter
Posts: 22
Joined: Tue Sep 01, 2020 7:12 pm
Contact:

Add modding API to read/modify/create territory for segmented units

Post by berggen »

TL;DR
Add modding API to read/modify/create territory for segmented units
What?
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.
Why?
2.0 create a very complete Factorio experience, and creates a lot of very cool concepts for overhaul mods to work with. Some of the new engine enhancements are beyond the reach of reasonable mods right now though, so allowing mods to use these features more actively will allow very interesting gameplay options from mods.
Post Reply

Return to “Modding interface requests”