Page 1 of 1

[0.12.29][Twinsen] Game crashed due to calling set_tiles

Posted: Fri Mar 25, 2016 7:47 am
by enkindle
I managed to crash the game working on a mod. Here is the relevant code:

Code: Select all

	
	local pos = position -- this is just the player position
	local full_size = {width=10, height=10}
	local full_area = {left_top = {x = pos.x - full_size.width / 2, y = pos.y - full_size.height}, right_bottom = {x = pos.x + full_size.width / 2, y = pos.y}}
	local new_tiles = {}
	
	for x, y in iarea(area) do
		table.insert(new_tiles, {name = "water", position = {x, y}})
	end
	
	surface.set_tiles(new_tiles)
All entities in the area were destroyed before running this code.

I've attached the mod, map save and log. Just load the save with the mod and place the smart chest.

Re: [0.12.29] Game crashed due to calling set_tiles

Posted: Fri Mar 25, 2016 7:57 am
by enkindle
Ah, additional note: This only happens when you try to set_tiles where the player is, so place the chest below the player.

Re: [0.12.29][Twinsen] Game crashed due to calling set_tiles

Posted: Fri Mar 25, 2016 5:33 pm
by Twinsen
It was happening because you were spawning water under the player, thus killing him.

Fixed in 0.12.30. It will not crash, but the game will end because you die.
Thanks for the clear report, save+mod+log made it easy to fix.

Re: [0.12.29][Twinsen] Game crashed due to calling set_tiles

Posted: Fri Mar 25, 2016 6:52 pm
by enkindle
Yeah, eventually figured* that out, made me feel a bit silly.