@tornado.gen.coroutine
    def resolve(self):
        if not self.is_writable():
            return
        
        # Detach the update map. From this point on, the task is nonwritable
        # again!
        updateconns = self.updateconns
        changeset = self.changeset
        self.updateconns = None
        self.changeset = None

        # If nobody needs updating, we're done.
        if not (changeset or updateconns):
            return

        connections = self.app.playconns.all()

        # Go through the data changes, setting dirty bits as needed.
        # (But we try to do as little work as possible.)
        if changeset:
            #self.log.debug('Task changeset: %s', changeset)
            for conn in connections:
                dirty = updateconns.get(conn.connid, 0)
                if not (dirty & DIRTY_LOCALE):
                    if not conn.localedependencies.isdisjoint(changeset):
                        dirty |= DIRTY_LOCALE
                if not (dirty & DIRTY_POPULACE):
                    if not conn.populacedependencies.isdisjoint(changeset):
                        dirty |= DIRTY_POPULACE
                if not (dirty & DIRTY_FOCUS):
                    if not conn.focusdependencies.isdisjoint(changeset):
                        dirty |= DIRTY_FOCUS
                if not (dirty & DIRTY_TOOL):
                    if not conn.tooldependencies.isdisjoint(changeset):
                        dirty |= DIRTY_TOOL
                if dirty:
                    updateconns[conn.connid] = dirty

        # Again, we might be done.
        if not updateconns:
            return

        # self.log.info('Must resolve updates: %s', updateconns)
        
        # If two connections are on the same player, this won't be
        # as efficient as it might be -- we'll generate text twice.
        # But that's a rare case.
        for (connid, dirty) in updateconns.items():
            try:
                self.resetticks()
                conn = self.app.playconns.get(connid)
                yield two.execute.generate_update(self, conn, dirty)
            except Exception as ex:
                self.log.error('Error updating while resolving task: %s', self.cmdobj, exc_info=True)
Resolve all side effects caused by data changes during this command.
dataset/ETHPy150Open erkyrath/tworld/lib/two/task.py/Task.resolve