Stargate


Factorio but with logistics-capable stargates that teleports players and belt contents around the map and between surfaces.

Overhaul
3 years ago
0.17 - 1.1
6.18K

b Stargate 0.1.4 crashing on some belt placements in Factorio 1.1.24

3 years ago

Running Facotio 1.1.24, I've received the following crash multiple times when placing belts (both by hand and via blueprint construction). Is there more information I could gather that would be helpful?

The mod Stargate (0.1.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event stargate::on_built_entity (ID 6)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__stargate
/control.lua:197: in function 'CheckBelt'
stargate/control.lua:205: in function '?'
stargate/lib/lib_control_cache.lua:151: in function 'call_ents'
stargate/lib/lib_control_cache.lua:391: in function 'y'
stargate/lib/lib_control.lua:286: in function <stargate/lib/lib_control.lua:286>

3 years ago

Also encountering a similar issue when removing some belts:

The mod Stargate (0.1.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event stargate::on_robot_mined_entity (ID 65)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__stargate
/control.lua:177: in function 'OnDestroyBelt'
stargate/control.lua:214: in function '?'
stargate/lib/lib_control_cache.lua:151: in function 'call_ents'
stargate/lib/lib_control_cache.lua:399: in function 'y'
stargate/lib/lib_control.lua:287: in function <stargate/lib/lib_control.lua:287>

This was after I'd deactivated all modes aside from Stargate, in the hopes it was just a mod conflict.

3 years ago

Further experimentation triggered a similar issue when rotating certain belts:

The mod Stargate (0.1.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event stargate::on_robot_mined_entity (ID 65)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__stargate
/control.lua:177: in function 'OnDestroyBelt'
stargate/control.lua:214: in function '?'
stargate/lib/lib_control_cache.lua:151: in function 'call_ents'
stargate/lib/lib_control_cache.lua:399: in function 'y'
stargate/lib/lib_control.lua:287: in function <stargate/lib/lib_control.lua:287>

I found there's a particular set of 16 locations where these can come up, arranged around a 4x4 region. They happen when a belt ichange happens that either starts or stops pointing into or out of that region. This felt like something a stargate would use to detect belts connecting/disconnecting from it.

I tried placing a new stargate in the 4x4 region, then mining it out by hand, and after that those locations no longer triggered the error. My current speculation that I did something that caused a stargate to be removed without un-registering some event listeners meant to capture belt connection changes, and then when the event listeners fired they sent messages to Lua's equivalent of a dangling pointer.

I've got mod-free (except Stargate) savegame in which this behavior can be easily triggered, if that would be helpful.

3 years ago

Sounds like it is trying to reference a stargate that doesn't exist anymore, but the hook is still there.

Checking table[surface][x][y] for a valid gate reference is roughly O(1) at the cost of memory and savedata.
Checking relative position to every gate is roughly O(n).

Instructions to reproduce the problem is more valuable than a save.
Thank you for the report.

New response