Пример #1
0
 def _DistributedCrate__startStickTask(self, crateNormal, toonPos):
     self._DistributedCrate__killStickTask()
     self.stuckToCrate = 1
     sTask = Task(self._DistributedCrate__stickTask)
     sTask.crateNormal = crateNormal
     sTask.toonPos = toonPos
     taskMgr.add(sTask, self.taskName('stickTask'))
 def startCountdown(self):
     if not self.timerTask and self.startingBlocks:
         self.makeClockGui()
         duration = KartGlobals.COUNTDOWN_TIME - globalClockDelta.localElapsedTime(self.getTimestamp())
         countdownTask = Task(self.updateTimerTask)
         countdownTask.duration = duration
         self.timerTask = taskMgr.add(countdownTask, self.uniqueName('racePadTimerTask'))
Пример #3
0
 def __spawnTask(self):
     # Spawn task
     self.__removeTask()
     taskName = self.getName() + '-play'
     task = Task(self.__playTask)
     task.interval = self
     taskMgr.add(task, taskName)
Пример #4
0
 def updateHealthBar(self, hp, forceUpdate = 0):
     if hp > self.currHP:
         hp = self.currHP
     self.currHP -= hp
     health = float(self.currHP) / float(self.maxHP)
     if health > 0.95:
         condition = 0
     elif health > 0.7:
         condition = 1
     elif health > 0.3:
         condition = 2
     elif health > 0.05:
         condition = 3
     elif health > 0.0:
         condition = 4
     else:
         condition = 5
     if self.healthCondition != condition or forceUpdate:
         if condition == 4:
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.uniqueName('blink-task'))
         elif condition == 5:
             if self.healthCondition == 4:
                 taskMgr.remove(self.uniqueName('blink-task'))
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.uniqueName('blink-task'))
         else:
             self.healthBar.setColor(self.healthColors[condition], 1)
             self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
         self.healthCondition = condition
Пример #5
0
    def __fireCannonTask(self, task):
        launchTime = task.fireTime
        avId = task.avId
        if self.toonHead == None or not self.boss.state == 'BattleTwo':
            return Task.done
        flightResults = self.__calcFlightResults(avId, launchTime)
        if not isClient():
            print 'EXECWARNING DistributedLawbotCannon: %s' % flightResults
            printStack()
        for key in flightResults:
            exec "%s = flightResults['%s']" % (key, key)

        self.notify.debug('start position: ' + str(startPos))
        self.notify.debug('start velocity: ' + str(startVel))
        self.notify.debug('time of launch: ' + str(launchTime))
        self.notify.debug('time of impact: ' + str(timeOfImpact))
        self.notify.debug('location of impact: ' + str(trajectory.getPos(timeOfImpact)))
        head = self.toonHead
        head.stopBlink()
        head.stopLookAroundNow()
        head.reparentTo(hidden)
        juror = self.toonModel
        juror.reparentTo(render)
        juror.setPos(startPos)
        barrelHpr = self.barrel.getHpr(render)
        juror.setHpr(startHpr)
        self.jurorToon.loop('swim')
        self.jurorToon.setPosHpr(0, 0, -(self.jurorToon.getHeight() / 2.0), 0, 0, 0)
        info = {}
        info['avId'] = avId
        info['trajectory'] = trajectory
        info['launchTime'] = launchTime
        info['timeOfImpact'] = timeOfImpact
        info['hitWhat'] = hitWhat
        info['toon'] = self.toonModel
        info['hRot'] = self.cannonPosition[0]
        info['haveWhistled'] = 0
        info['maxCamPullback'] = CAMERA_PULLBACK_MIN
        if self.localToonShooting:
            camera.reparentTo(juror)
            camera.setP(45.0)
            camera.setZ(-10.0)
        self.flyColSphere = CollisionSphere(0, 0, self.av.getHeight() / 2.0, 1.0)
        self.flyColNode = CollisionNode(self.uniqueName('flySphere'))
        self.flyColNode.setCollideMask(ToontownGlobals.WallBitmask | ToontownGlobals.FloorBitmask | ToontownGlobals.PieBitmask)
        self.flyColNode.addSolid(self.flyColSphere)
        self.flyColNodePath = self.jurorToon.attachNewNode(self.flyColNode)
        self.flyColNodePath.setColor(1, 0, 0, 1)
        self.handler = CollisionHandlerEvent()
        self.handler.setInPattern(self.uniqueName('cannonHit'))
        base.cTrav.addCollider(self.flyColNodePath, self.handler)
        self.accept(self.uniqueName('cannonHit'), self.__handleCannonHit)
        shootTask = Task(self.__shootTask, self.taskName('shootTask'))
        flyTask = Task(self.__flyTask, self.taskName('flyTask'))
        shootTask.info = info
        flyTask.info = info
        seqTask = Task.sequence(shootTask, flyTask)
        taskMgr.add(seqTask, self.taskName('flyingToon') + '-' + str(avId))
        self.acceptOnce(self.uniqueName('stopFlyTask'), self.__stopFlyTask)
        return Task.done
 def fakeDownload(self, timePerPhase):
     self.phaseComplete = {
         1: 100,
         2: 100,
         3: 0,
         3.5: 0,
         4: 0,
         5: 0,
         5.5: 0,
         6: 0,
         7: 0,
         8: 0,
         9: 0,
         10: 0,
         11: 0,
         12: 0,
         13: 0 }
     phaseTaskList = []
     firstPhaseIndex = self.LauncherPhases.index(self.firstPhase)
     for phase in self.LauncherPhases[firstPhaseIndex:]:
         phaseTask = Task(self.fakeDownloadPhaseTask, 'phaseDownload' + str(phase))
         phaseTask.timePerPhase = timePerPhase
         phaseTask.phase = phase
         phaseTaskList.append(phaseTask)
     
     phaseTaskList.append(Task(self.downloadDoneTask))
     downloadSequence = Task.sequence(*phaseTaskList)
     taskMgr.remove('downloadSequence')
     taskMgr.add(downloadSequence, 'downloadSequence')
Пример #7
0
 def updateHealthBar(self):
     if self.healthBar == None:
         return
     health = 1.0 - float(self.bossDamage) / float(self.bossMaxDamage)
     if health > 0.95:
         condition = 0
     elif health > 0.7:
         condition = 1
     elif health > 0.3:
         condition = 2
     elif health > 0.05:
         condition = 3
     elif health > 0.0:
         condition = 4
     else:
         condition = 5
     if self.healthCondition != condition:
         if condition == 4:
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.uniqueName('blink-task'))
         elif condition == 5:
             if self.healthCondition == 4:
                 taskMgr.remove(self.uniqueName('blink-task'))
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.uniqueName('blink-task'))
         else:
             self.healthBar.setColor(self.healthColors[condition], 1)
             self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
         self.healthCondition = condition
     return
 def setCannonWillFire(self, avId, fireTime, zRot, angle):
     if not self.hasLocalToon:
         return
     if not self.__playing():
         return
     self.notify.debug(
         "setCannonWillFire: "
         + str(avId)
         + ": zRot="
         + str(zRot)
         + ", angle="
         + str(angle)
         + ", time="
         + str(fireTime)
     )
     self.cannonPositionDict[avId][0] = zRot
     self.cannonPositionDict[avId][1] = angle
     self.__updateCannonPosition(avId)
     task = Task(self.__fireCannonTask)
     task.avId = avId
     task.fireTime = fireTime
     timeToWait = task.fireTime - self.getCurrentGameTime()
     if timeToWait > 0.0:
         fireTask = Task.sequence(Task.pause(timeToWait), task)
     else:
         fireTask = task
     fireTask = task
     taskMgr.add(fireTask, "fireCannon" + str(avId))
     self.airborneToons += 1
 def __startStickTask(self, crateNormal, toonPos):
     self.__killStickTask()
     self.stuckToCrate = 1
     sTask = Task(self.__stickTask)
     sTask.crateNormal = crateNormal
     sTask.toonPos = toonPos
     taskMgr.add(sTask, self.taskName("stickTask"))
Пример #10
0
 def doSpawnTitleText(self, text):
     self.titleText.setText(text)
     self.titleText.show()
     self.titleText.setColor(Vec4(*self.titleColor))
     self.titleText.clearColorScale()
     self.titleText.setFg(self.titleColor)
     seq = Task.sequence(Task.pause(0.1), Task.pause(6.0), self.titleText.lerpColorScale(Vec4(1.0, 1.0, 1.0, 1.0), Vec4(1.0, 1.0, 1.0, 0.0), 0.5), Task(self.hideTitleTextTask))
     taskMgr.add(seq, 'titleText')
