How can i make my tile spread like liquid?

Godot Version

4.3

Question

how can i make my tile spread like liquid?
example what i want

if i exclude wall position its only not set on wall position.
i want it work like liquid or like in image
there name for this method? what should i do ?
my code

extends TileMapLayer
var spread_size : Vector2i = Vector2i(2,2)
var wall_position : Array[Vector2i]
func _input(event: InputEvent) -> void:
	if event.is_action_pressed("L_mouse"):
		var mouse_pos : Vector2 = get_global_mouse_position()
		var map_pos : Vector2i = local_to_map( mouse_pos )
		for x in range( -spread_size.x + 1 , spread_size.x)  :
			for y in range( -spread_size.y + 1 , spread_size.y)   :
				set_cell( map_pos + Vector2i(x,y)  ,1, Vector2i(5,2))

You might have a very simple error with the fixed values of 5,2 in your set_cell() call.

I’m assuming here that your map is rather small and you don’t have the need for an existing liquid simulation that has been proven to work and be fast at it:
Do you have any sort of node for the liquid? I’d do that and when clicking I’d instantiate a liquid node which in turns looks around itself and instantiates new liquid nodes on those tiles it can spread. Keep doing that in loops over all liquid nodes at your leisure. If it hits another liquid node (e.g. sort of going around an obstacle) it could do something like setting the liquid height in both to the average between them. Obviously you want to stop when your liquid node’s height level is under a sensible value. Water does that too.