god controller inventory

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Tue Feb 06, 2024 5:18 am
Contact:

god controller inventory

Post by hgschmie »

(I have done some research and looked at the various threads over the years about the various controllers inventory but have not found a good answer)

Scenario: I have an entity that, when clicked, opens a different surface to allow building. Similar to what Factorissimo does. That gives me three options:

- Teleport the player and use the normal Character Controller. I have all my inventory and can build. Drawback: I now have the character that needs to walk around
- Use Remote Viewing. No character in the way but I need to use ghost building and write code that turns ghosts into entities, based on what is in my actual inventory. Remote viewing also shows the surface selector on the top left and anchoring helper guis is difficult.
- Use God mode. No character in the way, I can build from the inventory. Drawback: I need to copy all items from the character inventory to the god inventory and back.

The third option seems to be the most promising except that the god inventory size is different than the character inventory (character inventory is affected by e.g. armor bonus) so if it is really full, not everything can be copied over.

One option is to mess with the size of the god controller inventory at prototype stage but that has global effects for everything and feels wrong. I also tried setting the controller to god mode and retain the character but the game does not allow that. So the player inventory size in character mode is affected by things that are simply not available in god mode (e.g. LuaPlayer#character_inventory_slots_bonus)

god controller (and editor controller) seem to be intended for these type of interactions (building without a character present) and specific to mod use. Would it be possible to allow either resizing the inventory for those controllers (allow player.get_main_inventory().resize(n) if the player controller is either god or editor) or add a new LuaPlayer#set_main_inventory(LuaInventory) method that can only be called in god or editor mode.
Post Reply

Return to “Modding interface requests”