Пример #11
0
 def __upButtonDown(self, event):
     messenger.send('wakeup')
     task = Task(self.__runCounter)
     task.delayTime = 0.4
     task.prevTime = 0.0
     task.delta = 1
     hitLimit, laff, trans = self.__updateLaffMeter(task.delta)
     if not hitLimit:
         taskMgr.add(task, self.taskName('runCounter'))
    def __fireCannonTask(self, task):
        launchTime = task.fireTime
        avId = task.avId
        if self.toonHead == None or not self.boss.state == "BattleTwo":
            return Task.done
        startPos, startHpr, startVel, trajectory, timeOfImpact, hitWhat = self.__calcFlightResults(avId, launchTime)

        self.notify.debug("start position: " + str(startPos))
        self.notify.debug("start velocity: " + str(startVel))
        self.notify.debug("time of launch: " + str(launchTime))
        self.notify.debug("time of impact: " + str(timeOfImpact))
        self.notify.debug("location of impact: " + str(trajectory.getPos(timeOfImpact)))
        head = self.toonHead
        head.stopBlink()
        head.stopLookAroundNow()
        head.reparentTo(hidden)
        juror = self.toonModel
        juror.reparentTo(render)
        juror.setPos(startPos)
        barrelHpr = self.barrel.getHpr(render)
        juror.setHpr(startHpr)
        self.jurorToon.loop("swim")
        self.jurorToon.setPosHpr(0, 0, -(self.jurorToon.getHeight() / 2.0), 0, 0, 0)
        info = {}
        info["avId"] = avId
        info["trajectory"] = trajectory
        info["launchTime"] = launchTime
        info["timeOfImpact"] = timeOfImpact
        info["hitWhat"] = hitWhat
        info["toon"] = self.toonModel
        info["hRot"] = self.cannonPosition[0]
        info["haveWhistled"] = 0
        info["maxCamPullback"] = CAMERA_PULLBACK_MIN
        if self.localToonShooting:
            camera.reparentTo(juror)
            camera.setP(45.0)
            camera.setZ(-10.0)
        self.flyColSphere = CollisionSphere(0, 0, self.av.getHeight() / 2.0, 1.0)
        self.flyColNode = CollisionNode(self.uniqueName("flySphere"))
        self.flyColNode.setCollideMask(
            ToontownGlobals.WallBitmask | ToontownGlobals.FloorBitmask | ToontownGlobals.PieBitmask
        )
        self.flyColNode.addSolid(self.flyColSphere)
        self.flyColNodePath = self.jurorToon.attachNewNode(self.flyColNode)
        self.flyColNodePath.setColor(1, 0, 0, 1)
        self.handler = CollisionHandlerEvent()
        self.handler.setInPattern(self.uniqueName("cannonHit"))
        base.cTrav.addCollider(self.flyColNodePath, self.handler)
        self.accept(self.uniqueName("cannonHit"), self.__handleCannonHit)
        shootTask = Task(self.__shootTask, self.taskName("shootTask"))
        flyTask = Task(self.__flyTask, self.taskName("flyTask"))
        shootTask.info = info
        flyTask.info = info
        seqTask = Task.sequence(shootTask, flyTask)
        taskMgr.add(seqTask, self.taskName("flyingToon") + "-" + str(avId))
        self.acceptOnce(self.uniqueName("stopFlyTask"), self.__stopFlyTask)
        return Task.done
Пример #13
0
 def __withdrawButtonDown(self, event):
     messenger.send('wakeup')
     task = Task(self.__runCounter)
     task.delayTime = 0.4
     task.prevTime = 0.0
     task.delta = -1
     hitLimit, jar, bank, trans = self.__updateTransaction(task.delta)
     if not hitLimit:
         taskMgr.add(task, self.taskName('runCounter'))
Пример #14
0
 def __spawnLocalCannonMoveTask(self):
     self.leftPressed = 0
     self.rightPressed = 0
     self.upPressed = 0
     self.downPressed = 0
     self.cannonMoving = 0
     task = Task(self.__localCannonMoveTask)
     task.lastPositionBroadcastTime = 0.0
     taskMgr.add(task, self.LOCAL_CANNON_MOVE_TASK)
Пример #15
0
    def __withdrawButtonDown(self, event):
        messenger.send('wakeup')

        task = Task(self.__runCounter)
        task.delayTime = 0.2
        task.prevTime = 0.0
        task.amount = -1.0
        hitLimit = self.__updateTransaction(int(task.amount))[0]
        if not hitLimit:
            taskMgr.add(task, self.taskName('runCounter'))
 def doSpawnTitleText(self, text):
     self.titleColor = (1.0, 0.5, 0.4, 1.0)
     self.titleText = OnscreenText.OnscreenText(text, fg=self.titleColor, font=ToontownGlobals.getSignFont(), pos=(0, -0.5), scale=0.16, drawOrder=0, mayChange=1, wordwrap=16)
     self.titleText.setText(text)
     self.titleText.show()
     self.titleText.setColor(Vec4(*self.titleColor))
     self.titleText.clearColorScale()
     self.titleText.setFg(self.titleColor)
     seq = Task.sequence(Task.pause(0.1), Task.pause(6.0), self.titleText.lerpColorScale(Vec4(1.0, 1.0, 1.0, 1.0), Vec4(1.0, 1.0, 1.0, 0.0), 0.5), Task(self.hideTitleTextTask))
     taskMgr.add(seq, 'titleText')
    def __taskUpdate(self, delta, event):
        messenger.send('wakeup')

        task = Task(self.__runTask)
        task.delayTime = 0.4
        task.prevTime = 0.0
        task.delta = delta
        hitLimit = self.__updateIndex(delta)

        if not hitLimit:
            taskMgr.add(task, 'runGloveCounter-%s' % self.id)
Пример #18
0
    def __taskUpdate(self, delta, event):
        messenger.send('wakeup')

        task = Task(self.__runTask)
        task.delayTime = 0.4
        task.prevTime = 0.0
        task.delta = delta
        hitLimit = self.__updateLaffMeter(delta)

        if not hitLimit:
            taskMgr.add(task, self.taskName('runLaffCounter'))
Пример #19
0
 def showWaitToStartCountdown(self, duration, waitToStartTimestamp, almostDoneCallback = None):
     self._countdownAlmostDoneCallback = almostDoneCallback
     currentTime = globalClock.getRealTime()
     waitTimeElapsed = currentTime - waitToStartTimestamp
     if duration - waitTimeElapsed > 1.0:
         countdownTask = Task(self._updateCountdownTask)
         countdownTask.duration = duration - waitTimeElapsed
         self.countdownText.setText(str(int(countdownTask.duration)))
         self.countdownText.show()
         taskMgr.remove(TeamActivityGui.COUNTDOWN_TASK_NAME)
         taskMgr.add(countdownTask, TeamActivityGui.COUNTDOWN_TASK_NAME)
Пример #20
0
 def __decButtonDown(self, event):
     assert self.notify.debugStateCall(self)
     task = Task(self.__scrollByTask)
     task.delayTime = (1.0 / self.scrollSpeed)
     task.prevTime = 0.0
     task.delta = -1
     taskName = self.taskName("scroll")
     #print "decButtonDown: adding ", taskName
     taskMgr.add(task, taskName)
     self.scrollBy(task.delta)
     messenger.send('wakeup')
Пример #21
0
 def __decButtonDown(self, event):
     task = Task(self.__scrollByTask)
     task.setDelay(1.0 / self.scrollSpeed)
     task.prevTime = 0.0
     task.delta = -1
     taskName = self.taskName('scroll')
     taskMgr.add(task, taskName)
     self.scrollBy(task.delta)
     messenger.send('wakeup')
     if self.decButtonCallback:
         self.decButtonCallback()
 def _DistributedCannonGame__fireCannonTask(self, task):
     launchTime = task.fireTime
     avId = task.avId
     self.notify.debug('FIRING CANNON FOR AVATAR ' + str(avId))
     flightResults = self._DistributedCannonGame__calcFlightResults(avId, launchTime)
     if not isClient():
         print 'EXECWARNING DistributedCannonGame: %s' % flightResults
         printStack()
     
     for key in flightResults:
         exec "%s = flightResults['%s']" % (key, key)
     
     self.notify.debug('start position: ' + str(startPos))
     self.notify.debug('start velocity: ' + str(startVel))
     self.notify.debug('time of launch: ' + str(launchTime))
     self.notify.debug('time of impact: ' + str(timeOfImpact))
     self.notify.debug('location of impact: ' + str(trajectory.getPos(timeOfImpact)))
     if hitWhat == self.HIT_WATER:
         self.notify.debug('toon will land in the water')
     elif hitWhat == self.HIT_TOWER:
         self.notify.debug('toon will hit the tower')
     else:
         self.notify.debug('toon will hit the ground')
     head = self.toonHeadDict[avId]
     head.stopBlink()
     head.stopLookAroundNow()
     head.reparentTo(hidden)
     av = self.toonModelDict[avId]
     av.reparentTo(render)
     av.setPos(startPos)
     av.setHpr(startHpr)
     avatar = self.getAvatar(avId)
     avatar.loop('swim')
     avatar.setPosHpr(0, 0, -(avatar.getHeight() / 2.0), 0, 0, 0)
     shootTask = Task(self._DistributedCannonGame__shootTask)
     flyTask = Task(self._DistributedCannonGame__flyTask)
     seqDoneTask = Task(self._DistributedCannonGame__flySequenceDoneTask)
     info = { }
     info['avId'] = avId
     info['trajectory'] = trajectory
     info['launchTime'] = launchTime
     info['timeOfImpact'] = timeOfImpact
     info['hitWhat'] = hitWhat
     info['toon'] = self.toonModelDict[avId]
     info['hRot'] = self.cannonPositionDict[avId][0]
     info['haveWhistled'] = 0
     info['maxCamPullback'] = CAMERA_PULLBACK_MIN
     (info['timeEnterTowerXY'], info['timeExitTowerXY']) = trajectory.calcEnterAndLeaveCylinderXY(self.tower.getPos(render), TOWER_RADIUS)
     shootTask.info = info
     flyTask.info = info
     seqDoneTask.info = info
     seqTask = Task.sequence(shootTask, flyTask, Task.pause(LAND_TIME), seqDoneTask)
     taskMgr.add(seqTask, 'flyingToon' + str(avId))
     if avId == self.localAvId:
         if info['hitWhat'] == self.HIT_WATER:
             self.sendUpdate('setToonWillLandInWater', [
                 info['timeOfImpact']])
         
     
     return Task.done
