Exemplo n.º 1
0
    def disable(self):
        self.notify.debug('disable %s' % self.doId)
        if self.musicTrack:
            self.musicTrack.finish()
        self.raceMusic.stop()
        self.stopSky()
        if self.sky is not None:
            self.sky.removeNode()
        if self.dummyNode:
            self.dummyNode.removeNode()
            self.dummyNode = None
        for taskName in self.miscTaskNames:
            taskMgr.remove(taskName)

        taskMgr.remove('raceWatcher')
        self.ignoreAll()
        DistributedSmoothNode.activateSmoothing(1, 0)
        if self.isUrbanTrack:
            self.unloadUrbanTrack()
        if self.fog:
            render.setFogOff()
            del self.fog
            self.fog = None
        if self.geom is not None:
            self.geom.hide()
        base.camLens.setFar(self.oldFarPlane)
        DistributedObject.DistributedObject.disable(self)
Exemplo n.º 2
0
    def offstage(self):
        self.notify.debug('offstage')
        DistributedMinigame.offstage(self)
        self.introMovie.finish()
        self.boatTilt.finish()
        self.mapModel.hide()
        DistributedSmoothNode.activateSmoothing(1, 0)
        for avId in self.toonSDs.keys():
            self.toonSDs[avId].exit()

        base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
        base.camLens.setMinFov(settings['fieldofview']/(4./3.))
        base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
        self.arrowKeys.destroy()
        del self.arrowKeys
        self.environNode.removeNode()
        del self.environNode
        if None != self.sndAmbience:
            self.sndAmbience.stop()
        for avId in self.avIdList:
            av = self.getAvatar(avId)
            if av:
                av.dropShadow.show()
                av.resetLOD()
                av.setAnimState('neutral', 1.0)

        self.dead = 1
        self.__killCrabTask()
        for spawner in self.spawners:
            spawner.destroy()
            del spawner

        del self.spawners
        for crab in self.crabs:
            crab.moveLerp.finish()
            crab.moveLerp = None
            crab.removeNode()
            del crab

        if hasattr(self, 'treasures') and self.treasures:
            for i in xrange(self.NUMTREASURES):
                self.treasures[i].destroy()

            del self.treasures
        if hasattr(self, 'cSphereNodePath1'):
            self.cSphereNodePath1.removeNode()
            del self.cSphereNodePath1
        if hasattr(self, 'cSphereNodePath1'):
            self.cSphereNodePath2.removeNode()
            del self.cSphereNodePath2
        if hasattr(self, 'remoteToonCollNPs'):
            for np in self.remoteToonCollNPs.values():
                np.removeNode()

            del self.remoteToonCollNPs
        self.pusher = None
        self.cTrav = None
        self.cTrav2 = None
        base.localAvatar.collisionsOn()
        return
