How can I add a custom border around the same tilemap blocks?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

How can I add a custom border around the same tilemap blocks? Like in Terraria.

Example:

enter image description here
enter image description here

I can’t use auto tile since the blocks can be by themselves. My first idea would be when I place the block, it looks at the 4 sides of the block to see if there are any blocks. Then it would choose the correct tilemap with the correct rotation. There would be 6 different variations of the block. Is this the best way or is there a better way?

:bust_in_silhouette: Reply From: SuperDIMMaX

Check all 8 tiles?
when place tile
get_cell_item(tile_pos.x+1, tile_pos.y)
this may be helpful. i not see any best variants.
try use “group” blocks by type and check type. many variants i.e. store type in vec2 dictionary and call this dictionary, not get_cell_item, or check name of tile or name of tileset…
https://forum.godotengine.org/7825/possible-to-add-properties-to-tiles-in-tileset-access-tiles