当前位置: 首页>>代码示例>>Python>>正文


Python SuitDNA类代码示例

本文整理汇总了Python中SuitDNA的典型用法代码示例。如果您正苦于以下问题:Python SuitDNA类的具体用法?Python SuitDNA怎么用?Python SuitDNA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SuitDNA类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createInitialSuitBuildings

    def createInitialSuitBuildings(self):
        if self.buildingMgr is None:
            return

        # If we aren't at our minimum number of buildings, let's spawn some!
        suitBlockCount = len(self.buildingMgr.getSuitBlocks())
        if suitBlockCount < self.targetNumSuitBuildings:
            for _ in xrange(self.targetNumSuitBuildings - suitBlockCount):
                blockNumber = random.choice(self.buildingMgr.getToonBlocks())
                building = self.buildingMgr.getBuilding(blockNumber)
                if building is None:
                    continue
                if NPCToons.isZoneProtected(building.getExteriorAndInteriorZoneId()[1]):
                    continue
                suitName = self.air.suitInvasionManager.getInvadingCog()[0]
                if suitName is None:
                    suitName = self.defaultSuitName
                suitType = None
                suitTrack = None
                if suitName is not None:
                    suitType = SuitDNA.getSuitType(suitName)
                    suitTrack = SuitDNA.getSuitDept(suitName)
                (suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(None, suitType, suitTrack)
                building.suitTakeOver(suitTrack, suitLevel, None)

        # Save the building manager's state:
        self.buildingMgr.save()
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:27,代码来源:DistributedSuitPlannerAI.py

示例2: __makeResistanceToon

    def __makeResistanceToon(self):
        if self.resistanceToon:
            return
        npc = Toon.Toon()
        npc.setName(TTLocalizer.ResistanceToonName)
        npc.setPickable(0)
        npc.setPlayerType(NametagGroup.CCNonPlayer)
        dna = ToonDNA.ToonDNA()
        dna.newToonRandom(11237, 'f', 1)
        dna.head = 'pls'
        npc.setDNAString(dna.makeNetString())
        npc.animFSM.request('neutral')
        self.resistanceToon = npc
        self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr)
        state = random.getstate()
        random.seed(self.doId)
        self.resistanceToon.suitType = SuitDNA.getRandomSuitByDept('m')
        random.setstate(state)
        self.fakeGoons = []
        for i in range(self.numFakeGoons):
            goon = DistributedCashbotBossGoon.DistributedCashbotBossGoon(base.cr)
            goon.doId = -1 - i
            goon.setBossCogId(self.doId)
            goon.generate()
            goon.announceGenerate()
            self.fakeGoons.append(goon)

        self.__hideFakeGoons()
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:28,代码来源:DistributedCashbotBoss.py

示例3: announceGenerate

 def announceGenerate(self):
     DistributedBossCog.DistributedBossCog.announceGenerate(self)
     self.setName(TTLocalizer.CashbotBossName)
     nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self.name,
      'dept': SuitDNA.getDeptFullname(self.style.dept)}
     self.setDisplayName(nameInfo)
     target = CollisionSphere(2, 0, 0, 3)
     targetNode = CollisionNode('headTarget')
     targetNode.addSolid(target)
     targetNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.headTarget = self.neck.attachNewNode(targetNode)
     shield = CollisionSphere(0, 0, 0.8, 7)
     shieldNode = CollisionNode('shield')
     shieldNode.addSolid(shield)
     shieldNode.setCollideMask(ToontownGlobals.PieBitmask)
     shieldNodePath = self.pelvis.attachNewNode(shieldNode)
     self.heldObject = None
     self.bossDamage = 0
     self.loadEnvironment()
     self.__makeResistanceToon()
     self.physicsMgr = PhysicsManager()
     integrator = LinearEulerIntegrator()
     self.physicsMgr.attachLinearIntegrator(integrator)
     fn = ForceNode('gravity')
     self.fnp = self.geom.attachNewNode(fn)
     gravity = LinearVectorForce(0, 0, -32)
     fn.addForce(gravity)
     self.physicsMgr.addLinearForce(gravity)
     localAvatar.chatMgr.chatInputSpeedChat.addCFOMenu()
     global OneBossCog
     if OneBossCog != None:
         self.notify.warning('Multiple BossCogs visible.')
     OneBossCog = self
     return
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:34,代码来源:DistributedCashbotBoss.py