Exemplo n.º 3
0
    def announceGenerate(self):
        self.notify.debug('announceGenerate: %s' % self.doId)
        DistributedObject.DistributedObject.announceGenerate(self)
        musicFile = self.BGM_BaseDir + RaceGlobals.TrackDict[self.trackId][7]
        self.raceMusic = base.loader.loadMusic(musicFile)
        base.playMusic(self.raceMusic, looping=1, volume=0.8)
        camera.reparentTo(render)
        if self.trackId in (RaceGlobals.RT_Urban_1,
         RaceGlobals.RT_Urban_1_rev,
         RaceGlobals.RT_Urban_2,
         RaceGlobals.RT_Urban_2_rev):
            self.isUrbanTrack = True
        self.oldFarPlane = base.camLens.getFar()
        base.camLens.setFar(12000)
        localAvatar.startPosHprBroadcast()
        localAvatar.d_broadcastPositionNow()
        DistributedSmoothNode.activateSmoothing(1, 1)
        self.reversed = self.trackId / 2.0 > int(self.trackId / 2.0)
        for i in xrange(3):
            base.loader.tick()

        self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
        self.sky.setPos(0, 0, 0)
        self.sky.setScale(20.0)
        self.sky.setFogOff()
        if self.trackId in (RaceGlobals.RT_Urban_1,
         RaceGlobals.RT_Urban_1_rev,
         RaceGlobals.RT_Urban_2,
         RaceGlobals.RT_Urban_2_rev):
            self.loadFog()
        self.setupGeom()
        self.startSky()
        for i in xrange(5):
            base.loader.tick()
    def offstage(self):
        self.notify.debug('offstage')
        DistributedMinigame.offstage(self)
        self.introMovie.finish()
        self.boatTilt.finish()
        self.mapModel.hide()
        DistributedSmoothNode.activateSmoothing(1, 0)
        for avId in self.toonSDs.keys():
            self.toonSDs[avId].exit()

        base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
        base.camLens.setMinFov(ToontownGlobals.DefaultCameraFov/(4./3.))
        base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
        self.arrowKeys.destroy()
        del self.arrowKeys
        self.environNode.removeNode()
        del self.environNode
        if None != self.sndAmbience:
            self.sndAmbience.stop()
        for avId in self.avIdList:
            av = self.getAvatar(avId)
            if av:
                av.dropShadow.show()
                av.resetLOD()
                av.setAnimState('neutral', 1.0)

        self.dead = 1
        self.__killCrabTask()
        for spawner in self.spawners:
            spawner.destroy()
            del spawner

        del self.spawners
        for crab in self.crabs:
            crab.moveLerp.finish()
            crab.moveLerp = None
            crab.removeNode()
            del crab

        if hasattr(self, 'treasures') and self.treasures:
            for i in range(self.NUMTREASURES):
                self.treasures[i].destroy()

            del self.treasures
        if hasattr(self, 'cSphereNodePath1'):
            self.cSphereNodePath1.removeNode()
            del self.cSphereNodePath1
        if hasattr(self, 'cSphereNodePath1'):
            self.cSphereNodePath2.removeNode()
            del self.cSphereNodePath2
        if hasattr(self, 'remoteToonCollNPs'):
            for np in self.remoteToonCollNPs.values():
                np.removeNode()

            del self.remoteToonCollNPs
        self.pusher = None
        self.cTrav = None
        self.cTrav2 = None
        base.localAvatar.collisionsOn()
        return
    def disable(self):
        self.notify.debug('disable %s' % self.doId)
        if self.musicTrack:
            self.musicTrack.finish()
        self.raceMusic.stop()
        self.stopSky()
        if self.sky is not None:
            self.sky.removeNode()
        if self.dummyNode:
            self.dummyNode.removeNode()
            self.dummyNode = None
        for taskName in self.miscTaskNames:
            taskMgr.remove(taskName)

        taskMgr.remove('raceWatcher')
        self.ignoreAll()
        DistributedSmoothNode.activateSmoothing(1, 0)
        if self.isUrbanTrack:
            self.unloadUrbanTrack()
        if self.fog:
            render.setFogOff()
            del self.fog
            self.fog = None
        if self.geom is not None:
            self.geom.hide()
        base.camLens.setFar(self.oldFarPlane)
        DistributedObject.DistributedObject.disable(self)
        return
