#NEWLINE# def _ball_ending( self , queue ) : #NEWLINE# #INDENT# if ( not self . active_modes ) : #NEWLINE# #INDENT# return ( ) #NEWLINE# #UNINDENT# self . queue = queue #NEWLINE# self . queue . wait ( ) #NEWLINE# self . mode_stop_count = 0 #NEWLINE# for mode in self . active_modes : #NEWLINE# #INDENT# if queue . auto_stop_on_ball_end : #NEWLINE# #INDENT# self . mode_stop_count += 1 #NEWLINE# mode . stop ( callback = self . _mode_stopped_callback ) #NEWLINE# #UNINDENT# if mode . restart_on_next_ball : #NEWLINE# #INDENT# self . log . debug ( 'Will Restart mode %s on next ball, mode' ) #NEWLINE# self . machine . game . player . uvars [ '_restart_modes_on_next_ball' ] . append ( mode ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . mode_stop_count ) : #NEWLINE# #INDENT# self . queue . clear ( )