示例4: getSuitName

 def getSuitName(self):
     if self.suitDeptIndex is not None:
         if self.suitTypeIndex is not None:
             return SuitDNA.getSuitName(self.suitDeptIndex, self.suitTypeIndex)
         else:
             return SuitDNA.suitDepts[self.suitDeptIndex]
     else:
         return SuitDNA.suitHeadTypes[0]
开发者ID:Teku16,项目名称:ToontownPlanet,代码行数:8,代码来源:SuitInvasionManagerAI.py

示例5: startTakeOver

 def startTakeOver(self):
     if not self.SUIT_BUILDINGS:
         return
     blockNumber = self.buildingDestination
     if not self.sp.buildingMgr.isSuitBlock(blockNumber):
         self.notify.debug('Suit %d taking over building %d in %d' % (self.getDoId(), blockNumber, self.zoneId))
         difficulty = self.getActualLevel() - 1
         if self.buildingDestinationIsCogdo:
             self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight)
         else:
             dept = SuitDNA.getSuitDept(self.dna.name)
             self.sp.suitTakeOver(blockNumber, dept, difficulty, self.buildingHeight)
开发者ID:OldToontown,项目名称:OldToontown,代码行数:12,代码来源:DistributedSuitAI.py

示例6: __init__

    def __init__(self, avatar):
        AvatarPanel.AvatarPanel.__init__(self, avatar, FriendsListPanel=FriendsListPanel)
        self.avName = avatar.getName()
        gui = loader.loadModel('phase_3.5/models/gui/suit_detail_panel')
        self.frame = DirectFrame(
                                 geom=gui.find('**/avatar_panel'),
                                 relief=None,
                                 geom_scale=0.21,
                                 pos=(-0.23, 0, -0.44),
                                 parent=base.a2dTopRight)
        disabledImageColor = Vec4(1, 1, 1, 0.4)
        text0Color = Vec4(1, 1, 1, 1)
        text1Color = Vec4(0.5, 1, 0.5, 1)
        text2Color = Vec4(1, 1, 0.5, 1)
        text3Color = Vec4(1, 1, 1, 0.2)
        self.head = self.frame.attachNewNode('head')
        for part in avatar.headParts:
            copyPart = part.copyTo(self.head)
            copyPart.setDepthTest(1)
            copyPart.setDepthWrite(1)

        p1 = Point3()
        p2 = Point3()
        self.head.calcTightBounds(p1, p2)
        d = p2 - p1
        biggest = max(d[0], d[1], d[2])
        s = 0.3 / biggest
        self.head.setPosHprScale(0, 0, 0, 180, 0, 0, s, s, s)
        self.nameLabel = DirectLabel(parent=self.frame, pos=(0.0125, 0, 0.36), relief=None, text=self.avName, text_font=avatar.getFont(), text_fg=Vec4(0, 0, 0, 1), text_pos=(0, 0), text_scale=0.047, text_wordwrap=7.5, text_shadow=(1, 1, 1, 1))
        level = avatar.getActualLevel()
        dept = SuitDNA.getSuitDeptFullname(avatar.dna.name)
        self.levelLabel = DirectLabel(parent=self.frame, pos=(0, 0, -0.1), relief=None, text=TTLocalizer.AvatarPanelCogLevel % level, text_font=avatar.getFont(), text_align=TextNode.ACenter, text_fg=Vec4(0, 0, 0, 1), text_pos=(0, 0), text_scale=0.05, text_wordwrap=8.0)
        corpIcon = avatar.corpMedallion.copyTo(hidden)
        corpIcon.iPosHprScale()
        self.corpIcon = DirectLabel(parent=self.frame, geom=corpIcon, geom_scale=0.13, pos=(0, 0, -0.175), relief=None)
        corpIcon.removeNode()
        self.deptLabel = DirectLabel(parent=self.frame, pos=(0, 0, -0.28), relief=None, text=dept, text_font=avatar.getFont(), text_align=TextNode.ACenter, text_fg=Vec4(0, 0, 0, 1), text_pos=(0, 0), text_scale=0.05, text_wordwrap=8.0)
        self.closeButton = DirectButton(parent=self.frame, relief=None, pos=(0.0, 0, -0.36), text=TTLocalizer.AvatarPanelCogDetailClose, text_font=avatar.getFont(), text0_fg=Vec4(0, 0, 0, 1), text1_fg=Vec4(0.5, 0, 0, 1), text2_fg=Vec4(1, 0, 0, 1), text_pos=(0, 0), text_scale=0.05, command=self.__handleClose)
        gui.removeNode()
        menuX = -0.05
        menuScale = 0.064
        base.localAvatar.obscureFriendsListButton(1)
        self.frame.show()
        messenger.send('avPanelDone')
        base.hideFriendMargins()
        return
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:46,代码来源:SuitAvatarPanel.py