Exemplo n.º 6
0
    def onstage(self):
        self.notify.debug("onstage")
        DistributedMinigame.onstage(self)
        self.ground.reparentTo(render)
        self.sky.reparentTo(render)
        # Turn the sky on
        # base.localAvatar.startSky(self.sky)

        myPos = self.avIdList.index(self.localAvId)
        assert (myPos >= 0)
        base.localAvatar.setPosHpr(*self.initialPositions[myPos])
        base.localAvatar.reparentTo(render)
        base.localAvatar.loop('neutral')

        camera.reparentTo(render)
        camera.setPosHpr(0, -24, 16, 0, -30, 0)
        # prevent sky from getting clipped
        base.camLens.setFar(450.)
        # Iris in
        base.transitions.irisIn(0.4)

        # The tag game needs those little red arrows.
        NametagGlobals.setMasterArrowsOn(1)

        # Turn on predictive smoothing!
        DistributedSmoothNode.activateSmoothing(1, 1)

        self.IT = None
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     self.ground.reparentTo(render)
     self.scorePanels = []
     camera.reparentTo(render)
     camera.setPosHpr(*self.CameraPosHpr)
     lt = base.localAvatar
     lt.reparentTo(render)
     self._DistributedCatchGame__placeToon(self.localAvId)
     lt.setSpeed(0, 0)
     toonSD = self.toonSDs[self.localAvId]
     toonSD.enter()
     toonSD.fsm.request('normal')
     self.orthoWalk.stop()
     radius = 0.69999999999999996
     handler = CollisionHandlerEvent()
     handler.setInPattern('ltCatch%in')
     self.ltLegsCollNode = CollisionNode('catchLegsCollNode')
     self.ltLegsCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltHeadCollNode = CollisionNode('catchHeadCollNode')
     self.ltHeadCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltLHandCollNode = CollisionNode('catchLHandCollNode')
     self.ltLHandCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltRHandCollNode = CollisionNode('catchRHandCollNode')
     self.ltRHandCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     legsCollNodepath = lt.attachNewNode(self.ltLegsCollNode)
     legsCollNodepath.hide()
     head = base.localAvatar.getHeadParts().getPath(2)
     headCollNodepath = head.attachNewNode(self.ltHeadCollNode)
     headCollNodepath.hide()
     lHand = base.localAvatar.getLeftHands()[0]
     lHandCollNodepath = lHand.attachNewNode(self.ltLHandCollNode)
     lHandCollNodepath.hide()
     rHand = base.localAvatar.getRightHands()[0]
     rHandCollNodepath = rHand.attachNewNode(self.ltRHandCollNode)
     rHandCollNodepath.hide()
     lt.cTrav.addCollider(legsCollNodepath, handler)
     lt.cTrav.addCollider(headCollNodepath, handler)
     lt.cTrav.addCollider(lHandCollNodepath, handler)
     lt.cTrav.addCollider(lHandCollNodepath, handler)
     if self.ShowToonSpheres:
         legsCollNodepath.show()
         headCollNodepath.show()
         lHandCollNodepath.show()
         rHandCollNodepath.show()
     
     self.ltLegsCollNode.addSolid(CollisionSphere(0, 0, radius, radius))
     self.ltHeadCollNode.addSolid(CollisionSphere(0, 0, 0, radius))
     self.ltLHandCollNode.addSolid(CollisionSphere(0, 0, 0, 2 * radius / 3.0))
     self.ltRHandCollNode.addSolid(CollisionSphere(0, 0, 0, 2 * radius / 3.0))
     self.toonCollNodes = [
         legsCollNodepath,
         headCollNodepath,
         lHandCollNodepath,
         rHandCollNodepath]
     if self.PredictiveSmoothing:
         DistributedSmoothNode.activateSmoothing(1, 1)
     
     self.introMovie.start()
    def announceGenerate(self):
        self.notify.debug('announceGenerate: %s' % self.doId)
        DistributedObject.DistributedObject.announceGenerate(self)
        musicFile = self.BGM_BaseDir + RaceGlobals.TrackDict[self.trackId][7]
        self.raceMusic = base.loadMusic(musicFile)
        base.playMusic(self.raceMusic, looping=1, volume=0.8)
        base.camera.reparentTo(render)
        if self.trackId in (RaceGlobals.RT_Urban_1,
         RaceGlobals.RT_Urban_1_rev,
         RaceGlobals.RT_Urban_2,
         RaceGlobals.RT_Urban_2_rev):
            self.isUrbanTrack = True
        self.oldFarPlane = base.camLens.getFar()
        base.camLens.setFar(12000)
        localAvatar.startPosHprBroadcast()
        localAvatar.d_broadcastPositionNow()
        DistributedSmoothNode.activateSmoothing(1, 1)
        self.reversed = self.trackId / 2.0 > int(self.trackId / 2.0)
        for i in xrange(3):
            base.loader.tick()

        self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
        self.sky.setPos(0, 0, 0)
        self.sky.setScale(20.0)
        self.sky.setFogOff()
        if self.trackId in (RaceGlobals.RT_Urban_1,
         RaceGlobals.RT_Urban_1_rev,
         RaceGlobals.RT_Urban_2,
         RaceGlobals.RT_Urban_2_rev):
            self.loadFog()
        self.setupGeom()
        self.startSky()
        for i in xrange(5):
            base.loader.tick()
