That part of the script just checks for yellow or red armor, in the upper right corner. If the color is a match (meaning its time to repair), then it moves on to Repairing, if not, the script just continues as normal.
The part you highlighted is not the moving to repair btw. You highlighted the "check if a repair is needed".