Charlie Sheen spoke about his relationship with his ex-wife, Brooke Mueller, and their twin sons, Max and Bob, in an interview ahead of a court ruling last week that would have given him full custody of the 14-year-old boys if that she was caught using drugs or alcohol.

The “Two and a Half Men” actor said Max and Bob are proud of him for staying sober and showing sensitivity to Brooke Mueller amid her alleged ongoing struggles with substance abuse.

“They see what mom’s going through and I don’t mess with mom because I know it’s a thing,” Sheen said of his ex, who he said is “trying to figure things out on her end.”

The actor’s ex-wife, whom he divorced in 2011 after three years of marriage, will also have to provide Sheen’s lawyer with “the names, addresses and telephone numbers of all her regular and controlled sources of substances.” Sources close to Brooke Mueller told Page Six last month that a 12-step program she follows “seems to be working for her” as she tries to stay sober amid a long battle with addiction.