Exemplo n.º 9
0
 def takeLocalAvatarOutOfActivity(self):
     self.notify.debug('localToon has left the circle')
     base.camera.reparentTo(base.localAvatar)
     base.localAvatar.startUpdateSmartCamera()
     base.localAvatar.enableSmartCameraViews()
     base.localAvatar.setCameraPositionByIndex(base.localAvatar.cameraIndex)
     DistributedSmoothNode.activateSmoothing(1, 0)
 def takeLocalAvatarOutOfActivity(self):
     self.notify.debug('localToon has left the circle')
     camera.reparentTo(base.localAvatar)
     base.localAvatar.startUpdateSmartCamera()
     base.localAvatar.enableSmartCameraViews()
     base.localAvatar.setCameraPositionByIndex(base.localAvatar.cameraIndex)
     DistributedSmoothNode.activateSmoothing(1, 0)
Exemplo n.º 11
0
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     self.ground.reparentTo(render)
     self.scorePanels = []
     camera.reparentTo(render)
     camera.setPosHpr(*self.CameraPosHpr)
     lt = base.localAvatar
     lt.reparentTo(render)
     self.__placeToon(self.localAvId)
     lt.setSpeed(0, 0)
     toonSD = self.toonSDs[self.localAvId]
     toonSD.enter()
     toonSD.fsm.request('normal')
     self.orthoWalk.stop()
     radius = 0.7
     handler = CollisionHandlerEvent()
     handler.setInPattern('ltCatch%in')
     self.ltLegsCollNode = CollisionNode('catchLegsCollNode')
     self.ltLegsCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltHeadCollNode = CollisionNode('catchHeadCollNode')
     self.ltHeadCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltLHandCollNode = CollisionNode('catchLHandCollNode')
     self.ltLHandCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     self.ltRHandCollNode = CollisionNode('catchRHandCollNode')
     self.ltRHandCollNode.setCollideMask(ToontownGlobals.CatchGameBitmask)
     legsCollNodepath = lt.attachNewNode(self.ltLegsCollNode)
     legsCollNodepath.hide()
     head = base.localAvatar.getHeadParts().getPath(2)
     headCollNodepath = head.attachNewNode(self.ltHeadCollNode)
     headCollNodepath.hide()
     lHand = base.localAvatar.getLeftHands()[0]
     lHandCollNodepath = lHand.attachNewNode(self.ltLHandCollNode)
     lHandCollNodepath.hide()
     rHand = base.localAvatar.getRightHands()[0]
     rHandCollNodepath = rHand.attachNewNode(self.ltRHandCollNode)
     rHandCollNodepath.hide()
     lt.cTrav.addCollider(legsCollNodepath, handler)
     lt.cTrav.addCollider(headCollNodepath, handler)
     lt.cTrav.addCollider(lHandCollNodepath, handler)
     lt.cTrav.addCollider(lHandCollNodepath, handler)
     if self.ShowToonSpheres:
         legsCollNodepath.show()
         headCollNodepath.show()
         lHandCollNodepath.show()
         rHandCollNodepath.show()
     self.ltLegsCollNode.addSolid(CollisionSphere(0, 0, radius, radius))
     self.ltHeadCollNode.addSolid(CollisionSphere(0, 0, 0, radius))
     self.ltLHandCollNode.addSolid(
         CollisionSphere(0, 0, 0, 2 * radius / 3.0))
     self.ltRHandCollNode.addSolid(
         CollisionSphere(0, 0, 0, 2 * radius / 3.0))
     self.toonCollNodes = [
         legsCollNodepath, headCollNodepath, lHandCollNodepath,
         rHandCollNodepath
     ]
     if self.PredictiveSmoothing:
         DistributedSmoothNode.activateSmoothing(1, 1)
     self.introMovie.start()
 def offstage(self):
     self.notify.debug('offstage')
     DistributedSmoothNode.activateSmoothing(1, 0)
     NametagGlobals.setMasterArrowsOn(0)
     DistributedMinigame.offstage(self)
     self.sky.reparentTo(hidden)
     self.ground.reparentTo(hidden)
     base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
     self.itText.hide()
