PyroFire232 / warptorio2

An updated / refined version of warptorio https://mods.factorio.com/mod/warptorio
8 stars 8 forks source link

Warp loaders cause game crashes #13

Open Dan-Staley opened 3 years ago

Dan-Staley commented 3 years ago

There are 3 separate bugs in the warp loader code (in control_main_helpers.lua) that cause crashes when using warploaders:

1) The fields warploaders.outputf_next and warploaders.output_next aren't checked/reset in warploader.dofilters or warploader.destroy, which means if they point to the loader being changed/deleted they can end up pointing to something invalid, causing a crash later on.

2) warploader.dofilters doesn't always remove the loader's lanes from existing input/output tables, leading to them pointing to invalid lanes and eventually causing a crash.

3) In the filter loop in warploader.dofilters, there's a line "ct = ct[f]", which causes the reference of "ct[f]" to point to the wrong thing on the next iteration of the loop. This leads to crashes and incorrect behavior when setting more than one filter on a loader.

I actually have a fix for these written on my local machine that makes warp loaders work with no crashes, but I'm not sure how to request adding it here - the file control_main_helpers.lua seems to have been deleted from this repo, despite still being distributed with the mod. If there's a way I could upload/submit my change, it would fix this issue.