How to see what modules are in a placed assembler

Place to get help with not working mods / modding interface.
Post Reply
codyfactorio
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 06, 2024 6:39 pm
Contact:

How to see what modules are in a placed assembler

Post by codyfactorio »

I'm ideating developing a mode where you can select a bunch of entities with the blueprint selector, and then hot swap all the modules inside with a different type.

I see the CraftingMachinePrototype has ModuleSpecification
https://lua-api.factorio.com/latest/pro ... cification

But that seems to only describe the visual elements of showing module slots, not the actual ModuleCategoryID associated with each slot.

I assume this is because this is a Prototype, and not the concrete object.

So i'm wondering how you can get the current "settings" of a concrete object (like what item count is currently inside it, including modules).

Bonus point: how to see which concrete objects are selected by a blueprint/upgrade planner

Thanks!

codyfactorio
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 06, 2024 6:39 pm
Contact:

Re: How to see what modules are in a placed assembler

Post by codyfactorio »

I figured it out.

https://lua-api.factorio.com/latest/eve ... ected_area
- Look at entities

https://lua-api.factorio.com/latest/cla ... ntity.html
* get_module_inventory()

https://lua-api.factorio.com/latest/cla ... ntory.html
- get_contents
- Remove(items)
- insert(items)

Then to choose which module, you could great a gui (https://github.com/ClaudeMetz/UntitledG ... lo,-World!)
or something like:
- Perhaps the one in some inventory slot
- Get player_index doing on_player_alt_selected_area
- https://lua-api.factorio.com/latest/cla ... get_player
- Maybe put the module you want to replace it with in the first logistic slot
- https://lua-api.factorio.com/latest/cla ... layer.html
* get_personal_logistic_slot(slot_index)

Post Reply

Return to “Modding help”