Пример #23
0
 def setCannonWillFire(self, avId, fireTime, zRot, angle, timestamp):
     self.notify.debug('setCannonWillFire: ' + str(avId) + ': zRot=' + str(zRot) + ', angle=' + str(angle) + ', time=' + str(fireTime))
     if not self.model_Created:
         self.notify.warning("We walked into the zone mid-flight, so we won't see it")
         return
     self.cannonPosition[0] = zRot
     self.cannonPosition[1] = angle
     self.__updateCannonPosition(avId)
     task = Task(self.__fireCannonTask)
     task.avId = avId
     ts = globalClockDelta.localElapsedTime(timestamp)
     task.fireTime = fireTime - ts
     if task.fireTime < 0.0:
         task.fireTime = 0.0
     taskMgr.add(task, self.taskName('fireCannon'))
 def showScoreText(self, number, scale = 1.25):
     if not number == 0:
         if self.scoreText:
             self.hideScoreText()
         self.ScoreTextGenerator.setFont(OTPGlobals.getSignFont())
         if number < 0:
             self.ScoreTextGenerator.setText(str(number))
         else:
             self.ScoreTextGenerator.setText('+' + str(number))
         self.ScoreTextGenerator.clearShadow()
         self.ScoreTextGenerator.setAlign(TextNode.ACenter)
         if number < 0:
             r, g, b, a = (0.9, 0, 0, 1)
         else:
             r, g, b, a = (0.9, 0.9, 0, 1)
         self.scoreTextNode = self.ScoreTextGenerator.generate()
         self.scoreText = self.toon.attachNewNode(self.scoreTextNode)
         self.scoreText.setScale(scale)
         self.scoreText.setBillboardPointEye()
         self.scoreText.setBin('fixed', 100)
         self.scoreText.setPos(0, 0, self.toon.height / 2)
         self.scoreText.setTransparency(1)
         self.scoreText.setColor(r, g, b, a)
         self.scoreText.setDepthTest(0)
         self.scoreText.setDepthWrite(0)
         seq = Task.sequence(self.scoreText.lerpPos(Point3(0, 0, self.toon.height + 2), 0.5, blendType='easeOut'), self.scoreText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.25), Task(self.hideScoreTextTask))
         taskMgr.add(seq, self.game.uniqueName('scoreText'))
Пример #25
0
    def update(self, hp, forceUpdate = 0):
        if not self.geom:
            return
        condition = self.getHealthCondition(hp)

        if self.healthCondition != condition or forceUpdate:
            taskMgr.remove('blink-task-%s' % id(self))

            if condition in (9, 10):
                blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75 if condition == 9 else 0.25), Task(self.__blinkGray), Task.pause(0.1))
                taskMgr.add(blinkTask, 'blink-task-%s' % id(self))
            else:
                self.geom.setColor(HEALTH_COLORS[condition], 1)
                self.geomGlow.setColor(HEALTH_GLOW_COLORS[condition], 1)
    
            self.healthCondition = condition
Пример #26
0
 def updateHealthBar(self):
     if not self.suit:
         return
     self.setHp(self.suit.getHP())
     health = float(self.currHP) / float(self.maxHP)
     if health > 0.95:
         condition = 0
     elif health > 0.9:
         condition = 1
     elif health > 0.8:
         condition = 2
     elif health > 0.7:
         condition = 3#Yellow
     elif health > 0.6:
         condition = 4            
     elif health > 0.5:
         condition = 5           
     elif health > 0.3:
         condition = 6#Orange
     elif health > 0.15:
         condition = 7
     elif health > 0.05:
         condition = 8#Red           
     elif health > 0.0:
         condition = 9#Blinking Red
     else:
         condition = 10
     if self.healthCondition != condition:
         if condition == 9:
             self.blinkTask = self.uniqueName('blink-task')                
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.blinkTask)
         elif condition == 10:
             if self.healthCondition == 9:
                 self.blinkTask = self.uniqueName('blink-task')    
                 taskMgr.remove(self.blinkTask)
                 self.blinkTask = None
             blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1))
             taskMgr.add(blinkTask, self.blinkTask)
         else:
             if self.blinkTask:
                 taskMgr.remove(self.blinkTask)
                 self.blinkTask = None
             self.healthBar.setColor(self.healthColors[condition], 1)
             self.healthBarGlow.setColor(self.healthGlowColors[condition], 1)
         self.healthCondition = condition
 def _DistributedCannonGame__startIntro(self):
     self.T_WATER = 1
     self.T_WATER2LONGVIEW = 1
     self.T_LONGVIEW = 1
     self.T_LONGVIEW2TOONHEAD = 2
     self.T_TOONHEAD = 2
     self.T_TOONHEAD2CANNONBACK = 2
     taskLookInWater = Task(self._DistributedCannonGame__taskLookInWater)
     taskPullBackFromWater = Task(self._DistributedCannonGame__taskPullBackFromWater)
     taskFlyUpToToon = Task(self._DistributedCannonGame__flyUpToToon)
     taskFlyToBackOfCannon = Task(self._DistributedCannonGame__flyToBackOfCannon)
     commonData = { }
     taskLookInWater.data = commonData
     taskPullBackFromWater.data = commonData
     taskFlyUpToToon.data = commonData
     taskFlyToBackOfCannon.data = commonData
     introTask = Task.sequence(taskLookInWater, Task.pause(self.T_WATER), taskPullBackFromWater, Task.pause(self.T_WATER2LONGVIEW + self.T_LONGVIEW), taskFlyUpToToon, Task.pause(self.T_LONGVIEW2TOONHEAD + self.T_TOONHEAD), taskFlyToBackOfCannon)
     taskMgr.add(introTask, self.INTRO_TASK_NAME)