示例7: __makeResistanceToon

    def __makeResistanceToon(self):
        if self.resistanceToon:
            return
        self.resistanceToon = NPCToons.createLocalNPC(12002)
        self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr)
        state = random.getstate()
        random.seed(self.doId)
        self.resistanceToon.suitType = SuitDNA.getRandomSuitByDept('m')
        random.setstate(state)
        self.fakeGoons = []
        for i in xrange(self.numFakeGoons):
            goon = DistributedCashbotBossGoon.DistributedCashbotBossGoon(base.cr)
            goon.doId = -1 - i
            goon.setBossCogId(self.doId)
            goon.generate()
            goon.announceGenerate()
            self.fakeGoons.append(goon)

        self.__hideFakeGoons()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:19,代码来源:DistributedCashbotBoss.py

示例8: sendInvasionStatus

 def sendInvasionStatus(self):
     if self.invading:
         if self.suitDeptIndex is not None:
             if self.suitTypeIndex is not None:
                 type = SuitBattleGlobals.SuitAttributes[self.getSuitName()]['name']
             else:
                 type = SuitDNA.getDeptFullname(self.getSuitName())
         else:
             type = None
         status = {
             'invasion': {
                 'type': type,
                 'flags': [self.isSkelecog, self.isV2, self.isWaiter, self.isVirtual, self.isRental],
                 'remaining': self.remaining,
                 'total': self.total,
                 'start': self.start
             }
         }
     else:
         status = {'invasion': None}
     self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status])
开发者ID:Teku16,项目名称:ToontownPlanet,代码行数:21,代码来源:SuitInvasionManagerAI.py

