Structure conditions for spawning

Can i write under what conditions will be spawn structure?

For example: i have custom village, where i have wells, tents, campfires and outposts. And i need to spawn outposts out of my village, not in center.

How can i check d distance and if d<50, then outpost will be not spawn?

Or can i make two different structures (1 will be my custom village and 2 will be my outposts) and create second structure around another 1 structure?

Continue to help post