Reconnect Cut Wires


Reconnects external wires when placing blueprints made from the cut tool. Integrated into vanilla 2.0!

Utilities
5 months ago
1.1
1.68K
Circuit network

b ✅ Error while running event reconnect-cut-wires::on_built_entity (ID 6)

10 months ago

I'm not sure what I did to trigger this - I was using ctrl+x to move item ghosts around.

10786.630 Error MainLoop.cpp:1391: Exception at tick 1007469522: The mod Reconnect Cut Wires (0.0.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event reconnect-cut-wires::on_built_entity (ID 6)
__reconnect-cut-wires__/control.lua:133: bad argument #1 of 2 to 'pairs' (table expected, got nil)
stack traceback:
    [C]: in function 'pairs'
    __reconnect-cut-wires__/control.lua:133: in function <__reconnect-cut-wires__/control.lua:113>
10 months ago

Ok, that was really hard to figure out, but I got it:
If you cut/paste an entity, then copy/paste that ghost, then cut/paste that ghost again, it would sometimes error.
This is because copying a ghost copies it's tags as well, which I use to store the blueprint ID of the ghost.
My code made the assumption that if the ghost had an ID tag, then it must have had connections outside of the blueprint, which was normally true.
The solution was to remove the tag from the ghost upon it's creation, and I can no longer reproduce the behavior.
Fixed in 0.0.2

New response