def startCloudSky(hood, parent = camera, effects = CompassEffect.PRot | CompassEffect.PZ):
    hood.sky.reparentTo(parent)
    hood.sky.setDepthTest(0)
    hood.sky.setDepthWrite(0)
    hood.sky.setBin('background', 100)
    hood.sky.find('**/Sky').reparentTo(hood.sky, -1)
    hood.sky.reparentTo(parent)
    hood.sky.setZ(0.0)
    hood.sky.setHpr(0.0, 0.0, 0.0)
    ce = CompassEffect.make(NodePath(), effects)
    hood.sky.node().setEffect(ce)
    skyTrackTask = Task(hood.skyTrack)
    skyTrackTask.h = 0
    skyTrackTask.cloud1 = hood.sky.find('**/cloud1')
    skyTrackTask.cloud2 = hood.sky.find('**/cloud2')
    if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty():
        taskMgr.add(skyTrackTask, 'skyTrack')
    else:
        notify.warning("Couln't find clouds!")
    def __fireCannonTask(self, task):
        launchTime = task.fireTime
        avId = task.avId
        self.notify.debug("FIRING CANNON FOR AVATAR " + str(avId))
        startPos, startHpr, startVel, trajectory, timeOfImpact, hitWhat = self.__calcFlightResults(avId, launchTime)

        self.notify.debug("start position: " + str(startPos))
        self.notify.debug("start velocity: " + str(startVel))
        self.notify.debug("time of launch: " + str(launchTime))
        self.notify.debug("time of impact: " + str(timeOfImpact))
        self.notify.debug("location of impact: " + str(trajectory.getPos(timeOfImpact)))
        if hitWhat == self.HIT_WATER:
            self.notify.debug("toon will land in the water")
        elif hitWhat == self.HIT_TOWER:
            self.notify.debug("toon will hit the tower")
        else:
            self.notify.debug("toon will hit the ground")
        head = self.toonHeadDict[avId]
        head.stopBlink()
        head.stopLookAroundNow()
        head.reparentTo(hidden)
        av = self.toonModelDict[avId]
        av.reparentTo(render)
        av.setPos(startPos)
        av.setHpr(startHpr)
        avatar = self.getAvatar(avId)
        avatar.loop("swim")
        avatar.setPosHpr(0, 0, -(avatar.getHeight() / 2.0), 0, 0, 0)
        shootTask = Task(self.__shootTask)
        flyTask = Task(self.__flyTask)
        seqDoneTask = Task(self.__flySequenceDoneTask)
        info = {}
        info["avId"] = avId
        info["trajectory"] = trajectory
        info["launchTime"] = launchTime
        info["timeOfImpact"] = timeOfImpact
        info["hitWhat"] = hitWhat
        info["toon"] = self.toonModelDict[avId]
        info["hRot"] = self.cannonPositionDict[avId][0]
        info["haveWhistled"] = 0
        info["maxCamPullback"] = CAMERA_PULLBACK_MIN
        info["timeEnterTowerXY"], info["timeExitTowerXY"] = trajectory.calcEnterAndLeaveCylinderXY(
            self.tower.getPos(render), TOWER_RADIUS
        )
        shootTask.info = info
        flyTask.info = info
        seqDoneTask.info = info
        seqTask = Task.sequence(shootTask, flyTask, Task.pause(LAND_TIME), seqDoneTask)
        taskMgr.add(seqTask, "flyingToon" + str(avId))
        if avId == self.localAvId:
            if info["hitWhat"] == self.HIT_WATER:
                self.sendUpdate("setToonWillLandInWater", [info["timeOfImpact"]])
        return Task.done
 def setCannonWillFire(self, cannonId, zRot, angle):
     self.notify.debug('setCannonWillFire: %d %d %d' % (cannonId, zRot, angle))
     cannon = base.cr.doId2do.get(cannonId)
     if cannon is None:
         self.notify.warning("Cannon has not been created, but we got this message. Don't show firing.")
         return
     if not cannon.getToonInside():
         self.notify.warning("setCannonWillFire, but no toon insde. Don't show firing")
         return
     if self.isLocalToon(cannon.getToonInside()):
         self.localFlyingToon = base.localAvatar
         self.localFlyingToonId = base.localAvatar.doId
         self.localFiringCannon = cannon
         self.flyingToonCloudsHit = 0
     cannon.updateModel(zRot, angle)
     toonId = cannon.getToonInside().doId
     task = Task(self.__fireCannonTask)
     task.toonId = toonId
     task.cannon = cannon
     taskMgr.add(task, self.taskNameFireCannon)
     self.toonIds.append(toonId)
 def _DistributedCannon__fireCannonTask(self, task):
     launchTime = task.fireTime
     avId = task.avId
     self.inWater = 0
     if not self.toonHead:
         return Task.done
     
     flightResults = self._DistributedCannon__calcFlightResults(avId, launchTime)
     for key in flightResults:
         exec "%s = flightResults['%s']" % (key, key)
     
     self.notify.debug('start position: ' + str(startPos))
     self.notify.debug('start velocity: ' + str(startVel))
     self.notify.debug('time of launch: ' + str(launchTime))
     self.notify.debug('time of impact: ' + str(timeOfImpact))
     self.notify.debug('location of impact: ' + str(trajectory.getPos(timeOfImpact)))
     if hitWhat == self.HIT_WATER:
         self.notify.debug('toon will land in the water')
     elif hitWhat == self.HIT_TOWER:
         self.notify.debug('toon will hit the tower')
     else:
         self.notify.debug('toon will hit the ground')
     head = self.toonHead
     head.stopBlink()
     head.stopLookAroundNow()
     head.reparentTo(hidden)
     av = self.toonModel
     av.reparentTo(render)
     print 'start Pos%s Hpr%s' % (startPos, startHpr)
     av.setPos(startPos)
     barrelHpr = self.barrel.getHpr(render)
     place = base.cr.playGame.getPlace()
     if self.av == base.localAvatar:
         place.fsm.request('stopped')
     
     av.setHpr(startHpr)
     avatar = self.av
     avatar.loop('swim')
     avatar.setPosHpr(0, 0, -(avatar.getHeight() / 2.0), 0, 0, 0)
     info = { }
     info['avId'] = avId
     info['trajectory'] = trajectory
     info['launchTime'] = launchTime
     info['timeOfImpact'] = timeOfImpact
     info['hitWhat'] = hitWhat
     info['toon'] = self.toonModel
     info['hRot'] = self.cannonPosition[0]
     info['haveWhistled'] = 0
     info['maxCamPullback'] = CAMERA_PULLBACK_MIN
     if self.localToonShooting:
         camera.reparentTo(self.av)
         camera.setP(45.0)
         camera.setZ(-10.0)
     
     self.flyColSphere = CollisionSphere(0, 0, self.av.getHeight() / 2.0, 1.0)
     self.flyColNode = CollisionNode(self.uniqueName('flySphere'))
     self.flyColNode.setCollideMask(ToontownGlobals.WallBitmask | ToontownGlobals.FloorBitmask)
     self.flyColNode.addSolid(self.flyColSphere)
     self.flyColNodePath = self.av.attachNewNode(self.flyColNode)
     self.flyColNodePath.setColor(1, 0, 0, 1)
     self.handler = CollisionHandlerEvent()
     self.handler.setInPattern(self.uniqueName('cannonHit'))
     base.cTrav.addCollider(self.flyColNodePath, self.handler)
     self.accept(self.uniqueName('cannonHit'), self._DistributedCannon__handleCannonHit)
     shootTask = Task(self._DistributedCannon__shootTask, self.taskNameShoot)
     smokeTask = Task(self._DistributedCannon__smokeTask, self.taskNameSm
 def _TrunkGUI__rotateLDown(self, event):
     messenger.send('wakeup')
     task = Task(self.rotateToonL)
     taskMgr.add(task, self.taskName('rotateL'))
Пример #33
0
 def _Interval__spawnTask(self):
     self._Interval__removeTask()
     taskName = self.getName() + '-play'
     task = Task(self._Interval__playTask)
     task.interval = self
     taskMgr.add(task, taskName)
Пример #34
0
    def __fireCannonTask(self, task):
        launchTime = task.fireTime
        avId = task.avId
        if self.toonHead == None or not self.boss.state == 'BattleTwo':
            return Task.done
        else:
            flightResults = self.__calcFlightResults(avId, launchTime)
            if config.GetBool('isclient-check', False):
                if not isClient():
                    print 'EXECWARNING DistributedLawbotCannon: %s' % flightResults
                    printStack()
            for key in flightResults:
                exec "%s = flightResults['%s']" % (key, key)

            self.notify.debug('start position: ' + str(startPos))
            self.notify.debug('start velocity: ' + str(startVel))
            self.notify.debug('time of launch: ' + str(launchTime))
            self.notify.debug('time of impact: ' + str(timeOfImpact))
            self.notify.debug('location of impact: ' +
                              str(trajectory.getPos(timeOfImpact)))
            head = self.toonHead
            head.stopBlink()
            head.stopLookAroundNow()
            head.reparentTo(hidden)
            juror = self.toonModel
            juror.reparentTo(render)
            juror.setPos(startPos)
            barrelHpr = self.barrel.getHpr(render)
            juror.setHpr(startHpr)
            self.jurorToon.loop('swim')
            self.jurorToon.setPosHpr(0, 0, -(self.jurorToon.getHeight() / 2.0),
                                     0, 0, 0)
            info = {}
            info['avId'] = avId
            info['trajectory'] = trajectory
            info['launchTime'] = launchTime
            info['timeOfImpact'] = timeOfImpact
            info['hitWhat'] = hitWhat
            info['toon'] = self.toonModel
            info['hRot'] = self.cannonPosition[0]
            info['haveWhistled'] = 0
            info['maxCamPullback'] = CAMERA_PULLBACK_MIN
            if self.localToonShooting:
                camera.reparentTo(juror)
                camera.setP(45.0)
                camera.setZ(-10.0)
            self.flyColSphere = CollisionSphere(0, 0,
                                                self.av.getHeight() / 2.0, 1.0)
            self.flyColNode = CollisionNode(self.uniqueName('flySphere'))
            self.flyColNode.setCollideMask(ToontownGlobals.WallBitmask
                                           | ToontownGlobals.FloorBitmask
                                           | ToontownGlobals.PieBitmask)
            self.flyColNode.addSolid(self.flyColSphere)
            self.flyColNodePath = self.jurorToon.attachNewNode(self.flyColNode)
            self.flyColNodePath.setColor(1, 0, 0, 1)
            self.handler = CollisionHandlerEvent()
            self.handler.setInPattern(self.uniqueName('cannonHit'))
            base.cTrav.addCollider(self.flyColNodePath, self.handler)
            self.accept(self.uniqueName('cannonHit'), self.__handleCannonHit)
            shootTask = Task(self.__shootTask, self.taskName('shootTask'))
            flyTask = Task(self.__flyTask, self.taskName('flyTask'))
            shootTask.info = info
            flyTask.info = info
            seqTask = Task.sequence(shootTask, flyTask)
            taskMgr.add(seqTask, self.taskName('flyingToon') + '-' + str(avId))
            self.acceptOnce(self.uniqueName('stopFlyTask'), self.__stopFlyTask)
            return Task.done
    def showChanceRewards(self):
        tasks = []
        for reward in self.rewardList:
            self.notify.debug('showChanceRewards: reward = ' + str(reward))
            index = self.rewardList.index(reward)
            if reward != -1:
                self.notify.debug('adding tasks!')
                hcc = Task(self.hideChanceMarker)
                hcc.chanceMarkers = self.chanceMarkers
                hcc.index = index
                sct = Task(self.showChanceCard)
                sct.chanceCard = self.chanceCard
                sct.cardSound = self.cardSound
                stt = Task(self.showChanceCardText)
                rewardEntry = RaceGameGlobals.ChanceRewards[reward]
                stt.rewardIdx = reward
                if rewardEntry[0][0] < 0 or rewardEntry[0][1] > 0:
                    stt.sound = self.negBuzzer
                else:
                    stt.sound = self.posBuzzer
                stt.picker = self.avIdList[index]
                rct = Task(self.resetChanceCard)
                task = Task.sequence(hcc, sct, Task.pause(1.0), stt, Task.pause(3.0), rct, Task.pause(0.25))
                tasks.append(task)

        return tasks
Пример #36
0
 def countdown(self, duration):
     countdownTask = Task(self.timerTask)
     countdownTask.duration = duration
     taskMgr.remove(self.uniqueName("golfKartTimerTask"))
     return taskMgr.add(countdownTask, self.uniqueName("golfKartTimerTask"))
 def __startIntro(self):
     self.T_WATER = 1
     self.T_WATER2LONGVIEW = 1
     self.T_LONGVIEW = 1
     self.T_LONGVIEW2TOONHEAD = 2
     self.T_TOONHEAD = 2
     self.T_TOONHEAD2CANNONBACK = 2
     self.__introCameraInterval = None
     taskLookInWater = Task(self.__taskLookInWater)
     taskPullBackFromWater = Task(self.__taskPullBackFromWater)
     taskFlyUpToToon = Task(self.__flyUpToToon)
     taskFlyToBackOfCannon = Task(self.__flyToBackOfCannon)
     commonData = {}
     taskLookInWater.data = commonData
     taskPullBackFromWater.data = commonData
     taskFlyUpToToon.data = commonData
     taskFlyToBackOfCannon.data = commonData
     introTask = Task.sequence(taskLookInWater, Task.pause(self.T_WATER), taskPullBackFromWater, Task.pause(self.T_WATER2LONGVIEW + self.T_LONGVIEW), taskFlyUpToToon, Task.pause(self.T_LONGVIEW2TOONHEAD + self.T_TOONHEAD), taskFlyToBackOfCannon)
     taskMgr.add(introTask, self.INTRO_TASK_NAME)
 def countdown(self, duration):
     countdownTask = Task(self.timerTask)
     countdownTask.duration = duration
     taskMgr.remove("trolleyTimerTask")
     return taskMgr.add(countdownTask, "trolleyTimerTask")
Пример #39
0
 def showChanceRewards(self):
     # modify avatar positions for each chance card
     tasks = []
     for reward in self.rewardList:
         self.notify.debug("showChanceRewards: reward = " + str(reward))
         index = self.rewardList.index(reward)
         # if an actual reward is present in the list
         if (reward != -1):
             self.notify.debug("adding tasks!")
             # hide the chance marker
             hcc = Task(self.hideChanceMarker)
             hcc.chanceMarkers = self.chanceMarkers
             hcc.index = index
             # create the tasks to display the card
             sct = Task(self.showChanceCard)
             sct.chanceCard = self.chanceCard
             sct.cardSound = self.cardSound
             stt = Task(self.showChanceCardText)
             rewardEntry = RaceGameGlobals.ChanceRewards[reward]
             stt.rewardIdx = reward
             # decide if its a good or bad reward based on movement
             # might be better to flag each one individually in the defns
             if ((rewardEntry[0][0] < 0) or (rewardEntry[0][1] > 0)):
                 stt.sound = self.negBuzzer
             else:
                 stt.sound = self.posBuzzer
             stt.picker = self.avIdList[index]
             rct = Task(self.resetChanceCard)
             task = Task.sequence(
                 hcc,
                 sct,
                 Task.pause(1.0),
                 stt,
                 Task.pause(3.0),
                 rct,
                 Task.pause(0.25),
             )
             tasks.append(task)
     return tasks
Пример #40
0
 def doSpawnTitleText(self, text):
     return
     self.titleColor = (1.0, 0.5, 0.4, 1.0)
     self.titleText = OnscreenText.OnscreenText(text, fg=self.titleColor, font=ToontownGlobals.getSignFont(), pos=(0, -0.5), scale=0.16, drawOrder=0, mayChange=1, wordwrap=16)
     self.titleText.setText(text)
     self.titleText.show()
     self.titleText.setColor(Vec4(*self.titleColor))
     self.titleText.clearColorScale()
     self.titleText.setFg(self.titleColor)
     seq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0)), Task(self.hideTitleText))
     seq.start()
    def __init__(self, avatar):
        """__init__(self)"""
        self.notify.debug("Init(): doId=%s" % avatar.doId)

        #determine if this avatar is in the same zone as the localtoon
        distPet = base.cr.doId2do.get(avatar.doId)
        if distPet and not distPet.isProxy():
            self.avatar = distPet
            self.petIsLocal = True
        else:
            self.avatar = avatar
            self.petIsLocal = False

        from toontown.friends import FriendsListPanel
        AvatarPanel.AvatarPanel.__init__(self,
                                         self.avatar,
                                         FriendsListPanel=FriendsListPanel)

        base.localAvatar.obscureFriendsListButton(1)

        base.panel = self

        gui = loader.loadModel("phase_3.5/models/gui/PetControlPannel")
        guiScale = 0.116
        guiPos = (1.12, 0, 0.30)
        self.frame = DirectFrame(
            parent=aspect2dp,
            image=gui,
            scale=guiScale,
            pos=guiPos,
            relief=None,
        )

        disabledImageColor = Vec4(.6, .6, .6, 1)
        text0Color = Vec4(1, 1, 1, 1)
        text1Color = Vec4(0.5, 1, 0.5, 1)
        text2Color = Vec4(1, 1, 0.5, 1)
        text3Color = Vec4(.6, .6, .6, 1)

        self.closeButton = DirectButton(
            parent=self.frame,
            image=(
                gui.find("**/CancelButtonUp"),
                gui.find("**/CancelButtonDown"),
                gui.find("**/CancelButtonRollover"),
            ),
            relief=None,
            command=self.__handleClose,
        )
        self.feedButton = DirectButton(
            parent=self.frame,
            image=(
                gui.find("**/ButtonFeedUp"),
                gui.find("**/ButtonFeedDown"),
                gui.find("**/ButtonFeedRollover"),
                gui.find("**/ButtonFeedUp"),
            ),
            geom=gui.find("**/PetControlFeedIcon"),
            geom3_color=disabledImageColor,
            image3_color=disabledImageColor,
            relief=None,
            text=TTLocalizer.PetPanelFeed,
            text_scale=TTLocalizer.PAPfeed,
            text0_fg=text0Color,
            text1_fg=text1Color,
            text2_fg=text2Color,
            text3_fg=text3Color,
            text_pos=(-0.5, 2.8),
            text_align=TextNode.ALeft,
            command=self.__handleFeed,
        )
        if not self.petIsLocal:
            self.feedButton['state'] = DGG.DISABLED
        else:
            self.feedButton['state'] = self.feedButtonState()

        self.callButton = DirectButton(
            parent=self.frame,
            image=(
                gui.find("**/ButtonGoToUp"),
                gui.find("**/ButtonGoToDown"),
                gui.find("**/ButtonGoToRollover"),
                gui.find("**/ButtonGoToUp"),
            ),
            geom=gui.find("**/PetControlGoToIcon"),
            geom3_color=disabledImageColor,
            image3_color=disabledImageColor,
            relief=None,
            text=TTLocalizer.PetPanelCall,
            text0_fg=text0Color,
            text1_fg=text1Color,
            text2_fg=text2Color,
            text3_fg=text3Color,
            text_scale=TTLocalizer.PAPcall,
            text_pos=(-0.5, 1.3),
            text_align=TextNode.ALeft,
            command=self.__handleCall,
        )
        if not self.petIsLocal:
            self.callButton['state'] = DGG.DISABLED

        self.scratchButton = DirectButton(
            parent=self.frame,
            image=(
                gui.find("**/ButtonScratchUp"),
                gui.find("**/ButtonScratchDown"),
                gui.find("**/ButtonScratchRollover"),
                gui.find("**/ButtonScratchUp"),
            ),
            geom=gui.find("**/PetControlScratchIcon"),
            geom3_color=disabledImageColor,
            image3_color=disabledImageColor,
            relief=None,
            text=TTLocalizer.PetPanelScratch,
            text0_fg=text0Color,
            text1_fg=text1Color,
            text2_fg=text2Color,
            text3_fg=text3Color,
            text_scale=TTLocalizer.PAPscratch,
            text_pos=(-0.5, 2.05),
            text_align=TextNode.ALeft,
            command=self.__handleScratch,
        )
        if not self.petIsLocal:
            self.scratchButton['state'] = DGG.DISABLED

        self.ownerButton = DirectButton(
            parent=self.frame,
            image=(
                gui.find("**/PetControlToonButtonUp"),
                gui.find("**/PetControlToonButtonDown"),
                gui.find("**/PetControlToonButtonRollover"),
            ),
            geom=gui.find("**/PetControlToonIcon"),
            geom3_color=disabledImageColor,
            relief=None,
            image3_color=disabledImageColor,
            text=("", TTLocalizer.PetPanelOwner, TTLocalizer.PetPanelOwner,
                  ""),
            text_fg=text2Color,
            text_shadow=(0, 0, 0, 1),
            text_scale=TTLocalizer.PAPowner,
            text_pos=(0.3, 1.05),
            text_align=TextNode.ACenter,
            command=self.__handleToOwner,
        )

        if self.avatar.getOwnerId() == base.localAvatar.doId:
            self.ownerButton['state'] = DGG.DISABLED

        toonGui = loader.loadModel("phase_3.5/models/gui/avatar_panel_gui")
        self.detailButton = DirectButton(
            parent=self.frame,
            image=(
                toonGui.find("**/ChtBx_BackBtn_UP"),
                toonGui.find("**/ChtBx_BackBtn_DN"),
                toonGui.find("**/ChtBx_BackBtn_Rllvr"),
                toonGui.find("**/ChtBx_BackBtn_UP"),
            ),
            relief=None,
            pos=(-1.3, 0, 0.67),
            image3_color=disabledImageColor,
            text=("", TTLocalizer.PetPanelDetail, TTLocalizer.PetPanelDetail,
                  ""),
            text_fg=text2Color,
            text_shadow=(0, 0, 0, 1),
            text_scale=0.05,
            text_pos=(0.05, 0.05),
            text_align=TextNode.ACenter,
            command=self.__handleDetail,
        )
        self.detailButton.setScale(7.5)

        if (not self.petIsLocal):
            self.detailButton['state'] = DGG.DISABLED

        gui.removeNode()
        toonGui.removeNode()

        self.petDetailPanel = None

        self.__fillPetInfo(self.avatar)

        self.accept("petNameChanged", self.__refreshPetInfo)
        self.accept("petStateUpdated", self.__refreshPetInfo)

        self.frame.show()

        if self.petIsLocal:
            #if this pet is real, set up a task to check his proximity
            proxTask = Task.loop(Task(self.__checkPetProximity),
                                 Task.pause(0.5))
            taskMgr.add(proxTask,
                        "petpanel-proximity-check",
                        priority=ToontownGlobals.PetPanelProximityPriority)

        if base.localAvatar.isLockedDown():
            self.disableInteractionButtons()

        if self.petIsLocal:
            self.listenForInteractionDone()

        messenger.send("petPanelDone")

        # refresh the pet info
        if ((not self.petIsLocal)
                and hasattr(self.avatar, 'updateMoodFromServer')):
            # can we use previously-cached mood info? Only do this for
            # localAv's pet. We can't reliably know if the mood of someone
            # else's pet has changed since we last queried their info...
            if (self.avatar.doId != localAvatar.getPetId()
                    or bboard.get(PetConstants.OurPetsMoodChangedKey, False)):
                # clear out the state text, since it may be stale and we'll be
                # setting it to a correct string in a moment
                self.stateLabel['text'] = ''

                def refresh(self=self, av=self.avatar):
                    # clear the 'mood dirty' flag for localAv's pet
                    bboard.remove(PetConstants.OurPetsMoodChangedKey)
                    self.__refreshPetInfo(av)

                self.avatar.updateMoodFromServer(refresh)
    def enterMoveAvatars(self, choiceList, positionList, rewardList):
        self.notify.debug('in enterMoveAvatars:')
        tasks = []
        self.avatarPositionsCopy = self.avatarPositions.copy()
        for i in range(0, len(choiceList) / self.numPlayers):
            startIndex = i * self.numPlayers
            endIndex = startIndex + self.numPlayers
            self.choiceList = choiceList[startIndex:endIndex]
            self.positionList = positionList[startIndex:endIndex]
            self.rewardList = rewardList[startIndex:endIndex]
            self.notify.debug('           turn: ' + str(i + 1))
            self.notify.debug('     choiceList: ' + str(self.choiceList))
            self.notify.debug('   positionList: ' + str(self.positionList))
            self.notify.debug('     rewardList: ' + str(self.rewardList))
            longestLerpTime = self.getLongestLerpTime(i > 0)
            self.notify.debug('longestLerpTime: ' + str(longestLerpTime))
            if i == 0:
                snt = Task(self.showNumbers)
                snt.choiceList = self.choiceList
                smt = Task(self.showMatches)
                smt.choiceList = self.choiceList
                tasks += [snt, Task.pause(0.5), smt]
            if longestLerpTime > 0.0:
                self.notify.debug('someone moved...')
                mat = Task(self.moveAvatars)
                mat.choiceList = self.choiceList
                mat.positionList = self.positionList
                mat.rewardList = self.rewardList
                mat.name = 'moveAvatars'
                if i == 0:
                    tasks += [Task.pause(0.75),
                     mat,
                     Task.pause(0.75),
                     Task(self.hideNumbers),
                     Task.pause(longestLerpTime - 0.5)]
                else:
                    mat.chance = 1
                    tasks += [mat, Task.pause(longestLerpTime)]
                tasks += self.showChanceRewards()
            else:
                self.notify.debug('no one moved...')
                tasks += [Task.pause(1.0), Task(self.hideNumbers)]

        self.notify.debug('task list : ' + str(tasks))
        wdt = Task(self.walkDone)
        wdt.name = 'walk done'
        tasks.append(wdt)
        moveTask = Task.sequence(*tasks)
        taskMgr.add(moveTask, 'moveAvatars')