示例9: createNewSuit

    def createNewSuit(self, blockNumbers, streetPoints, toonBlockTakeover=None,
            cogdoTakeover=None, minPathLen=None, maxPathLen=None,
            buildingHeight=None, suitLevel=None, suitType=None, suitTrack=None,
            suitName=None, skelecog=None, revives=None):
        startPoint = None
        blockNumber = None
        if self.notify.getDebug():
            self.notify.debug('Choosing origin from %d+%d possibles.' % (len(streetPoints), len(blockNumbers)))
        while startPoint == None and len(blockNumbers) > 0:
            bn = random.choice(blockNumbers)
            blockNumbers.remove(bn)
            if self.buildingSideDoors.has_key(bn):
                for doorPoint in self.buildingSideDoors[bn]:
                    points = self.dnaStore.getAdjacentPoints(doorPoint)
                    i = points.getNumPoints() - 1
                    while blockNumber == None and i >= 0:
                        pi = points.getPointIndex(i)
                        p = self.pointIndexes[pi]
                        i -= 1
                        startTime = SuitTimings.fromSuitBuilding
                        startTime += self.dnaStore.getSuitEdgeTravelTime(doorPoint.getIndex(), pi, self.suitWalkSpeed)
                        if not self.pointCollision(p, doorPoint, startTime):
                            startTime = SuitTimings.fromSuitBuilding
                            startPoint = doorPoint
                            blockNumber = bn
        while startPoint == None and len(streetPoints) > 0:
            p = random.choice(streetPoints)
            streetPoints.remove(p)
            if not self.pointCollision(p, None, SuitTimings.fromSky):
                startPoint = p
                startTime = SuitTimings.fromSky
                continue
        if startPoint == None:
            print 'DSP failed to create a new suit! REASON: startPoint = None'
            return None
        newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, self)
        newSuit.startPoint = startPoint
        if blockNumber != None:
            newSuit.buildingSuit = 1
            if suitTrack == None:
                suitTrack = self.buildingMgr.getBuildingTrack(blockNumber)
        else:
            newSuit.flyInSuit = 1
            newSuit.attemptingTakeover = self.newSuitShouldAttemptTakeover()
            if newSuit.attemptingTakeover:
                if suitTrack == None and len(self.pendingBuildingTracks) > 0:
                    suitTrack = self.pendingBuildingTracks[0]
                    del self.pendingBuildingTracks[0]
                    self.pendingBuildingTracks.append(suitTrack)

                if buildingHeight == None and len(self.pendingBuildingHeights) > 0:
                    buildingHeight = self.pendingBuildingHeights[0]
                    del self.pendingBuildingHeights[0]
                    self.pendingBuildingHeights.append(buildingHeight)
        if suitName == None:
            (suitName, skelecog, v2, waiter) = self.air.suitInvasionManager.getInvadingCog()
            if suitName == None:
                suitName = self.defaultSuitName
        if suitType == None and suitName != None:
            suitType = SuitDNA.getSuitType(suitName)
            suitTrack = SuitDNA.getSuitDept(suitName)
        if suitLevel == None and buildingHeight != None:
            suitLevel = self.chooseSuitLevel(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL], buildingHeight)
        (suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(suitLevel, suitType, suitTrack)
        newSuit.setupSuitDNA(suitLevel, suitType, suitTrack)
        newSuit.buildingHeight = buildingHeight
        gotDestination = self.chooseDestination(newSuit, startTime, toonBlockTakeover = toonBlockTakeover, cogdoTakeover = cogdoTakeover, minPathLen = minPathLen, maxPathLen = maxPathLen)
        if not gotDestination:
            self.notify.debug("Couldn't get a destination in %d!" % self.zoneId)
            newSuit.doNotDeallocateChannel = None
            newSuit.delete()
            print 'DSP failed to create a new suit! REASON: gotDestination = None'
            return None
        newSuit.initializePath()
        self.zoneChange(newSuit, None, newSuit.zoneId)
        if skelecog:
            newSuit.setSkelecog(skelecog)
        newSuit.generateWithRequired(newSuit.zoneId)
        if v2:
            revives = 1
        if revives:
            newSuit.b_setSkeleRevives(revives)
        newSuit.d_setSPDoId(self.doId)
        newSuit.moveToNextLeg(None)
        self.suitList.append(newSuit)
        if newSuit.flyInSuit:
            self.numFlyInSuits += 1
        if newSuit.buildingSuit:
            self.numBuildingSuits += 1
        if newSuit.attemptingTakeover:
            self.numAttemptingTakeover += 1
        return newSuit
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:92,代码来源:DistributedSuitPlannerAI.py

示例10: announceGenerate

	def announceGenerate(self):
		global OneBossCog
		DistributedBossCog.DistributedBossCog.announceGenerate(self)
		self.setName(TTLocalizer.SellbotBossName)
		nameInfo = TTLocalizer.BossCogNameWithDept % {
			'name': self.name, 'dept': SuitDNA.getDeptFullname(self.style.dept)}
		self.setDisplayName(nameInfo)
		self.cageDoorSfx = loader.loadSfx(
			'phase_5/audio/sfx/CHQ_SOS_cage_door.ogg')
		self.cageLandSfx = loader.loadSfx(
			'phase_9/audio/sfx/CHQ_SOS_cage_land.ogg')
		self.cageLowerSfx = loader.loadSfx(
			'phase_5/audio/sfx/CHQ_SOS_cage_lower.ogg')
		self.piesRestockSfx = loader.loadSfx(
			'phase_9/audio/sfx/CHQ_SOS_pies_restock.ogg')
		self.rampSlideSfx = loader.loadSfx(
			'phase_9/audio/sfx/CHQ_VP_ramp_slide.ogg')
		self.strafeSfx = []
		for i in range(10):
			self.strafeSfx.append(
				loader.loadSfx('phase_3.5/audio/sfx/SA_shred.ogg'))

		render.setTag('pieCode', str(ToontownGlobals.PieCodeNotBossCog))
		insidesA = CollisionPolygon(
			Point3(4.0, -2.0, 5.0),
			Point3(-4.0, -2.0, 5.0),
			Point3(-4.0, -2.0, 0.5),
			Point3(4.0, -2.0, 0.5))
		insidesANode = CollisionNode('BossZap')
		insidesANode.addSolid(insidesA)
		insidesANode.setCollideMask(
			ToontownGlobals.PieBitmask | ToontownGlobals.WallBitmask)
		self.insidesANodePath = self.axle.attachNewNode(insidesANode)
		self.insidesANodePath.setTag('pieCode',
									 str(ToontownGlobals.PieCodeBossInsides))
		self.insidesANodePath.stash()
		insidesB = CollisionPolygon(
			Point3(-4.0, 2.0, 5.0),
			Point3(4.0, 2.0, 5.0),
			Point3(4.0, 2.0, 0.5),
			Point3(-4.0, 2.0, 0.5))
		insidesBNode = CollisionNode('BossZap')
		insidesBNode.addSolid(insidesB)
		insidesBNode.setCollideMask(
			ToontownGlobals.PieBitmask | ToontownGlobals.WallBitmask)
		self.insidesBNodePath = self.axle.attachNewNode(insidesBNode)
		self.insidesBNodePath.setTag('pieCode',
									 str(ToontownGlobals.PieCodeBossInsides))
		self.insidesBNodePath.stash()
		target = CollisionTube(0, -1, 4, 0, -1, 9, 3.5)
		targetNode = CollisionNode('BossZap')
		targetNode.addSolid(target)
		targetNode.setCollideMask(ToontownGlobals.PieBitmask)
		self.targetNodePath = self.pelvis.attachNewNode(targetNode)
		self.targetNodePath.setTag(
			'pieCode', str(
				ToontownGlobals.PieCodeBossCog))
		shield = CollisionTube(0, 1, 4, 0, 1, 7, 3.5)
		shieldNode = CollisionNode('BossZap')
		shieldNode.addSolid(shield)
		shieldNode.setCollideMask(
			ToontownGlobals.PieBitmask | ToontownGlobals.CameraBitmask)
		shieldNodePath = self.pelvis.attachNewNode(shieldNode)
		disk = loader.loadModel('phase_9/models/char/bossCog-gearCollide')
		disk.find('**/+CollisionNode').setName('BossZap')
		disk.reparentTo(self.pelvis)
		disk.setZ(0.8)
		self.loadEnvironment()
		self.__makeCagedToon()
		self.__loadMopaths()
		if OneBossCog is not None:
			self.notify.warning('Multiple BossCogs visible.')
		OneBossCog = self
		return
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:74,代码来源:DistributedSellbotBoss.py

示例11: makeIntroductionMovie

	def makeIntroductionMovie(self, delayDeletes):
		track = Parallel()
		camera.reparentTo(render)
		localAvatar.setCameraFov(ToontownGlobals.CogHQCameraFov)
		dooberTrack = Parallel()
		if self.doobers:
			self.__doobersToPromotionPosition(
				self.doobers[:4], self.battleANode)
			self.__doobersToPromotionPosition(
				self.doobers[4:], self.battleBNode)
			turnPosA = ToontownGlobals.SellbotBossDooberTurnPosA
			turnPosB = ToontownGlobals.SellbotBossDooberTurnPosB
			self.__walkDoober(
				self.doobers[0],
				0,
				turnPosA,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[1],
				4,
				turnPosA,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[2],
				8,
				turnPosA,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[3],
				12,
				turnPosA,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[7],
				2,
				turnPosB,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[6],
				6,
				turnPosB,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[5],
				10,
				turnPosB,
				dooberTrack,
				delayDeletes)
			self.__walkDoober(
				self.doobers[4],
				14,
				turnPosB,
				dooberTrack,
				delayDeletes)
		toonTrack = Parallel()
		self.__toonsToPromotionPosition(self.toonsA, self.battleANode)
		self.__toonsToPromotionPosition(self.toonsB, self.battleBNode)
		delay = 0
		for toonId in self.toonsA:
			self.__walkToonToPromotion(
				toonId, delay, self.toonsEnterA, toonTrack, delayDeletes)
			delay += 1

		for toonId in self.toonsB:
			self.__walkToonToPromotion(
				toonId, delay, self.toonsEnterB, toonTrack, delayDeletes)
			delay += 1

		toonTrack.append(Sequence(Wait(delay), self.closeDoors))
		self.rampA.request('extended')
		self.rampB.request('extended')
		self.rampC.request('retracted')
		self.clearChat()
		self.cagedToon.clearChat()
		promoteDoobers = TTLocalizer.BossCogPromoteDoobers % SuitDNA.getDeptFullnameP(
			self.style.dept)
		doobersAway = TTLocalizer.BossCogDoobersAway[self.style.dept]
		welcomeToons = TTLocalizer.BossCogWelcomeToons
		promoteToons = TTLocalizer.BossCogPromoteToons % SuitDNA.getDeptFullnameP(
			self.style.dept)
		discoverToons = TTLocalizer.BossCogDiscoverToons
		attackToons = TTLocalizer.BossCogAttackToons
		interruptBoss = TTLocalizer.CagedToonInterruptBoss
		rescueQuery = TTLocalizer.CagedToonRescueQuery
		bossAnimTrack = Sequence(
			ActorInterval(self, 'Ff_speech', startTime=2, duration=10, loop=1),
			ActorInterval(self, 'ltTurn2Wave', duration=2),
			ActorInterval(self, 'wave', duration=4, loop=1),
			ActorInterval(self, 'ltTurn2Wave', startTime=2, endTime=0),
			ActorInterval(self, 'Ff_speech', duration=7, loop=1))
		track.append(bossAnimTrack)
		dialogTrack = Track(
			(0,
			 Parallel(
#.........这里部分代码省略.........
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:101,代码来源:DistributedSellbotBoss.py

示例12: getStyleDept

 def getStyleDept(self):
     if hasattr(self, 'dna') and self.dna:
         return SuitDNA.getDeptFullname(self.dna.dept)
     else:
         self.notify.error('called getStyleDept() before dna was set!')
         return 'unknown'
开发者ID:ToontownBattlefront,项目名称:Toontown-Battlefront,代码行数:6,代码来源:SuitBase.py

示例13: createNewSuit

    def createNewSuit(
        self,
        blockNumbers,
        streetPoints,
        toonBlockTakeover=None,
        cogdoTakeover=None,
        minPathLen=None,
        maxPathLen=None,
        buildingHeight=None,
        suitLevel=None,
        suitType=None,
        suitTrack=None,
        suitName=None,
        specialSuit=0,
    ):
        startPoint = None
        blockNumber = None
        if self.notify.getDebug():
            self.notify.debug("Choosing origin from %d+%d possibles." % (len(streetPoints), len(blockNumbers)))
        while startPoint == None and len(blockNumbers) > 0:
            bn = random.choice(blockNumbers)
            blockNumbers.remove(bn)
            if self.buildingSideDoors.has_key(bn):
                for doorPoint in self.buildingSideDoors[bn]:
                    points = self.dnaData.suitGraph.getAdjacentPoints(doorPoint)
                    for p in points:
                        startTime = SuitTimings.fromSuitBuilding
                        startTime += self.dnaData.suitGraph.getSuitEdgeTravelTime(doorPoint, p, self.suitWalkSpeed)
                        if not self.pointCollision(p, doorPoint, startTime):
                            startTime = SuitTimings.fromSuitBuilding
                            startPoint = doorPoint
                            blockNumber = bn
                            break

        while startPoint == None and len(streetPoints) > 0:
            p = random.choice(streetPoints)
            streetPoints.remove(p)
            if not self.pointCollision(p, None, SuitTimings.fromSky):
                startPoint = p
                startTime = SuitTimings.fromSky

        if startPoint == None:
            return
        newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, self)
        newSuit.startPoint = startPoint
        if blockNumber != None:
            newSuit.buildingSuit = 1
            if suitTrack == None:
                suitTrack = self.buildingMgr.getBuildingTrack(blockNumber)
        else:
            newSuit.flyInSuit = 1
            newSuit.attemptingTakeover = self.newSuitShouldAttemptTakeover()
            if newSuit.attemptingTakeover:
                if suitTrack == None and len(self.pendingBuildingTracks) > 0:
                    suitTrack = self.pendingBuildingTracks[0]
                    del self.pendingBuildingTracks[0]
                    self.pendingBuildingTracks.append(suitTrack)
                if buildingHeight == None and len(self.pendingBuildingHeights) > 0:
                    buildingHeight = self.pendingBuildingHeights[0]
                    del self.pendingBuildingHeights[0]
                    self.pendingBuildingHeights.append(buildingHeight)
        if suitName == None:
            suitName, specialSuit = self.air.suitInvasionManager.getInvadingCog()
            if suitName == None:
                suitName = self.defaultSuitName
        if suitType == None and suitName != None:
            suitType = SuitDNA.getSuitType(suitName)
            suitTrack = SuitDNA.getSuitDept(suitName)
        if suitLevel == None and buildingHeight != None:
            suitLevel = self.chooseSuitLevel(
                self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL], buildingHeight
            )
        suitLevel, suitType, suitTrack = self.pickLevelTypeAndTrack(suitLevel, suitType, suitTrack)
        newSuit.setupSuitDNA(suitLevel, suitType, suitTrack)
        newSuit.buildingHeight = buildingHeight
        gotDestination = self.chooseDestination(
            newSuit,
            startTime,
            toonBlockTakeover=toonBlockTakeover,
            cogdoTakeover=cogdoTakeover,
            minPathLen=minPathLen,
            maxPathLen=maxPathLen,
        )
        if not gotDestination:
            self.notify.debug("Couldn't get a destination in %d!" % self.zoneId)
            newSuit.doNotDeallocateChannel = None
            newSuit.delete()
            return
        newSuit.initializePath()
        self.zoneChange(newSuit, None, newSuit.zoneId)
        # Determine if we are spawning a special type of suit. 1 is Skelecog, 2 is v2.0.
        if specialSuit == 1:
            newSuit.setSkelecog(1)
        elif specialSuit == 2:
            newSuit.setSkeleRevives(1)
        newSuit.generateWithRequired(newSuit.zoneId)
        newSuit.moveToNextLeg(None)
        self.suitList.append(newSuit)
        if newSuit.flyInSuit:
            self.numFlyInSuits += 1
#.........这里部分代码省略.........
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:101,代码来源:DistributedSuitPlannerAI.py


注:本文中的SuitDNA类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。