Exemplo n.º 13
0
 def offstage(self):
     self.notify.debug('offstage')
     DistributedSmoothNode.activateSmoothing(1, 0)
     NametagGlobals.setMasterArrowsOn(0)
     DistributedMinigame.offstage(self)
     self.sky.reparentTo(hidden)
     self.ground.reparentTo(hidden)
     base.camLens.setFar(ToontownGlobals.DefaultCameraFar)
     self.itText.hide()
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     self.ground.reparentTo(render)
     self.sky.reparentTo(render)
     myPos = self.avIdList.index(self.localAvId)
     base.localAvatar.setPosHpr(*self.initialPositions[myPos])
     base.localAvatar.reparentTo(render)
     base.localAvatar.loop('neutral')
     camera.reparentTo(render)
     camera.setPosHpr(0, -24, 16, 0, -30, 0)
     base.camLens.setFar(450.0)
     base.transitions.irisIn(0.40000000000000002)
     NametagGlobals.setMasterArrowsOn(1)
     DistributedSmoothNode.activateSmoothing(1, 1)
     self.IT = None
Exemplo n.º 15
0
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     self.ground.reparentTo(render)
     self.sky.reparentTo(render)
     myPos = self.avIdList.index(self.localAvId)
     base.localAvatar.setPosHpr(*self.initialPositions[myPos])
     base.localAvatar.reparentTo(render)
     base.localAvatar.loop('neutral')
     camera.reparentTo(render)
     camera.setPosHpr(0, -24, 16, 0, -30, 0)
     base.camLens.setFar(450.0)
     base.transitions.irisIn(0.40000000000000002)
     NametagGlobals.setMasterArrowsOn(1)
     DistributedSmoothNode.activateSmoothing(1, 1)
     self.IT = None
Exemplo n.º 16
0
    def offstage(self):
        self.notify.debug("offstage")
        # Restore normal non-predictive smoothing.
        DistributedSmoothNode.activateSmoothing(1, 0)

        # Turn off the little red arrows.
        NametagGlobals.setMasterArrowsOn(0)

        DistributedMinigame.offstage(self)
        # Turn the sky off
        # base.localAvatar.stopSky(self.sky)
        self.sky.reparentTo(hidden)
        self.ground.reparentTo(hidden)

        base.camLens.setFar(ToontownGlobals.DefaultCameraFar)

        self.itText.hide()
Exemplo n.º 17
0
 def onstage(self):
     self.notify.debug("onstage")
     DistributedMinigame.onstage(self)
     self.ground.reparentTo(render)
     self.sky.reparentTo(render)
     myPos = self.avIdList.index(self.localAvId)
     base.localAvatar.setPosHpr(*self.initialPositions[myPos])
     base.localAvatar.reparentTo(render)
     base.localAvatar.loop("neutral")
     camera.reparentTo(render)
     camera.setPosHpr(0, 45, 44, 0, -50, 0)
     base.camLens.setFar(450.0)
     base.transitions.irisIn(0.4)
     NametagGlobals.setWant2dNametags(True)
     DistributedSmoothNode.activateSmoothing(1, 1)
     self.IT = None
     return
