This has been a long time problem with creating modular parts and it seems more modders about to get onto it.
So I would like to suggest features which would allow a part to determine how it's connected to pats on its sides.
Until now I've been using buffs for this but buffs cause lags and currently imho are very buggy and unreliable.
I think it would be simplest to have the features as toggles. They would be similar to proxies in defining the connection on a side. This coincides with my request for proxies to return an answer whether they are connected or not. So I think both functionality can be merged into one that is similar to ToggleProxy with criteria.
Further, it would be great if it's possible to cheaply determine in addition the position similar to door position where the part is connected to the other part. For example connected to the first horizontal/vertical row/column of the other part.