def startOffice(self):
     self.notify.info('loading spec')
     specModule = self.layout.getFloorSpec(self.currentFloor)
     self.level = DistributedLawOfficeFloorAI.DistributedLawOfficeFloorAI(self.air, self.lawOfficeId, self.zoneId, self.entranceId, self.avIds, specModule)
     self.level.setLevelSpec(LevelSpec.LevelSpec(specModule))
     self.notify.info('creating entities')
     self.level.generateWithRequired(self.zoneId)
     self.elevator = DistributedElevatorFloorAI.DistributedElevatorFloorAI(self.air, self.doId, self, self.avIds)
     self.elevator.setEntering(0)
     self.elevator.generateWithRequired(self.zoneId)
     self.elevatorB = DistributedElevatorFloorAI.DistributedElevatorFloorAI(self.air, self.doId, self, self.avIds)
     self.elevatorB.setEntering(1)
     self.elevatorB.generateWithRequired(self.zoneId)
     self.exchangeElevators()
Exemple #2
0
    def levelAnnounceGenerate(self):
        self.notify.debug('levelAnnounceGenerate')
        DistributedLevel.DistributedLevel.levelAnnounceGenerate(self)

        # create our spec
        # NOTE: in dev, the AI will probably send us another spec to use
        specModule = CountryClubRoomSpecs.getCountryClubRoomSpecModule(
            self.roomId)
        roomSpec = LevelSpec.LevelSpec(specModule)
        if __dev__:
            # give the spec a factory EntityTypeRegistry.
            typeReg = self.getCountryClubEntityTypeReg()
            roomSpec.setEntityTypeReg(typeReg)

        DistributedLevel.DistributedLevel.initializeLevel(self, roomSpec)
    def generate(self):
        self.notify.info('generate')
        self.notify.info(
            'start factory %s %s creation, frame=%s' %
            (self.factoryId, self.doId, globalClock.getFrameCount()))
        if __dev__:
            simbase.factory = self
        self.notify.info('loading spec')
        specModule = FactorySpecs.getFactorySpecModule(self.factoryId)
        factorySpec = LevelSpec.LevelSpec(specModule)
        if __dev__:
            self.notify.info('creating entity type registry')
            typeReg = self.getEntityTypeReg()
            factorySpec.setEntityTypeReg(typeReg)
        self.notify.info('creating entities')
        DistributedLevelAI.DistributedLevelAI.generate(self, factorySpec)
        self.notify.info('creating cogs')
        cogSpecModule = FactorySpecs.getCogSpecModule(self.factoryId)
        if self.getFactoryId() == ToontownGlobals.SwagFactoryInt:
            self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(
                self.air, self,
                DistributedFactorySuitAI.DistributedFactorySuitAI,
                DistributedBattleSwagtoryAI.DistributedBattleSwagtoryAI,
                cogSpecModule.CogData, cogSpecModule.ReserveCogData,
                cogSpecModule.BattleCells)
        else:
            self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(
                self.air, self,
                DistributedFactorySuitAI.DistributedFactorySuitAI,
                DistributedBattleFactoryAI.DistributedBattleFactoryAI,
                cogSpecModule.CogData, cogSpecModule.ReserveCogData,
                cogSpecModule.BattleCells)
        suitHandles = self.planner.genSuits()
        messenger.send('plannerCreated-' + str(self.doId))
        self.suits = suitHandles['activeSuits']
        self.reserveSuits = suitHandles['reserveSuits']
        self.d_setSuits()
        scenario = 0
        for avId in self.avIdList:
            self.air.writeServerEvent('factory-entered',
                                      avId=avId,
                                      factoryId=self.factoryId,
                                      entranceId=self.entranceId,
                                      scenario=scenario,
                                      avIds=self.avIdList)

        self.notify.info('finish factory %s %s creation' %
                         (self.factoryId, self.doId))
    def levelAnnounceGenerate(self):
        #print("LEVEL ANNOUNCE GENERATE")
        self.notify.debug('levelAnnounceGenerate')
        #import pdb; pdb.set_trace() # toon detached by here
        DistributedLevel.DistributedLevel.levelAnnounceGenerate(self)

        # create our spec
        # NOTE: in dev, the AI will probably send us another spec to use
        specModule = FactorySpecs.getFactorySpecModule(self.lawOfficeId)
        factorySpec = LevelSpec.LevelSpec(specModule)
        if __dev__:
            # give the spec a factory EntityTypeRegistry.
            typeReg = self.getEntityTypeReg()
            factorySpec.setEntityTypeReg(typeReg)
        
        DistributedLevel.DistributedLevel.initializeLevel(self, factorySpec)
 def generate(self):
     self.notify.debug('generate %s: room=%s' % (self.doId, self.roomId))
     self.notify.debug('loading spec')
     specModule = MintRoomSpecs.getMintRoomSpecModule(self.roomId)
     roomSpec = LevelSpec.LevelSpec(specModule)
     self.notify.debug('creating entities')
     DistributedLevelAI.DistributedLevelAI.generate(self, roomSpec)
     self.notify.debug('creating cogs')
     cogSpecModule = MintRoomSpecs.getCogSpecModule(self.roomId)
     self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(self.air, self, DistributedMintSuitAI.DistributedMintSuitAI, DistributedMintBattleAI.DistributedMintBattleAI, cogSpecModule.CogData, cogSpecModule.ReserveCogData, cogSpecModule.BattleCells, battleExpAggreg=self.battleExpAggreg)
     suitHandles = self.planner.genSuits()
     messenger.send('plannerCreated-' + str(self.doId))
     self.suits = suitHandles['activeSuits']
     self.reserveSuits = suitHandles['reserveSuits']
     self.d_setSuits()
     self.notify.debug('finish mint room %s %s creation' % (self.roomId, self.doId))