Пример #43
0
    def __fireCannonTask(self, task):
        """
        Decides how to fire a cannon.
        If the local toon is firing then set up flight control
        Other clients just fire the cannon and get the toon position from broadcast.
        Always returns Task.done
        """
        launchTime = 0.0
        toonId = task.toonId
        cannon = task.cannon
        toon = cannon.getToonInside()

        self.notify.debug(
            str(self.doId) + " FIRING CANNON FOR TOON " + str(toonId))

        # Make sure if a toon is still inside
        # The a client may have crashed at this point
        if not cannon.isToonInside():
            return Task.done

        # Compute the flight results if the local toon is firing out of the cannon.
        if self.isLocalToonId(toonId):
            self.inWater = 0

            # calculate the trajectory
            flightResults = self.__calcFlightResults(cannon, toonId,
                                                     launchTime)
            # pull all the results (startPos, startHpr, startVel, trajectory) into the local namespace
            for key in flightResults:
                exec("%s = flightResults['%s']" % (key, key))

            #self.notify.debug("start position: " + str(startPos))
            #self.notify.debug("start velocity: " + str(startVel))
            #self.notify.debug("time of launch: " + str(launchTime))

        cannon.removeToonReadyToFire()

        # Create the shoot task
        shootTask = Task(self.__shootTask, self.taskNameShoot)
        shootTask.info = {'toonId': toonId, 'cannon': cannon}

        if self.isLocalToonId(toonId):
            self.flyingToonOffsetRotation = 0
            self.flyingToonOffsetAngle = 0
            self.flyingToonOffsetX = 0
            self.flyingToonOffsetY = 0

            self.hitCloud = 0
            self.initialFlyVel = INITIAL_VELOCITY
            self.camNode = NodePath(self.uniqueName("flyingCamera"))
            self.camNode.setScale(.5)
            self.camNode.setPos(self.localFlyingToon.getPos())
            self.camNode.setHpr(self.localFlyingToon.getHpr())
            self.camNode.reparentTo(render)
            startVel = cannon.getToonFireVel()
            self.lastStartVel = startVel

            place = base.cr.playGame.getPlace()
            place.fsm.request("activity")

            toon.dropShadow.hide()
            self.localFlyingDropShadow = self.shadowNode.copyTo(hidden)

            # stock the tasks up with the info they need
            # store the info in a shared dictionary
            self.localFlyingToon.wrtReparentTo(render)
            info = {}
            info['toonId'] = toonId
            info['trajectory'] = self.trajectory
            info['launchTime'] = launchTime
            info['toon'] = self.localFlyingToon
            info['hRot'] = cannon.getRotation()

            camera.wrtReparentTo(self.localFlyingToon)

            flyTask = Task(self.__localFlyTask, self.taskNameFly)
            flyTask.info = info

            seqTask = Task.sequence(shootTask, flyTask)

            self.__startCollisionHandler()

            self.notify.debug("Disable standard local toon controls.")
            base.localAvatar.disableAvatarControls()
            base.localAvatar.startPosHprBroadcast()

        else:
            seqTask = shootTask

        taskMgr.add(seqTask, self.taskName('flyingToon') + "-" + str(toonId))

        toon.startSmooth()

        return Task.done
