Module Inserter Extended


Mass insert/remove modules into machines with construction robots Significant rewrite of the original, with more powerful configuration options

Utilities
8 days ago
1.1 - 2.0
25.4K

g Remote call from other mod

a month ago

Hi,

I'm the author of P.U.M.P.: https://mods.factorio.com/mod/pump

A long time ago I utilized a remote-call to the original module inserted after P.U.M.P. had finished its layout, so people could add modules in a single-effort and re-use the configs they had with MI. Unfortunately, the original mod has still not been updated for Factorio 2.0, and I'm looking around for an alternative mod to call instead.

I browsed around on github, and it seems in your reworking efforts of the original mod, the remote-call I use has not survived your efforts. Would you be willing to re-add it, or something similar back into the mod? I also don't mind adding it myself, if you'll accept the pull-request?

In case you are interested; I am not looking for a deep integration or anything. The original call was simply a "For a pump, what are the modules". (used to be called "get_module_config".). Alternatively (or even preferably), I could also work with doing a remote call with the selected area as parameter; from which your mod can do as it does?

Looking forward to know if you're interested.

a month ago

Looks like something that would be good to support.

I don't recall removing any remote interfaces - looking at the history, it appears that it got removed in a rewrite a few months after it was added (back in 2020). Was it actually still working recently?

Anyway, it should be simple enough to add both of those functions (though rather than a selected area, it might be better to pass a list of entities).

At least, simple if I just default to using the active config, which should be good enough for the majority of cases. It might be desirable to allow picking a specific preset to use, but that would require a bunch more work on both sides.

a month ago

Oh yea, .. I see that change in the repo of the original as well. I guess it must've been broken a looong time. Not gonna lie, I am bit miffed and embarrassed I only now learn it's not been working for 4 tears 🙈

It's not something I use myself. It was a feature requested way back; then it got added, and only now am I reminded by another user the other mod is not compatible with 2.0. I suppose it's a pretty niche feature.

I suppose that takes off any pressure 😅 Still, the interaction would be pretty thin I suppose. So we could still restore it if you're up for it.

P.U.M.P. finishes after planning a bunch of ghosts. Does MI-ex work with ghosts, too?

The relevant lines of code on my side are:
Getting the module config from MI
https://github.com/Xcone/factorio_pump/blob/65596575a5c6c0591e3916a584c99d468d3db65f/mod/toolbox.lua#L697

And then using the entitity name to resolve the modules to add. 10 lines later its added as an item_request to the ghost.
https://github.com/Xcone/factorio_pump/blob/65596575a5c6c0591e3916a584c99d468d3db65f/mod/constructor.lua#L147

Does MI still work that way, or is it different now? I don't mind taking another approach if that better suits you.

a month ago

Hah, yeah, that can happen.

Yeah, not too difficult to just select the area with module inserter manually after setting up the pumps, but what's the purpose of our mods if not to reduce that manual repetition?

So - already updated to add the interface. It does work a bit different - I recommend using the new apply_module_config_to_entities call. You should be able to just collect the ghosts you create, then pass them to that function, and it will fill everything with modules as appropriate. Something like:

remote.call("ModuleInserterEx", "apply_module_config_to_entities", player.index, entity_list)

I also added a call to get a list of modules for a specific entity if you (or anyone else later) wants to do it that way.

a month ago

That's quick service; thanks!

I just updated P.U.M.P. as well to use it. I used your suggested "apply_module_config_to_entities" method, and can confirm it works like a charm.

New response