Reworked team switch code, use GetTeamProperty to remove code dupes, add proper building check