Exemple #6
0
    def generate(self):
        self.notify.debug('generate %s: room=%s' % (self.doId, self.roomId))

        # create our spec
        self.notify.debug('loading spec')
        specModule = StageRoomSpecs.getStageRoomSpecModule(self.roomId)
        roomSpec = LevelSpec.LevelSpec(specModule)

        if __dev__:
            # create a factory EntityTypeRegistry and hand it to the spec
            self.notify.debug('creating entity type registry')
            typeReg = self.getStageEntityTypeReg()
            roomSpec.setEntityTypeReg(typeReg)

        self.notify.debug('creating entities')
        DistributedLevelAI.DistributedLevelAI.generate(self, roomSpec)

        # TODO: convert suits into Entities
        # create the suits
        # Until they are converted to entities, it's important that
        # the suits are created in the levelZone.

        self.notify.debug('creating cogs')
        cogSpecModule = StageRoomSpecs.getCogSpecModule(self.roomId)
        self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(
            self.air,
            self,
            DistributedStageSuitAI.DistributedStageSuitAI,
            DistributedStageBattleAI.DistributedStageBattleAI,
            cogSpecModule.CogData,
            cogSpecModule.ReserveCogData,
            cogSpecModule.BattleCells,
            battleExpAggreg=self.battleExpAggreg)
        suitHandles = self.planner.genSuits()
        # alert battle blockers that planner has been created
        messenger.send("plannerCreated-" + str(self.doId))

        self.suits = suitHandles['activeSuits']
        self.reserveSuits = suitHandles['reserveSuits']
        self.d_setSuits()

        self.notify.debug('finish stage room %s %s creation' %
                          (self.roomId, self.doId))
Exemple #7
0
    def startFloor(self):

        if __debug__:
            simbase.factory = self

        # create our spec
        self.notify.info('loading spec')
        self.factorySpec = LevelSpec.LevelSpec(self.spec)

        if __dev__:
            # create a factory EntityTypeRegistry and hand it to the spec
            self.notify.info('creating entity type registry')
            typeReg = self.getEntityTypeReg()
            self.factorySpec.setEntityTypeReg(typeReg)

        self.notify.info('creating entities')
        DistributedLevelAI.DistributedLevelAI.generate(self, self.factorySpec)

        self.notify.info('creating cogs')
        cogSpecModule = FactorySpecs.getCogSpecModule(self.lawOfficeId)
        self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(
            self.air, self, DistributedFactorySuitAI.DistributedFactorySuitAI,
            DistributedBattleFactoryAI.DistributedBattleFactoryAI,
            cogSpecModule.CogData, cogSpecModule.ReserveCogData,
            cogSpecModule.BattleCells)
        suitHandles = self.planner.genSuits()
        # alert battle blockers that planner has been created
        messenger.send("plannerCreated-" + str(self.doId))

        self.suits = suitHandles['activeSuits']
        self.reserveSuits = suitHandles['reserveSuits']
        self.d_setSuits()

        # log that toons entered the factory
        scenario = 0  # placeholder until we have real scenarios
        description = '%s|%s|%s|%s' % (self.lawOfficeId, self.entranceId,
                                       scenario, self.avIdList)
        for avId in self.avIdList:
            self.air.writeServerEvent('DAOffice Entered', avId, description)

        self.notify.info('finish factory %s %s creation' %
                         (self.lawOfficeId, self.doId))
