"You were well and truly intoxicated," he said. "I'm surprised you could walk, let alone make the vehicle work, but you did."
Counsel Werner van Harselaar said his client had spent more than $5000 to cover the victims' costs and had attended a restorative justice conference to apologise to them face to face.
The judge said it was an example of the process "working at its very best".
"It gave the victims the opportunity to explain how they felt and they were very grateful for that."
They told the co-ordinator that not only did they want Trainor to avoid a heavy penalty but they also wanted to catch up with him in a less formal setting.
"Restorative justice is not normally a process to make new friends but that appears to be the case here," Judge Flatley said.
The victims had been driving downhill on Opoho Rd on August 12 and as they rounded a right-hand bend they were faced with Trainor heading straight for them.
The driver pulled hard left but it was not enough to avoid a collision, the rear right of their car sustaining the brunt of the damage.
When police found the defendant in bed he immediately asked how the victims were.
But Trainor - who was pictured in the Otago Daily Times two years ago working on a council road-safety project - later told probation he had no memory of leaving his friends that night or driving.
The court heard that before the boozy session, the council's contract engineer had left his car somewhere safe and had planned to pick it up the following day.
What he did instead "defied logic entirely", Judge Flatley said, calling it "appalling" offending.
In a pre-sentence interview, Trainor admitted he had experienced three alcohol-related blackouts this year.
He put the excessive drinking down to various stresses he was facing at the time.
"Clearly you have significant alcohol issues when one considers you're blacking out as a result of drinking," Judge Flatley said.
It was not Trainor's first time before the court for driving offences.
He was convicted of drink-driving in 2008, had been caught driving carelessly in 2005 and again in 2011 and had racked up demerit points for speeding.
Van Harselaar said his client had undergone counselling to "improve himself" and he provided references to the court highlighting Trainor's positive character traits.
The 30-year-old was sentenced to 350 hours' community work and 12 months' intensive supervision and banned from driving for 15 months.
Judge Flatley also imposed judicial monitoring through which he would be sent regular reports on Trainor's progress in completing the sentence.