Place rule Tile A and have it surrounded by Rule tile B with one click

My Goal is to be able to place a rule tile - floor - with a click and have it surrounded with - wall- rule tiles.

In the last few days, I have been playing with rule tiles (and 2D in general) for the first time. I have learned the basics of rule tiles by painting terrain and having it automatically resolve each tile to the correct shape.

I am wondering how it would be possible to place a tile and have it automatically surround it with more tiles.

The idea is as follows:

  1. Rule Tile A is placed.
  2. For each tile surrounding, a check is made to ensure it is not of type Rule Tile A (so we don’t overwrite that tile).
  3. Passing that check, that position is filled with Rule Tile B.

Likewise, with placing rule tile B directly, I would still like to overwrite tiles as normal.

Rule Tile A and B would be aware of each other - I have seen this referred to as friend or neighbour tiles.

I think this might be achievable through Custom Rule Tiles, however, I haven’t yet found anything that would directly help with this.

I am still researching, but any help would be appreciated.

For anyone wondering, I used a custom brush to paint Tile A and had some logic to place Tile B around it, updating tiles accordingly when painting/erasing tiles.