def loadTransitions(self, tourian): # return the transitions rooms = GraphUtils.getRooms() bossTransitions = {} areaTransitions = {} for accessPoint in Logic.accessPoints: if accessPoint.isInternal() == True: continue key = self.getTransition(accessPoint.ExitInfo['DoorPtr']) if key not in rooms: # can happen with race mode seeds continue destAP = rooms[key] if accessPoint.Boss == True or destAP.Boss == True: bossTransitions[accessPoint.Name] = destAP.Name else: areaTransitions[accessPoint.Name] = destAP.Name def removeBiTrans(transitions): # remove bidirectionnal transitions # can't del keys in a dict while iterating it transitionsCopy = copy.copy(transitions) for src in transitionsCopy: if src in transitions: dest = transitions[src] if dest in transitions: if transitions[dest] == src: del transitions[dest] return [(t, transitions[t]) for t in transitions] # get escape transition if tourian == 'Disabled': escapeSrcAP = getAccessPoint('Climb Bottom Left') else: escapeSrcAP = getAccessPoint('Tourian Escape Room 4 Top Right') key = self.getTransition(escapeSrcAP.ExitInfo['DoorPtr']) # may not be set in plandomizer if key in rooms: escapeDstAP = rooms[key] escapeTransition = [(escapeSrcAP.Name, escapeDstAP.Name)] else: escapeTransition = [] areaTransitions = removeBiTrans(areaTransitions) bossTransitions = removeBiTrans(bossTransitions) return (areaTransitions, bossTransitions, escapeTransition, GraphUtils.hasMixedTransitions(areaTransitions, bossTransitions))
def loadTransitions(self): # return the transitions rooms = GraphUtils.getRooms() bossTransitions = {} areaTransitions = {} for accessPoint in Logic.accessPoints: if accessPoint.isInternal() == True: continue key = self.getTransition(accessPoint.ExitInfo['DoorPtr']) destAP = rooms[key] if accessPoint.Boss == True or destAP.Boss == True: bossTransitions[accessPoint.Name] = destAP.Name else: areaTransitions[accessPoint.Name] = destAP.Name def removeBiTrans(transitions): # remove bidirectionnal transitions # can't del keys in a dict while iterating it transitionsCopy = copy.copy(transitions) for src in transitionsCopy: if src in transitions: dest = transitions[src] if dest in transitions: if transitions[dest] == src: del transitions[dest] return [(t, transitions[t]) for t in transitions] # get escape transition escapeSrcAP = getAccessPoint('Tourian Escape Room 4 Top Right') key = self.getTransition(escapeSrcAP.ExitInfo['DoorPtr']) escapeDstAP = rooms[key] escapeTransition = [(escapeSrcAP.Name, escapeDstAP.Name)] areaTransitions = removeBiTrans(areaTransitions) bossTransitions = removeBiTrans(bossTransitions) return (areaTransitions, bossTransitions, escapeTransition, GraphUtils.hasMixedTransitions(areaTransitions, bossTransitions))