The officer in uniform was on duty and had the duty. The other officer lost it and it's a wonder he didn't get shot.
First thing out of is mouth should have been, "Officer, I'm a deputy with ..... , I am armed and my badge is in my car, may I get it and show it to you? or, "may I put this pouch on the hood and get my badge out of the car?"; once approved, move calmly and slowly. They officer obviously saw the outline of the gun, and had to ASK - wrong.
The UC should get fired for being stupid. Yes, the other officer was playing chickenshait with him, but the guy failed to defuse the situation. Take your licks and fight it later.