Advanced Combinator

by zomis

Make combinators great again! One combinator to rule them all.

Content
3 years ago
0.16 - 1.1
1.34K
Circuit network

b several crashes, probably because of GUI not properly opening/closing

5 years ago
(updated 5 years ago)

I had only used a single advanced combinator to test and experiment (see also my creation in another thread) and got no problems, except maybe opening the GUI and the combinator both with one click, then not being able to move the GUI window, and also having to close both windows and reopen them to update the combinator after editing the lower textpart of the window (since that is often easier when copying similar commands). but when i placed a few more advanced combinators, trouble began :-(

after reloading the game, when i clicked the first combinator i got this crash:
Error while running event advanced-combinator::on_gui_opened (ID 83)
advanced-combinator/control.lua:96:
attempt to index local 'advanced_combinator' (a nil value)

then i deleted that bad combinator without problems and tried to also delete the second combinator, but that got me another crash:
Error while running event advanced-combinator::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
advanced-combinator/model.lua:67:in function 'func'
advanced-combinator/model.lua:17:in function 'perform'
advanced-combinator/control.lua:83:in function <advanced-combinator/control.lua:77>

i tried several times, reloading in between crashes, trying to fisr delete one or the other, to edit one or the other, etc, but always got one crash on the first and the other crash on the second combinator, and when i tried to click and open the second combinator that crashed on deletion, it opened the combinator gui with the signals without(!) also opening the advanced gui for programming it. thus i assume that there is some hidden GUI somewhere that prohibits me from opening or deleting the second combinator, and that might also crash the first combinator when trying to open it.

ps: also while programming the first combinator for my "creation", the mod crashed several times with different errors. since they all were related to some bad code that i had entered, i simply ignored them, reloaded the last autosave, corrected my error (very important: always copy the entire program from the text area to the clipboard before pushing "apply" to not lose all the changes and be able to restore the (bad) program and edit it after reloading the map) and then could continue without further problems. although those errors were caused by MY bad code, it would have been nice to get error messages instead of crashes.

ps2: i tried to recover from the problem by making some blueprints, restarting the map without this mod and saving it with a new name, and then restarting the map again with this mod and using the blueprints. too bad that there were two severe problems:
first is probably a problem in factorio itself: the blueprints in my invenory no longer had any advanced combinators in them. the game seems to remove all invalid entities from those blueprints automatically and even after re-enabling the mod they were still gone. thus all blueprints should not be kept in the inventory only, but also be copied to the blueprint library where they still exist with the entities of non-installed mods.
second problem was that this mod seems to not save the program in its combinators when doing blueprints. the combinators that were placed by the blueprint only had the default computation for T. luckily i earlier had posted my creation to the other thread and thus could reload it from there :-) and i could reload the second program from my clipboard (see above)

ps3: after working for a while with several (newly placed) combinators without problems, i just got the first crash again (on_gui_opened ID 83, 'advanced_combinator' a nil value). of course opening the combinators was not possible, but i looked at their input and output values on the wires, and they were all frozen while the game kept running.

5 years ago

Hi there!

I would just like to confirm that I have read your bug report. Thank you for a high quality report that should make the crashes you have been experiencing easy to fix. I can't promise that the bugs with nothing happening when you open the GUI as easy to fix, but I will take a look at it.

Also many thanks for sharing your creation in the other thread!

5 years ago

Regarding the blueprints, I am not sure if it is possible for a mod to add blueprint information to entities so that the mods information can be copy-pasted with blueprints. If you know any mod that has succeeded with this, please let me know.

5 years ago
(updated 5 years ago)

i don't know details, but here are some candidates which might save some "unusual" data in blueprints:

https://mods.factorio.com/mod/textplates (by Earendel) saves the data of its text tiles (although it is only a single char), i believe in some hidden combinator.

https://mods.factorio.com/mod/blueprint-train (by DaveMcW) saves Locomotive schedule, fuel, and color, Cargo wagon filters and size limit, and Automatic mode.

https://mods.factorio.com/mod/BlueprintAlignment (by steffenk) stores offsets and alignment info optionally either in the blueprint label or it stores properties in a special entity in the blueprint

5 years ago

@Anson_AKB Here's my analysis of those mods:

textplates is actually using multiple different entity prototypes, one entity for each text tile. As such, Factorio itself can easily save the correct entity name in the blueprint. This is however not anything that I could apply for this mod, as in my case it's just one entity with a crapload of data.

blueprint-train is serializing info into signals using integer values of a constant combinator. This seems like a horribly complex solution that I really want to avoid and I don't think it's feasible to serialize all the commands using simple integers and signal-types in my case, it's just too much data.

BlueprintAlignment is using a quite smart solution by using a special entity with the alarm type, as such it can contain an alert message which is a string and therefore serialize anything. Of all the solutions, this is the one I like best. Implementing it would take a bit of time though and is not something I prioritize at the moment. It feels kinda hackish but it should be possible - I wish though that the Factorio developers would build better support for serializing custom data in your entities.

Regarding your bug report, I will be updating the mod and try to implement some fixes to avoid the crashes, you might still get some unexpected behavior though.

New response