A man accused in a 2020 shooting spree that targeted two dozen people and left one man dead has pleaded guilty but mentally ill to 23 felony charges.