Exemple #8
0
    def startNextFloor(self):
        #print("LOADING NEXT FLOOR!!!!! %s" % (self.currentFloor + 1))
        #print self.layout.floorIds

        if self.avIds:
            print(self.avIds)
            self.currentFloor += 1
            specModule = self.layout.getFloorSpec(self.currentFloor)

            #self.currentFloorZone = self.air.allocateZone()
            self.level.requestDelete()

            self.level = DistributedLawOfficeFloorAI.DistributedLawOfficeFloorAI(
                self.air, self.lawOfficeId, self.zoneId, self.entranceId,
                self.avIds, specModule)
            self.level.setLevelSpec(LevelSpec.LevelSpec(specModule))
            self.level.generateWithRequired(self.zoneId)

            print("exchanging elevators")
            self.exchangeElevators()
            self.startSignal()
Exemple #9
0
    def startOffice(self):
        #print("LOADING FIRST FLOOR!!!!! %s" % (self.currentFloor))

        # create our first floor
        self.notify.info('loading spec')
        specModule = self.layout.getFloorSpec(self.currentFloor)
        self.level = DistributedLawOfficeFloorAI.DistributedLawOfficeFloorAI(
            self.air, self.lawOfficeId, self.zoneId, self.entranceId,
            self.avIds, specModule)
        self.level.setLevelSpec(LevelSpec.LevelSpec(specModule))
        #self.currentFloorZone = self.air.allocateZone()

        self.notify.info('creating entities')
        self.level.generateWithRequired(self.zoneId)

        #print("STARTING TOONBARRIER FOR %s" % (self.avIds))
        #self.__barrier = ToonBarrier(
        #    'waitClientsFinishFloor',
        #    self.uniqueName('waitClientsFinishFloor'),
        #    self.avIds, 10000,
        #    self.startNextFloor, self.dumpEveryone)

        #Start: Add the connecting elevator--------------------

        #print("START SETTING UP ELEVATORS!!!")
        self.elevator = DistributedElevatorFloorAI.DistributedElevatorFloorAI(
            self.air, self.doId, self, self.avIds)
        #self.elevator.setLocked(0)
        self.elevator.setEntering(0)
        self.elevator.generateWithRequired(self.zoneId)
        self.elevatorB = DistributedElevatorFloorAI.DistributedElevatorFloorAI(
            self.air, self.doId, self, self.avIds)
        #self.elevatorB.setLocked(0)
        self.elevatorB.setEntering(1)
        self.elevatorB.generateWithRequired(self.zoneId)
        #self.unlockElevator()
        #self.elevator.unlock()
        #self.elevatorB.unlock()
        self.exchangeElevators()
 def startFloor(self):
     self.notify.info('loading spec')
     self.factorySpec = LevelSpec.LevelSpec(self.spec)
     if __dev__:
         self.notify.info('creating entity type registry')
         typeReg = self.getEntityTypeReg()
         self.factorySpec.setEntityTypeReg(typeReg)
     self.notify.info('creating entities')
     DistributedLevelAI.DistributedLevelAI.generate(self, self.factorySpec)
     self.notify.info('creating cogs')
     cogSpecModule = FactorySpecs.getCogSpecModule(self.lawOfficeId)
     self.planner = LevelSuitPlannerAI.LevelSuitPlannerAI(self.air, self, DistributedFactorySuitAI.DistributedFactorySuitAI, DistributedBattleFactoryAI.DistributedBattleFactoryAI, cogSpecModule.CogData, cogSpecModule.ReserveCogData, cogSpecModule.BattleCells)
     suitHandles = self.planner.genSuits()
     messenger.send('plannerCreated-' + str(self.doId))
     self.suits = suitHandles['activeSuits']
     self.reserveSuits = suitHandles['reserveSuits']
     self.d_setSuits()
     scenario = 0
     description = '%s|%s|%s|%s' % (self.lawOfficeId, self.entranceId, scenario, self.avIdList)
     for avId in self.avIdList:
         self.air.writeServerEvent('DAOffice Entered', avId, description)
     self.notify.info('finish factory %s %s creation' % (self.lawOfficeId, self.doId))
Exemple #11
0
 def levelAnnounceGenerate(self):
     self.notify.debug('levelAnnounceGenerate')
     DistributedLevel.DistributedLevel.levelAnnounceGenerate(self)
     specModule = FactorySpecs.getFactorySpecModule(self.lawOfficeId)
     factorySpec = LevelSpec.LevelSpec(specModule)
     DistributedLevel.DistributedLevel.initializeLevel(self, factorySpec)
 def levelAnnounceGenerate(self):
     self.notify.debug('levelAnnounceGenerate')
     DistributedLevel.DistributedLevel.levelAnnounceGenerate(self)
     specModule = MintRoomSpecs.getMintRoomSpecModule(self.roomId)
     roomSpec = LevelSpec.LevelSpec(specModule)
     DistributedLevel.DistributedLevel.initializeLevel(self, roomSpec)