justarandomgeek/factorio-stringy-train-stops

Not updating on fast-replace

Opened this issue · 1 comments

Fast-replacing a normal train stop with a Stringy Train Stop results in a Stringy Train Stop that does not respond to signal commands. Deleting it and replacing it, and reconnecting the circuit wires, results in a station that renames itself correctly.

Turns out this was because the removeStringyStations() function does not check the name of a deleted/mined entity before deleting the reference to any stringyStation at its coordinates. So when you replace a normal stop with a stringy stop, first it adds the new stringy stop to the list, then it attempts to delete the normal stop and finds the new stringy stop at those coordinates.

Adding a simple check for entity.name=="stringy-train-stop" inside the removal events will prevent this from happening.