Moon Logic deprecated

by mk-fg

Adds Lua-programmable circuit network combinator. Based on Sandboxed LuaCombinator and LuaCombinator2 mods. Probably won't work in multiplayer games.

Content
2 years ago
1.0 - 1.1
4.97K
Circuit network

b [fixed] Crash while opening combinator gui with SE mod

2 years ago
(updated 2 years ago)

I've got error while experimenting with circuit network:
Error while running event Moon_Logic::on_tick (ID 0)
Moon_Logic/control.lua:62: attempt to concatenate local 'name' (a nil value)
stack traceback:
Moon_Logic/control.lua:62: in function 'cn_sig_str'
Moon_Logic/control.lua:99: in function 'cn_wire_signals'
Moon_Logic/control.lua:587: in function 'update_signals_in_guis'
Moon_Logic/control.lua:774: in function <Moon_Logic/control.lua:743>

I connected Direct Stacksize Combinator to Moon Logic Combinator and tried to open its gui. I suppose some item from mods caused this error, so I turned off all other mods except MoonLogic, Other Utility Combinators, SE and its requirements and error persists. Here is mod list:
Moon_Logic = "0.0.82",
["aai-containers"] = "0.2.11",
["aai-industry"] = "0.5.19",
["aai-signal-transmission"] = "0.4.7",
["alien-biomes"] = "0.6.7",
base = "1.1.69",
["bullet-trails"] = "0.6.2",
["combat-mechanics-overhaul"] = "0.6.22",
flib = "0.11.2",
informatron = "0.2.3",
jetpack = "0.3.5",
robot_attrition = "0.5.12",
["shield-projector"] = "0.1.6",
simhelper = "1.1.4",
["space-exploration"] = "0.6.86",
["space-exploration-graphics"] = "0.6.12",
["space-exploration-graphics-2"] = "0.6.1",
["space-exploration-graphics-3"] = "0.6.1",
["space-exploration-graphics-4"] = "0.6.2",
["space-exploration-graphics-5"] = "0.6.1",
["space-exploration-menu-simulations"] = "0.6.8",
["space-exploration-postprocess"] = "0.6.18",
["utility-combinators-plus"] = "1.1.0"

2 years ago
(updated 2 years ago)

I also tried to reproduce the error with Alphabet Combinator and obviously succeeded. This combinator produces all signals which is possible in the game, so it could be handy testing tool to check signal names.

2 years ago

Yeah, there's also a recent report about maybe-different issue with SE mod here:
https://mods.factorio.com/mod/Moon_Logic/discussion/6326485858bbc46ee2d85f54

Don't think it's the same issue, but seem to be same mod, as presumably bunch of fancy signal names are used in SE.

2 years ago

Hm, looking into this with Alphabet Combinator, indeed easily reproduced the issue, but with that combinator having signal {type='fluid', name=nil}, which don't think should be meaningful or usable in-game, and of course easy to fix by skipping such non-entries.

But I wonder if you posted that traceback above from Alphabet Combinator mod, supposing that it's likely same exact crash as with SE.
If you might have, maybe you can check, otherwise guess it'll be fixed like with Alphabet thingy mentioned above.
It just looks strange that SE mod might be using such nil-signals for anything, and suspect it might even be a bug in Alphabet Combinator to produce it :)

2 years ago

Fix for such name=nil items should be in 0.0.83, so maybe see if issue is fixed there, if you can.
I haven't installed SE mod myself to reproduce issue there, as it seem to be rather massive, with a lot of dependencies, so bit of a hassle to setup, unfortunately.

2 years ago
(updated 2 years ago)

Hm, looking into this with Alphabet Combinator, indeed easily reproduced the issue, but with that combinator having signal {type='fluid', name=nil}, which don't think should be meaningful or usable in-game, and of course easy to fix by skipping such non-entries.

But I wonder if you posted that traceback above from Alphabet Combinator mod, supposing that it's likely same exact crash as with SE.
If you might have, maybe you can check, otherwise guess it'll be fixed like with Alphabet thingy mentioned above.