Пример #44
0
 def __countdown(self, duration, callback):
     self.countdownTask = Task(self.__timerTask)
     self.countdownTask.duration = duration
     self.countdownTask.callback = callback
     taskMgr.remove(self.uniqueName(self.avId))
     return taskMgr.add(self.countdownTask, self.uniqueName(self.avId))
 def applyNewTrainLightTask(self):
     hideShowTrainLight = Task.loop(Task.pause(random.uniform(0.05, 1.5)),
                                    Task(self.hideTrainLightTask),
                                    Task.pause(0.1),
                                    Task(self.showTrainLightTask))
     taskMgr.add(hideShowTrainLight, 'hide-show-train-light-task')
Пример #46
0
 def countdown(self, duration):
     countdownTask = Task(self.timerTask)
     countdownTask.duration = duration
     countdownTask.maxCount = RaceGlobals.RaceCountdown
     taskMgr.remove(self.uniqueName('countdownTimerTask'))
     return taskMgr.add(countdownTask, self.uniqueName('countdownTimerTask'))
Пример #47
0
 def __rotateRDown(self, event):
     messenger.send('wakeup')
     task = Task(self.rotateToonR)
     taskMgr.add(task, self.taskName('rotateR'))
Пример #48
0
    def __init__(self, avatar):
        self.notify.debug('Init(): doId=%s' % avatar.doId)
        distPet = base.cr.doId2do.get(avatar.doId)
        if distPet and not distPet.isProxy():
            self.avatar = distPet
            self.petIsLocal = True
        else:
            self.avatar = avatar
            self.petIsLocal = False
        from toontown.friends import FriendsListPanel
        AvatarPanel.AvatarPanel.__init__(self, self.avatar, FriendsListPanel=FriendsListPanel)
        base.localAvatar.obscureFriendsListButton(1)
        base.panel = self
        gui = loader.loadModel('phase_3.5/models/gui/PetControlPannel')
        guiScale = 0.116
        guiPos = (-0.213, 0, -0.70)
        self.frame = DirectFrame(parent=base.a2dTopRight, image=gui, scale=guiScale, pos=guiPos, relief=None)
        disabledImageColor = Vec4(0.6, 0.6, 0.6, 1)
        text0Color = Vec4(1, 1, 1, 1)
        text1Color = Vec4(0.5, 1, 0.5, 1)
        text2Color = Vec4(1, 1, 0.5, 1)
        text3Color = Vec4(0.6, 0.6, 0.6, 1)
        self.closeButton = DirectButton(parent=self.frame, image=(gui.find('**/CancelButtonUp'), gui.find('**/CancelButtonDown'), gui.find('**/CancelButtonRollover')), relief=None, command=self.__handleClose)
        self.feedButton = DirectButton(parent=self.frame, image=(gui.find('**/ButtonFeedUp'),
         gui.find('**/ButtonFeedDown'),
         gui.find('**/ButtonFeedRollover'),
         gui.find('**/ButtonFeedUp')), geom=gui.find('**/PetControlFeedIcon'), geom3_color=disabledImageColor, image3_color=disabledImageColor, relief=None, text=TTLocalizer.PetPanelFeed, text_scale=TTLocalizer.PAPfeedButton, text0_fg=text0Color, text1_fg=text1Color, text2_fg=text2Color, text3_fg=text3Color, text_pos=(-0.5, 2.8), text_align=TextNode.ALeft, command=self.__handleFeed)
        if not self.petIsLocal:
            self.feedButton['state'] = DGG.DISABLED
        else:
            self.feedButton['state'] = self.feedButtonState()
        self.callButton = DirectButton(parent=self.frame, image=(gui.find('**/ButtonGoToUp'),
         gui.find('**/ButtonGoToDown'),
         gui.find('**/ButtonGoToRollover'),
         gui.find('**/ButtonGoToUp')), geom=gui.find('**/PetControlGoToIcon'), geom3_color=disabledImageColor, image3_color=disabledImageColor, relief=None, text=TTLocalizer.PetPanelCall, text0_fg=text0Color, text1_fg=text1Color, text2_fg=text2Color, text3_fg=text3Color, text_scale=TTLocalizer.PAPcallButton, text_pos=(-0.5, 1.3), text_align=TextNode.ALeft, command=self.__handleCall)
        if not self.petIsLocal:
            self.callButton['state'] = DGG.DISABLED
        self.scratchButton = DirectButton(parent=self.frame, image=(gui.find('**/ButtonScratchUp'),
         gui.find('**/ButtonScratchDown'),
         gui.find('**/ButtonScratchRollover'),
         gui.find('**/ButtonScratchUp')), geom=gui.find('**/PetControlScratchIcon'), geom3_color=disabledImageColor, image3_color=disabledImageColor, relief=None, text=TTLocalizer.PetPanelScratch, text0_fg=text0Color, text1_fg=text1Color, text2_fg=text2Color, text3_fg=text3Color, text_scale=TTLocalizer.PAPscratchButton, text_pos=(-0.5, 2.05), text_align=TextNode.ALeft, command=self.__handleScratch)
        if not self.petIsLocal:
            self.scratchButton['state'] = DGG.DISABLED
        self.ownerButton = DirectButton(parent=self.frame, image=(gui.find('**/PetControlToonButtonUp'), gui.find('**/PetControlToonButtonDown'), gui.find('**/PetControlToonButtonRollover')), geom=gui.find('**/PetControlToonIcon'), geom3_color=disabledImageColor, relief=None, image3_color=disabledImageColor, text=('',
         TTLocalizer.PetPanelOwner,
         TTLocalizer.PetPanelOwner,
         ''), text_fg=text2Color, text_shadow=(0, 0, 0, 1), text_scale=TTLocalizer.PAPownerButton, text_pos=(0.3, 1.05), text_align=TextNode.ACenter, command=self.__handleToOwner)
        if self.avatar.getOwnerId() == base.localAvatar.doId:
            self.ownerButton['state'] = DGG.DISABLED
        toonGui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
        self.detailButton = DirectButton(parent=self.frame, image=(toonGui.find('**/ChtBx_BackBtn_UP'),
         toonGui.find('**/ChtBx_BackBtn_DN'),
         toonGui.find('**/ChtBx_BackBtn_Rllvr'),
         toonGui.find('**/ChtBx_BackBtn_UP')), relief=None, pos=(-1.3, 0, 0.67), image3_color=disabledImageColor, text=('',
         TTLocalizer.PetPanelDetail,
         TTLocalizer.PetPanelDetail,
         ''), text_fg=text2Color, text_shadow=(0, 0, 0, 1), text_scale=0.05, text_pos=(0.05, 0.05), text_align=TextNode.ACenter, command=self.__handleDetail)
        self.detailButton.setScale(7.5)
        if not self.petIsLocal:
            self.detailButton['state'] = DGG.DISABLED
        gui.removeNode()
        toonGui.removeNode()
        self.petDetailPanel = None
        self.__fillPetInfo(self.avatar)
        self.accept('petNameChanged', self.__refreshPetInfo)
        self.accept('petStateUpdated', self.__refreshPetInfo)
        self.frame.show()
        if self.petIsLocal:
            proxTask = Task.loop(Task(self.__checkPetProximity), Task.pause(0.5))
            taskMgr.add(proxTask, 'petpanel-proximity-check', priority=ToontownGlobals.PetPanelProximityPriority)
        if base.localAvatar.isLockedDown():
            self.disableInteractionButtons()
        if self.petIsLocal:
            self.listenForInteractionDone()
        messenger.send('petPanelDone')
        if not self.petIsLocal and hasattr(self.avatar, 'updateMoodFromServer'):
            if self.avatar.doId != localAvatar.getPetId() or bboard.get(PetConstants.OurPetsMoodChangedKey, False):
                self.stateLabel['text'] = ''

                def refresh(self = self, av = self.avatar):
                    bboard.remove(PetConstants.OurPetsMoodChangedKey)
                    self.__refreshPetInfo(av)

                self.avatar.updateMoodFromServer(refresh)
