Page 1 of 1

[0.15.7] Weird behavior writing to camera.surface_index

Posted: Fri May 05, 2017 5:50 pm
by MagmaMcFry
When you change or write to an existing camera's surface_index, it will show various forms of weird behavior. Sometimes it will stop rendering anything at all, sometimes it will display the old surface's entities on the new surface's tiles.

The same thing happens when you destroy and recreate the camera with the new parameters (as long as it's still in the same callback or at least the same tick), so destroying and recreating a camera does not circumvent this issue (at least it did this when I tested that back in 0.15.3)

Re: [0.15.7] Weird behavior writing to camera.surface_index

Posted: Sat May 06, 2017 5:31 pm
by Rseding91
Can you post a save file + mod showing the problem?

Re: [0.15.7] Weird behavior writing to camera.surface_index

Posted: Sat May 06, 2017 7:12 pm
by MagmaMcFry
In the attached savefile, move your mouse between the factory buildings quickly, and a plethora of nonsense will happen. Here is the relevant Lua code.

Re: [0.15.7] Weird behavior writing to camera.surface_index

Posted: Sat May 06, 2017 10:05 pm
by Rseding91
Thanks for the save and mod. It was a simple fix: the read/write surface for the GUI element was taking 0-based indexing instead of Lua 1 based indexing.

It's now fixed for the next version of 0.15.