def generate(self):
        DistributedObjectAI.DistributedObjectAI.generate(self)
        self.notify.info('generate %s, id=%s, floor=%s' %
                         (self.doId, self.stageId, self.floorNum))
        self.layout = StageLayout.StageLayout(self.stageId, self.floorNum,
                                              self.layoutIndex)
        self.rooms = []
        if self.battleExpAggreg is None:
            self.battleExpAggreg = BattleExperienceAggregatorAI.BattleExperienceAggregatorAI(
            )
        for i in xrange(self.layout.getNumRooms()):
            room = DistributedStageRoomAI.DistributedStageRoomAI(
                self.air, self.stageId, self.doId, self.zoneId,
                self.layout.getRoomId(i), i * 2, self.avIds,
                self.battleExpAggreg)
            room.generateWithRequired(self.zoneId)
            self.rooms.append(room)

        roomDoIds = []
        for room in self.rooms:
            roomDoIds.append(room.doId)

        self.sendUpdate('setRoomDoIds', [roomDoIds])
        self.placeElevatorsOnMarkers()
        if __dev__:
            simbase.stage = self
        description = '%s|%s|%s' % (self.stageId, self.floorNum, self.avIds)
        for avId in self.avIds:
            self.air.writeServerEvent('stageEntered', avId, description)

        return
Beispiel #2
0
    def generate(self):
        DistributedObjectAI.DistributedObjectAI.generate(self)
        self.notify.info('generate %s, id=%s, floor=%s' %
                         (self.doId, self.stageId, self.floorNum))

        self.layout = StageLayout.StageLayout(self.stageId, self.floorNum,
                                              self.layoutIndex)
        self.rooms = []

        if self.battleExpAggreg is None:
            # create a battle experience aggregator for the stage rooms to share
            self.battleExpAggreg = BattleExperienceAggregatorAI.\
                                   BattleExperienceAggregatorAI()

        # create a StageRoom level obj for each room in the layout
        for i in range(self.layout.getNumRooms()):
            # i*2 for roomNum leaves numbers for hallways
            room = DistributedStageRoomAI.DistributedStageRoomAI(
                self.air, self.stageId, self.doId, self.zoneId,
                self.layout.getRoomId(i), i * 2, self.avIds,
                self.battleExpAggreg)
            room.generateWithRequired(self.zoneId)
            self.rooms.append(room)

        roomDoIds = []
        for room in self.rooms:
            roomDoIds.append(room.doId)
        self.sendUpdate('setRoomDoIds', [roomDoIds])

        self.placeElevatorsOnMarkers()

        if __dev__:
            simbase.stage = self

        # log that toons entered the stage
        description = '%s|%s|%s' % (self.stageId, self.floorNum, self.avIds)
        for avId in self.avIds:
            self.air.writeServerEvent('stageEntered', avId, description)