Пример #49
0
 def __initSunTask(self):
     self.__killSunTask()
     task = Task(self.__sunTask)
     dT = self.getDeltaTime()
     task.ts = dT
     taskMgr.add(task, self.taskName('sunTask'))
Пример #50
0
 def countdown(self, duration):
     countdownTask = Task(self.timerTask)
     countdownTask.duration = duration
     taskMgr.remove(self.uniqueName('elevatorTimerTask'))
     return taskMgr.add(countdownTask, self.uniqueName('elevatorTimerTask'))
 def __fireCannonTask(self, task):
     launchTime = 0.0
     toonId = task.toonId
     cannon = task.cannon
     toon = cannon.getToonInside()
     self.notify.debug(
         str(self.doId) + ' FIRING CANNON FOR TOON ' + str(toonId))
     if not cannon.isToonInside():
         return Task.done
     if self.isLocalToonId(toonId):
         self.inWater = 0
         startPos, startHpr, startVel, trajectory = self.__calcFlightResults(
             cannon, toonId, launchTime)
         self.notify.debug('start position: ' + str(startPos))
         self.notify.debug('start velocity: ' + str(startVel))
         self.notify.debug('time of launch: ' + str(launchTime))
     cannon.removeToonReadyToFire()
     shootTask = Task(self.__shootTask, self.taskNameShoot)
     shootTask.info = {'toonId': toonId, 'cannon': cannon}
     if self.isLocalToonId(toonId):
         self.flyingToonOffsetRotation = 0
         self.flyingToonOffsetAngle = 0
         self.flyingToonOffsetX = 0
         self.flyingToonOffsetY = 0
         self.hitCloud = 0
         self.initialFlyVel = INITIAL_VELOCITY
         self.camNode = NodePath(self.uniqueName('flyingCamera'))
         self.camNode.setScale(0.5)
         self.camNode.setPos(self.localFlyingToon.getPos())
         self.camNode.setHpr(self.localFlyingToon.getHpr())
         self.camNode.reparentTo(render)
         self.lastStartVel = startVel
         place = base.cr.playGame.getPlace()
         place.fsm.request('activity')
         toon.dropShadow.hide()
         self.localFlyingDropShadow = self.shadowNode.copyTo(hidden)
         vel = startVel
         toon.lookAt(toon.getPos() + Vec3(vel[0], vel[1], vel[2]))
         toon.setP(localAvatar, -90)
         hpr = toon.getHpr()
         toon.d_setPosHpr(startPos[0], startPos[1], startPos[2], hpr[0],
                          hpr[1], hpr[2])
         self.localFlyingToon.wrtReparentTo(render)
         info = {}
         info['toonId'] = toonId
         info['trajectory'] = trajectory
         info['launchTime'] = launchTime
         info['toon'] = self.localFlyingToon
         info['hRot'] = cannon.getRotation()
         camera.wrtReparentTo(self.localFlyingToon)
         flyTask = Task(self.__localFlyTask, self.taskNameFly)
         flyTask.info = info
         seqTask = Task.sequence(shootTask, flyTask)
         self.__startCollisionHandler()
         self.notify.debug('Disable standard local toon controls.')
         base.localAvatar.disableAvatarControls()
         frameTime = globalClock.getFrameTime()
         netLaunchTime = globalClockDelta.localToNetworkTime(launchTime +
                                                             frameTime,
                                                             bits=31)
         self.sendUpdate('setToonTrajectoryAi', [
             netLaunchTime, startPos[0], startPos[1], startPos[2],
             startHpr[0], startHpr[1], startHpr[2], startVel[0],
             startVel[1], startVel[2]
         ])
     else:
         seqTask = shootTask
     taskMgr.add(seqTask, self.taskName('flyingToon') + '-' + str(toonId))
     toon.startSmooth()
     return Task.done