I've checked again, the error was exactly the same with Alphabet and Direct Stacksize Combinators.

It just looks strange that SE mod might be using such nil-signals for anything, and suspect it might even be a bug in Alphabet Combinator to produce it :)

Well, Alphabet Combinator is just extremely dumb. It produces signal for everything it sees without any filtering. You could consider this a bug. Or the feature :)

Fix for such name=nil items should be in 0.0.83, so maybe see if issue is fixed there, if you can.

Yes, 0.0.83 fixes error I got, thank you for the quick response.

I haven't installed SE mod myself to reproduce issue there, as it seem to be rather massive, with a lot of dependencies, so bit of a hassle to setup, unfortunately.

Maybe SE was difficult to install, but now they finally have Official Modpack

2 years ago
(updated 2 years ago)

"It produces signal for everything it sees without any filtering" - afaik there's no way to create a prototype for a fluid with no name (same as missing name key).
Suspect it generates such signal when it runs into some prototype querying bug, i.e. tries to get a fluid prototype by item name or something, gets nil, and factorio api doesn't stop it from using that in SignalID for some reason, even though I think it won't be displayed or used by anything in the game.
Doubt that kind of thing is intended functionality, hence "bug".
But I haven't really looked at the code, so maybe it generates these nil-signals on purpose for testing exactly this kind of oddball case.

2 years ago

Maybe SE was difficult to install, but now they finally have Official Modpack

Yeah, it's mostly just a hassle of creating a separate "mods" dir, downloading gigs of mods there, and then figuring out what even to do in SE to reproduce this specific circuit network condition.
It's nice that mod has its scope limited by those circuit inputs/outputs boundaries though, so it's easy enough to reproduce anything by just feeding it signals, regardless of any eldritch combination of mods that created them in the first place :)
Just need to add/enable more debug logging for those inputs at most.

2 years ago
(updated 2 years ago)

But I haven't really looked at the code, so maybe it generates these nil-signals on purpose for testing exactly this kind of oddball case.

for _, f in pairs(game.fluid_prototypes) do
  global.alphabetframe[#global.alphabetframe+1 or 1]= {index = #global.alphabetframe+1, count= #global.alphabetframe+1, signal = {name=f.name, type="fluid"}}
end

Thats it. Same for items and virtual signals. Dumb. Completely.

I suspect that some fancy stuff may be done in some of SE mods, but it's not Alphabet Combinator fault.

2 years ago

As I don't have SE and could reproduce it easily, looked into it, and it seem to be how signals for at least some hidden entities are transmitted.
In my case it happens to "water" and "fluid-unknown" (among fluid signals):

  • Signal set on Alphabet Combinator's control.parameters: {count = 318, index = 318, signal = {name = "fluid-unknown", type = "fluid"}}
  • Signal read on Moon Logic combinator's cn.signals: {count = 318, signal = {type = "fluid"}}

Other issue with SE in https://mods.factorio.com/mod/Moon_Logic/discussion/6326485858bbc46ee2d85f54 was actually about the opposite thing for other items flagged as hidden - this mod didn't map their signals, assuming it won't ever see them, but nope, sometimes they appear, and apparently other times they can also have name=nil.
Weird, maybe can be considered a bug in factorio Lua API, given such strange inconsistency.

2 years ago
(updated 2 years ago)

Although actually "water" isn't a hidden thing, and yet:
- Out: {count = 319, index = 319, signal = {name = "water", type = "fluid"}}
- In: {count = 319, signal = {type = "fluid"}}
Oh well. Guess one can also disregard signals without index, even if they pop-up during iteration. Might be some C++ data/vars not cleaned-up somewhere.

2 years ago

Just want to remind you that first time I hit this bug with Direct Stacksize Combinator and it obviously does not have any fluid signals.

2 years ago
(updated 2 years ago)

Yeah, there are hidden (?) items that do same thing, these specific fluid ones are just an example.
Seem to be a general quirk of how signals are sometimes handled in factorio.

New response