So, remember when we were setting up drill we switched from you using collisions to tilemap coords? We should do the same here to simplify. However, that is not the reason you are getting that error.
You are calling a func in a for loop, so it never ends the loop, each time it goes over it get a new list of things to loop through.
I apologize for the confusion, I realize I explained two different things but using the same name.
I started out at the beginning using a var explosion_size, later I used that same name for an examlple func.
Have your signal tile_destruction(tile_list, bombspot)
If you create a var explosion_size: int = 3
Then have a func exploded_tiles():
In exploded_tiles.
var tiles: Array
for x in explosion_size:
for y in explosion_size:
tiles.append(Vector2i(x,y))
explode_tnt.emit(tiles, global_position)
To give further explanation of for loop. It will cycle through whatever value you have after the in keyword. In my example x and y are just the reference for each iteration of the value which in an int. If you create a never ending loop, you will get the recursion error.
In my example x will = (0,1,2), since it will loop 3 times.
Y will = (0,1,2), so that is why I can use these values to create an array of Vector2i.
For each loop of x, the y for loop will give the value (0,1,2).
So at the end you will have all values between Vector2i(0,0) and Vector2i(2,2).
You can now send this signal to wherever you will calculate and destroy your tiles.
In that func() that recieves the signal you will take the two values (array, global_position) and that is the part of the code that I wrote using var map_origin.
You copied it exactly, however that func doesn’t do anything. I said you needed to use map_origin + cell to destroy the tile you want.
Something like set_cell(0, map_origin + cell, -1) put this under the for loop like you have written right now replacing map_origin + cell.
Edit:
I also noticed you have a check, is_in_grouo(“Mudwalls”), have you thought of using tilemap layers to avoid this needed group. Just create a designated layer for mudwalls, now when you destroy tiles instead of set_cell(0,pos,-1) you would set the first number to whichever layer mudwalls are on.