Ejemplo n.º 1
0
 def shutDown(self):
     if self.isShutdown:
         self.notify.warning('Got shutDown twice')
         return
     self.isShutdown = 1
     from toontown.minigame import MinigameCreatorAI
     playAgainNum = self.getNumPlayAgain()
     if playAgainNum > 0:
         playAgainList = self.getPlayAgainList()
         newVotesArray = self.getVotesArrayMatchingPlayAgainList(playAgainList)
         newRound = self.metagameRound
         newbieIdsToPass = []
         if newRound > -1:
             newbieIdsToPass = self.newbieIds
             if newRound < TravelGameGlobals.FinalMetagameRoundIndex:
                 newRound += 1
             else:
                 newRound = 0
                 newVotesArray = [TravelGameGlobals.DefaultStartingVotes] * len(playAgainList)
         if len(playAgainList) == 1 and simbase.config.GetBool('metagame-min-2-players', 1):
             newRound = -1
         MinigameCreatorAI.createMinigame(self.air, playAgainList, self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=newbieIdsToPass, startingVotes=newVotesArray, metagameRound=newRound, desiredNextGame=self.desiredNextGame)
     else:
         MinigameCreatorAI.releaseMinigameZone(self.zoneId)
     self.requestDelete()
     self.ignoreAll()
     return None
Ejemplo n.º 2
0
 def shutDown(self):
     if self.isShutdown:
         self.notify.warning('Got shutDown twice')
         return
     self.isShutdown = 1
     from toontown.minigame import MinigameCreatorAI
     playAgainNum = self.getNumPlayAgain()
     if playAgainNum > 0:
         playAgainList = self.getPlayAgainList()
         newVotesArray = self.getVotesArrayMatchingPlayAgainList(playAgainList)
         newRound = self.metagameRound
         newbieIdsToPass = []
         if newRound > -1:
             newbieIdsToPass = self.newbieIds
             if newRound < TravelGameGlobals.FinalMetagameRoundIndex:
                 newRound += 1
             else:
                 newRound = 0
                 newVotesArray = [TravelGameGlobals.DefaultStartingVotes] * len(playAgainList)
         if len(playAgainList) == 1 and simbase.config.GetBool('metagame-min-2-players', 1):
             newRound = -1
         MinigameCreatorAI.createMinigame(self.air, playAgainList, self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=newbieIdsToPass, startingVotes=newVotesArray, metagameRound=newRound, desiredNextGame=self.desiredNextGame)
     else:
         MinigameCreatorAI.releaseMinigameZone(self.zoneId)
     self.requestDelete()
     self.ignoreAll()
     return None
Ejemplo n.º 3
0
    def shutDown(self):
        if self.isShutdown:
            # We no longer own the zoneId.  If we accidentally come by
            # here again, we don't want to try to deallocate it again (or
            # hand it off to another minigame).
            # Note: We cannot set the zoneId to None because the AIRepository
            # needs to remove us from the zoneId2doIds dict
            # Maybe someone called shutDown twice.
            self.notify.warning("Got shutDown twice")
            return
        self.isShutdown = 1

        # This must be imported here rather than at the top of the
        # file in order to avoid circular imports.
        from toontown.minigame import MinigameCreatorAI

        # Does anyone want to play again?
        playAgainNum = self.getNumPlayAgain()
        assert (playAgainNum >= 0 and playAgainNum <= 4)
        # If so, start a minigame in this zone
        if playAgainNum > 0:
            playAgainList = self.getPlayAgainList()
            newVotesArray = self.getVotesArrayMatchingPlayAgainList(
                playAgainList)
            newRound = self.metagameRound
            newbieIdsToPass = []
            if newRound > -1:
                newbieIdsToPass = self.newbieIds  # we must pass this on
                if newRound < TravelGameGlobals.FinalMetagameRoundIndex:
                    newRound += 1
                else:
                    newRound = 0
                    newVotesArray = [TravelGameGlobals.DefaultStartingVotes
                                     ] * len(playAgainList)

            # but if we only have one player left, don't start the metagame
            if len(playAgainList) == 1 and \
               simbase.config.GetBool('metagame-min-2-players', 1):
                newRound = -1

            MinigameCreatorAI.createMinigame(
                self.air,
                playAgainList,
                self.trolleyZone,
                minigameZone=self.zoneId,
                previousGameId=self.previousMinigameId,
                newbieIds=newbieIdsToPass,
                startingVotes=newVotesArray,
                metagameRound=newRound,
                desiredNextGame=self.desiredNextGame)
        # If not, deallocate this zone, so it can be reused in the future.
        else:
            MinigameCreatorAI.releaseMinigameZone(self.zoneId)

        # That's it for us!
        self.requestDelete()

        # Don't listen for any more unexpected avatar exit events.
        self.ignoreAll()
        return None
 def shutDown(self):
     if self.isShutdown:
         self.notify.warning('Got shutDown twice')
         return
     self.isShutdown = 1
     from toontown.minigame import MinigameCreatorAI
     playAgainNum = self.getNumPlayAgain()
     if playAgainNum > 0:
         MinigameCreatorAI.createMinigame(self.air, self.getPlayAgainList(), self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=self.newbieIds)
     else:
         MinigameCreatorAI.releaseMinigameZone(self.zoneId)
     self.requestDelete()
     self.ignoreAll()
     return None
 def shutDown(self):
     if self.isShutdown:
         self.notify.warning('Got shutDown twice')
         return
     self.isShutdown = 1
     from toontown.minigame import MinigameCreatorAI
     playAgainNum = self.getNumPlayAgain()
     if playAgainNum > 0:
         MinigameCreatorAI.createMinigame(
             self.air,
             self.getPlayAgainList(),
             self.trolleyZone,
             minigameZone=self.zoneId,
             previousGameId=self.previousMinigameId,
             newbieIds=self.newbieIds)
     else:
         MinigameCreatorAI.releaseMinigameZone(self.zoneId)
     self.requestDelete()
     self.ignoreAll()
     return None