Exemplo n.º 18
0
    def offstage(self):
        self.notify.debug('offstage')
        DistributedSmoothNode.activateSmoothing(1, 0)
        self.introMovie.finish()
        for avId in self.toonSDs.keys():
            self.toonSDs[avId].exit()

        self.hidePosts()
        self.hideDropGrid()
        for collNode in self.toonCollNodes:
            while collNode.node().getNumSolids():
                collNode.node().removeSolid(0)
            base.localAvatar.cTrav.removeCollider(collNode)

        del self.toonCollNodes
        for panel in self.scorePanels:
            panel.cleanup()

        del self.scorePanels
        self.ground.reparentTo(hidden)
        DistributedMinigame.offstage(self)
Exemplo n.º 19
0
 def offstage(self):
     self.notify.debug('offstage')
     DistributedSmoothNode.activateSmoothing(1, 0)
     self.introMovie.finish()
     for avId in self.toonSDs.keys():
         self.toonSDs[avId].exit()
     
     self.hidePosts()
     self.hideDropGrid()
     for collNode in self.toonCollNodes:
         while collNode.node().getNumSolids():
             collNode.node().removeSolid(0)
         base.localAvatar.cTrav.removeCollider(collNode)
     
     del self.toonCollNodes
     for panel in self.scorePanels:
         panel.cleanup()
     
     del self.scorePanels
     self.ground.reparentTo(hidden)
     DistributedMinigame.offstage(self)
