[Twinsen] [0.14.14] Changes to item_slot_count don't update
Posted: Tue Oct 25, 2016 1:30 pm
I have a mod with a constant-combinator type entity (reactor-interface) that currently has 5 slots. As part of an update I am writing, I have increased item_slot_count in the prototype to 10.
However, when I load an old save I get a lua error from the on_tick event in my control.lua script, as it's trying to write a signal to slot 6 and the existing reactor-interface entities appear to still be treated as if they have 5 slots.
The specific error is "Index out of bounds: 6"
Note that if I comment out the offending line (so I can load the game) and open a reactor-interface GUI it shows 10 slots.
I have a stupid (but apparently working) workaround:
However, when I load an old save I get a lua error from the on_tick event in my control.lua script, as it's trying to write a signal to slot 6 and the existing reactor-interface entities appear to still be treated as if they have 5 slots.
The specific error is "Index out of bounds: 6"
Note that if I comment out the offending line (so I can load the game) and open a reactor-interface GUI it shows 10 slots.
I have a stupid (but apparently working) workaround:
- Create a temporary surface
- Create a temporary reactor-interface
- Iterate over all existing reactor-interfaces and copy the settings from the temporary reactor-interface
- Delete the temporary reactor-interface
- Delete the temporary surface