Пример #52
0
    def runInPlace(self, avatar, lane, currentPlace, newPlace, time):
        # Put the avatar in lane and place specified
        # Clamp the place to the length of the lane
        place = min(newPlace, len(self.posHprArray[lane]) - 1)

        # we need to approximate the curve of the track
        # better by using more sample points
        step = (place - currentPlace) / 3
        pos1 = self.posHprArray[lane][currentPlace + step]
        pos2 = self.posHprArray[lane][currentPlace + 2 * step]
        pos3 = self.posHprArray[lane][place]

        def startRun(task):
            task.avatar.setAnimState("run", 1)
            return Task.done

        startRunTask = Task(startRun, "startRun-" + str(lane))
        startRunTask.avatar = avatar

        def stopRun(task, raceBoard=self.raceBoard, pos3=pos3):
            task.avatar.setAnimState("neutral", 1)
            task.avatar.setPosHpr(raceBoard, pos3[0], pos3[1], pos3[2],
                                  pos3[3], 0, 0)
            return Task.done

        stopRunTask = Task(stopRun, "stopRun-" + str(lane))
        stopRunTask.avatar = avatar

        runTask = Task.sequence(
            startRunTask,
            avatar.lerpPosHpr(
                pos1[0],
                pos1[1],
                pos1[2],
                pos1[3],
                0,
                0,
                time / 3.,  # seconds
                other=self.raceBoard),
            avatar.lerpPosHpr(
                pos2[0],
                pos2[1],
                pos2[2],
                pos2[3],
                0,
                0,
                time / 3.,  # seconds
                other=self.raceBoard),
            avatar.lerpPosHpr(
                pos3[0],
                pos3[1],
                pos3[2],
                pos3[3],
                0,
                0,
                time / 3.,  # seconds
                other=self.raceBoard),
            stopRunTask,
        )

        taskMgr.add(runTask, "runAvatar-" + str(lane))
    def __fireCannonTask(self, task):
        launchTime = task.fireTime
        avId = task.avId
        self.notify.debug('FIRING CANNON FOR AVATAR ' + str(avId))
        startPos, startHpr, startVel, trajectory, timeOfImpact, hitWhat = self.__calcFlightResults(avId, launchTime)

        self.notify.debug('start position: ' + str(startPos))
        self.notify.debug('start velocity: ' + str(startVel))
        self.notify.debug('time of launch: ' + str(launchTime))
        self.notify.debug('time of impact: ' + str(timeOfImpact))
        self.notify.debug('location of impact: ' + str(trajectory.getPos(timeOfImpact)))
        if hitWhat == self.HIT_WATER:
            self.notify.debug('toon will land in the water')
        elif hitWhat == self.HIT_TOWER:
            self.notify.debug('toon will hit the tower')
        else:
            self.notify.debug('toon will hit the ground')
        head = self.toonHeadDict[avId]
        head.stopBlink()
        head.stopLookAroundNow()
        head.reparentTo(hidden)
        av = self.toonModelDict[avId]
        av.reparentTo(render)
        av.setPos(startPos)
        av.setHpr(startHpr)
        avatar = self.getAvatar(avId)
        avatar.loop('swim')
        avatar.setPosHpr(0, 0, -(avatar.getHeight() / 2.0), 0, 0, 0)
        shootTask = Task(self.__shootTask)
        flyTask = Task(self.__flyTask)
        seqDoneTask = Task(self.__flySequenceDoneTask)
        info = {}
        info['avId'] = avId
        info['trajectory'] = trajectory
        info['launchTime'] = launchTime
        info['timeOfImpact'] = timeOfImpact
        info['hitWhat'] = hitWhat
        info['toon'] = self.toonModelDict[avId]
        info['hRot'] = self.cannonPositionDict[avId][0]
        info['haveWhistled'] = 0
        info['maxCamPullback'] = CAMERA_PULLBACK_MIN
        info['timeEnterTowerXY'], info['timeExitTowerXY'] = trajectory.calcEnterAndLeaveCylinderXY(self.tower.getPos(render), TOWER_RADIUS)
        shootTask.info = info
        flyTask.info = info
        seqDoneTask.info = info
        seqTask = Task.sequence(shootTask, flyTask, Task.pause(LAND_TIME), seqDoneTask)
        taskMgr.add(seqTask, 'flyingToon' + str(avId))
        if avId == self.localAvId:
            if info['hitWhat'] == self.HIT_WATER:
                self.sendUpdate('setToonWillLandInWater', [info['timeOfImpact']])
        return Task.done
 def startBlinkTask(self):
     self.blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
     taskMgr.add(self.blinkTask, 'bosshealthbar-blink-task')
 def __startLocalCannonMoveTask(self):
     self.localCannonMoving = False
     task = Task(self.__localCannonMoveTask)
     task.lastPositionBroadcastTime = 0.0
     taskMgr.add(task, self.LOCAL_CANNON_MOVE_TASK)
 def _startUpdateTask(self):
     task = Task(self._updateTask)
     task.lastPositionBroadcastTime = 0.0
     self.throwPiePrevTime = 0
     taskMgr.add(task, UPDATE_TASK_NAME)
Пример #57
0
 def enableInteractionButtons(self):
     self.notify.debug('enable buttons')
     proxTask = Task.loop(Task(self.__checkPetProximity), Task.pause(0.5))
     taskMgr.add(proxTask, 'petpanel-proximity-check', priority=ToontownGlobals.PetPanelProximityPriority)
     self.__checkPetProximity()
Пример #58
0
 def __initDaytimeTask(self):
     self.__killDaytimeTask()
     task = Task(self.__dayTimeTask)
     dT = self.getDeltaTime()
     task.ts = dT
     taskMgr.add(task, self.taskName('daytime'))
Пример #59
0
    def enterMoveAvatars(self, choiceList, positionList, rewardList):
        self.notify.debug("in enterMoveAvatars:")
        # These arrays could contain multiple turn information,
        # so unroll them one turn at a time
        tasks = []

        # Make a copy for getLongestLerpTime to stomp on
        self.avatarPositionsCopy = self.avatarPositions.copy()

        for i in range(0, len(choiceList) / self.numPlayers):
            startIndex = i * self.numPlayers
            endIndex = startIndex + self.numPlayers
            self.choiceList = choiceList[startIndex:endIndex]
            self.positionList = positionList[startIndex:endIndex]
            self.rewardList = rewardList[startIndex:endIndex]

            self.notify.debug("           turn: " + str(i + 1))
            self.notify.debug("     choiceList: " + str(self.choiceList))
            self.notify.debug("   positionList: " + str(self.positionList))
            self.notify.debug("     rewardList: " + str(self.rewardList))

            longestLerpTime = self.getLongestLerpTime(i > 0)

            self.notify.debug("longestLerpTime: " + str(longestLerpTime))

            # only need to do this once
            if i == 0:
                snt = Task(self.showNumbers)
                snt.choiceList = self.choiceList
                smt = Task(self.showMatches)
                smt.choiceList = self.choiceList
                tasks += [
                    snt,
                    Task.pause(0.5),
                    smt,
                ]

            # there may be multiple moves per turn thanks to the
            # chance cards. Concatenate all tasks into a list,
            # then make one big sequence out of the lists
            if longestLerpTime > 0.0:
                self.notify.debug("someone moved...")
                # If anybody moves, add all these task
                mat = Task(self.moveAvatars)
                mat.choiceList = self.choiceList
                mat.positionList = self.positionList
                mat.rewardList = self.rewardList
                mat.name = "moveAvatars"
                if i == 0:
                    tasks += [
                        Task.pause(0.75),
                        # Start moving the avatars with the numbers up
                        # for just a brief time
                        mat,
                        Task.pause(0.75),
                        Task(self.hideNumbers),
                        # Wait for the walk to finish
                        Task.pause(longestLerpTime - 0.5),
                    ]
                else:
                    mat.chance = 1
                    tasks += [
                        mat,
                        # Wait for the walk to finish
                        Task.pause(longestLerpTime),
                    ]

                # check for chance card hit in this lane
                tasks += self.showChanceRewards()
            else:
                self.notify.debug("no one moved...")
                # If nobody moves, use this sequence
                tasks += [Task.pause(1.0), Task(self.hideNumbers)]

        self.notify.debug("task list : " + str(tasks))

        # now make and spawn a sequence out of our compiled task list
        wdt = Task(self.walkDone)
        wdt.name = "walk done"
        tasks.append(wdt)
        moveTask = Task.sequence(*tasks)
        taskMgr.add(moveTask, "moveAvatars")