def spawnElection(self):
     election = self.air.doFind('ElectionEvent')
     if election is None:
         election = DistributedElectionEventAI(self.air)
         election.generateWithRequired(self.HOOD)
     election.b_setState('Idle')
     if self.air.config.GetBool('want-hourly-doomsday', False):
         self.__startElectionTick()
 def __electionTick(self, task):
     # The next tick will occur in exactly an hour.
     task.delayTime = 3600
     # Check if we have toons in TTC...
     toons = self.air.doFindAll('DistributedToon')
     if not toons:
         # There are no toons online, just wait for the next hour.
         return task.again
     # Is there an invasion currently running?
     election = self.air.doFind('ElectionEvent')
     if election:
         state = election.getState()
         if state[0] == 'Idle':
             # There's already an Idle invasion, start it!
             taskMgr.doMethodLater(10, election.b_setState, 'election-start-delay', extraArgs=['Event'])
     if not election:
         # Create a new election object.
         election = DistributedElectionEventAI(self.air)
         election.generateWithRequired(self.HOOD)
         election.b_setState('Idle')
         # Start the election after a 10 second delay.
         taskMgr.doMethodLater(10, election.b_setState, 'election-start-delay', extraArgs=['Event'])
     return task.again
Exemplo n.º 3
0
 def spawnElection(self):
     election = self.air.doFind('ElectionEvent')
     if election is None:
         election = DistributedElectionEventAI(self.air)
         election.generateWithRequired(self.zoneId)
     election.b_setState('Idle')
     if self.air.config.GetBool('want-hourly-doomsday', False):
         self.__startElectionTick()
     return
Exemplo n.º 4
0
 def __electionTick(self, task):
     task.delayTime = 3600
     toons = self.air.doFindAll('DistributedToon')
     if not toons:
         return task.again
     election = self.air.doFind('ElectionEvent')
     if election:
         state = election.getState()
         if state[0] == 'Idle':
             taskMgr.doMethodLater(10, election.b_setState, 'election-start-delay', extraArgs=['Event'])
     if not election:
         election = DistributedElectionEventAI(self.air)
         election.generateWithRequired(self.zoneId)
         election.b_setState('Idle')
         taskMgr.doMethodLater(10, election.b_setState, 'election-start-delay', extraArgs=['Event'])
     return task.again