Exemplo n.º 20
0
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     base.localAvatar.collisionsOff()
     DistributedSmoothNode.activateSmoothing(1, 1)
     numToons = self.numPlayers
     self.NUMTREASURES = numToons
     camera.reparentTo(render)
     camera.setZ(36)
     camera.setHpr(0,0,0)
     camera.setX(0)
     base.camLens.setMinFov(31/(4./3.))
     camera.setY(-54)
     base.camLens.setFar(1500)
     self.introMovie = self.getIntroMovie()
     self.introMovie.start()
     self.accept('FishHit', self.fishCollision)
     toonSD = self.toonSDs[self.localAvId]
     toonSD.enter()
     toonSD.fsm.request('normal')
     toon = base.localAvatar
     toon.reparentTo(render)
     toon.setPos(-9, -1, 36)
     self.__placeToon(self.localAvId)
     self.arrowKeys = ArrowKeys.ArrowKeys()
     self.xVel = 0
     self.zVel = 0
     self.orientNode = toon.attachNewNode('orientNode')
     self.orientNode.setPos(0, 0, 1)
     self.orientNode2 = toon.attachNewNode('orientNode')
     self.orientNode2.setPos(0, 0, -1)
     self.environNode = render.attachNewNode('environNode')
     self.environModel.reparentTo(self.environNode)
     self.environModel.setScale(2.8, 2.8, 2.73)
     self.environModel.setPos(0, 0.5, -41)
     self.skyModel.setScale(1.3, 1.0, 1.0)
     boatoff = 6.75
     self.boatModel.reparentTo(self.environNode)
     self.boatModel.setPos(0, 3.0, 40 - boatoff)
     self.boatModel.setScale(2.8)
     cSphere = CollisionSphere(0.0, 0.0, 0.0 + 2.0, 3.0)
     cSphere.setTangible(0)
     name = 'boat'
     cSphereNode = CollisionNode(name)
     cSphereNode.setIntoCollideMask(DivingGameGlobals.CollideMask)
     cSphereNode.addSolid(cSphere)
     self.boatNode = cSphereNode
     self.boatCNP = self.boatModel.attachNewNode(cSphereNode)
     self.accept('reach-boat', self.__boatReached)
     self.boatTilt = Sequence(LerpFunc(self.boatModel.setR, duration=5, fromData=5, toData=-5, blendType='easeInOut', name='tilt'), LerpFunc(self.boatModel.setR, duration=5, fromData=-5, toData=5, blendType='easeInOut', name='tilt'))
     self.boatTilt.loop()
     self.mapScaleRatio = 40
     self.mapModel.reparentTo(base.a2dTopRight)
     self.mapModel.setScale(1.0 / self.mapScaleRatio)
     self.mapModel.setTransparency(1)
     self.mapModel.setPos(-0.22, 0.0, -1.30)
     self.mapModel.setColorScale(1, 1, 1, 0.7)
     self.mapModel.hide()
     if self.sndAmbience:
         self.sndAmbience.setLoop(True)
         self.sndAmbience.play()
         self.sndAmbience.setVolume(0.01)
     return
 def onstage(self):
     self.notify.debug('onstage')
     DistributedMinigame.onstage(self)
     base.localAvatar.collisionsOff()
     DistributedSmoothNode.activateSmoothing(1, 1)
     numToons = self.numPlayers
     self.NUMTREASURES = numToons
     camera.reparentTo(render)
     camera.setZ(36)
     camera.setHpr(0,0,0)
     camera.setX(0)
     base.camLens.setFov(45)
     camera.setY(-54)
     base.camLens.setFar(1500)
     self.introMovie = self.getIntroMovie()
     self.introMovie.start()
     self.accept('FishHit', self.fishCollision)
     toonSD = self.toonSDs[self.localAvId]
     toonSD.enter()
     toonSD.fsm.request('normal')
     toon = base.localAvatar
     toon.reparentTo(render)
     toon.setPos(-9, -1, 36)
     self.__placeToon(self.localAvId)
     self.arrowKeys = ArrowKeys.ArrowKeys()
     self.xVel = 0
     self.zVel = 0
     self.orientNode = toon.attachNewNode('orientNode')
     self.orientNode.setPos(0, 0, 1)
     self.orientNode2 = toon.attachNewNode('orientNode')
     self.orientNode2.setPos(0, 0, -1)
     self.environNode = render.attachNewNode('environNode')
     self.environModel.reparentTo(self.environNode)
     self.environModel.setScale(2.8, 2.8, 2.73)
     self.environModel.setPos(0, 0.5, -41)
     self.skyModel.setScale(1.3, 1.0, 1.0)
     boatoff = 6.75
     self.boatModel.reparentTo(self.environNode)
     self.boatModel.setPos(0, 3.0, 40 - boatoff)
     self.boatModel.setScale(2.8)
     cSphere = CollisionSphere(0.0, 0.0, 0.0 + 2.0, 3.0)
     cSphere.setTangible(0)
     name = 'boat'
     cSphereNode = CollisionNode(name)
     cSphereNode.setIntoCollideMask(DivingGameGlobals.CollideMask)
     cSphereNode.addSolid(cSphere)
     self.boatNode = cSphereNode
     self.boatCNP = self.boatModel.attachNewNode(cSphereNode)
     self.accept('reach-boat', self.__boatReached)
     self.boatTilt = Sequence(LerpFunc(self.boatModel.setR, duration=5, fromData=5, toData=-5, blendType='easeInOut', name='tilt'), LerpFunc(self.boatModel.setR, duration=5, fromData=-5, toData=5, blendType='easeInOut', name='tilt'))
     self.boatTilt.loop()
     self.mapScaleRatio = 40
     self.mapModel.reparentTo(base.a2dTopRight)
     self.mapModel.setScale(1.0 / self.mapScaleRatio)
     self.mapModel.setTransparency(1)
     self.mapModel.setPos(-0.22, 0.0, -1.30)
     self.mapModel.setColorScale(1, 1, 1, 0.7)
     self.mapModel.hide()
     if self.sndAmbience:
         self.sndAmbience.setLoop(True)
         self.sndAmbience.play()
         self.sndAmbience.setVolume(0.01)
     return