def start_turning(self):
        while not self.shutdown_flag:
            start = time.time()
            # Go through active npcs
            for i in reversed(xrange(len(self.active_npcs))):
                if not self.active_npcs[i].do_tick():
                    del self.active_npcs[i]
            # Manage player list
            self.player_list_lock.acquire()
            list_keys = self.player_list.keys()
            for key in list_keys:
                self.player_list[key].do_tick()
            self.cleanup()
            list_keys = self.player_list.keys()
            for key in list_keys:
                self.player_list[key].send_output()
            self.player_list_lock.release()
            
            # Perform round actions for active battles
            for key in self.battles.keys():
                self.battles[key].perform_round()
            
            # Reset areas that have had activity
            for area in self.areas.values():
                if area.times_visited_since_reset > 0:
                    now = time.time()
                    if (now - area.time_of_last_reset) >= RESET_INTERVAL:
                        area.reset()
                        self.log.info('Area %s has been reset.' % area.name)
            
            finish = time.time() - start
            if finish >= 1:
                self.log.critical('WORLD: Turn took longer than a sec!')
            elif finish < 0.25:
                time.sleep(0.25 - finish)
        self.listening = False
dataset/ETHPy150Open shinymud/ShinyMUD/src/shinymud/lib/world.py/World.start_turning/original