def startCustomEffects(self, interior=True, loadIslandMusic=False):
        if self.envEffects:
            self.envEffects.delete()
            self.envEffects = None
        if self.environment == 'Swamp':
            self.envEffects = SwampEffects.SwampEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=False)
            base.musicMgr.request(SoundGlobals.MUSIC_SWAMP,
                                  priority=1,
                                  volume=0.6)
        elif self.environment == 'Jungle':
            self.envEffects = ForestEffects.ForestEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=False)
            base.musicMgr.request(SoundGlobals.MUSIC_JUNGLE,
                                  priority=1,
                                  volume=0.6)
        elif self.environment == 'Cave':
            self.envEffects = CaveEffects.CaveEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=False)
            if self.uniqueId == LocationIds.RAVENS_COVE_MINE:
                base.musicMgr.request(SoundGlobals.getMainMusic(self.uniqueId),
                                      priority=1,
                                      volume=0.6)
            else:
                base.musicMgr.request(SoundGlobals.MUSIC_CAVE,
                                      priority=1,
                                      volume=0.6)
        elif self.uniqueId in ('1189479168.0sdnaik0', '1150922126.8akelts'):
            r = Reflection.getGlobalReflection()
            water = SeaPatch(self, reflection=r)
            water.loadSeaPatchFile('out.spf')
            self.water = water
            self.initializeIslandWaterParameters(self.geom)
        else:
            self.envEffects = EnvironmentEffects(self, self.modelPath)
            if interior:
                pass
        if loadIslandMusic:
            if not base.localAvatar.isInInvasion():
                base.musicMgr.requestFadeOut(SoundGlobals.MUSIC_TORMENTA)
                base.musicMgr.requestFadeOut(
                    SoundGlobals.MUSIC_TORMENTA_COMBAT)

            def getCurrentIslandMusic():
                priZeros = []
                for music in base.musicMgr.playlist:
                    if music.priority == 0:
                        priZeros.append(music)

                return priZeros

            def changeMusic(music, pri):
                for priZero in getCurrentIslandMusic():
                    base.musicMgr.requestFadeOut(priZero.name,
                                                 removeFromPlaylist=True)

                base.musicMgr.request(music, priority=0, volume=0.6)

            mainMusic = SoundGlobals.getMainMusic(self.uniqueId)
            altMusic = SoundGlobals.getAltMusic(self.uniqueId)
            if mainMusic and altMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=True)
                todMgr = base.cr.timeOfDayManager
                todMgr.addTimeOfDayToggle('Day-Night Area Music', 6.0, 20.0,
                                          changeMusic, [mainMusic, 0],
                                          changeMusic, [altMusic, 0])
            elif mainMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=True)
                base.musicMgr.request(mainMusic, volume=0.6)
            elif altMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist=True)
                base.musicMgr.request(altMusic, volume=0.6)
        self.builder.initEffects()
        return
 def setupWater(self):
     r = Reflection.getGlobalReflection()
     water = SeaPatch(self, reflection = r)
     water.loadSeaPatchFile('out.spf')
     self.water = water
Exemple #3
0
 def setupWater(self):
     r = Reflection.getGlobalReflection()
     water = SeaPatch(self, reflection=r)
     water.loadSeaPatchFile('out.spf')
     self.water = water
    def startCustomEffects(self, interior = True, loadIslandMusic = False):
        if self.envEffects:
            self.envEffects.delete()
            self.envEffects = None
        
        if self.environment == 'Swamp':
            self.envEffects = SwampEffects.SwampEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = False)
            base.musicMgr.request(SoundGlobals.MUSIC_SWAMP, priority = 1, volume = 0.59999999999999998)
        elif self.environment == 'Jungle':
            self.envEffects = ForestEffects.ForestEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = False)
            base.musicMgr.request(SoundGlobals.MUSIC_JUNGLE, priority = 1, volume = 0.59999999999999998)
        elif self.environment == 'Cave':
            self.envEffects = CaveEffects.CaveEffects(self, self.modelPath)
            base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = False)
            if self.uniqueId == LocationIds.RAVENS_COVE_MINE:
                base.musicMgr.request(SoundGlobals.getMainMusic(self.uniqueId), priority = 1, volume = 0.59999999999999998)
            else:
                base.musicMgr.request(SoundGlobals.MUSIC_CAVE, priority = 1, volume = 0.59999999999999998)
        elif self.uniqueId in ('1189479168.0sdnaik0', '1150922126.8akelts'):
            r = Reflection.getGlobalReflection()
            water = SeaPatch(self, reflection = r)
            water.loadSeaPatchFile('out.spf')
            self.water = water
            self.initializeIslandWaterParameters(self.geom)
        else:
            self.envEffects = EnvironmentEffects(self, self.modelPath)
            if interior:
                pass
            
        if loadIslandMusic:
            if not base.localAvatar.isInInvasion():
                base.musicMgr.requestFadeOut(SoundGlobals.MUSIC_TORMENTA)
                base.musicMgr.requestFadeOut(SoundGlobals.MUSIC_TORMENTA_COMBAT)
            
            
            def getCurrentIslandMusic():
                priZeros = []
                for music in base.musicMgr.playlist:
                    if music.priority == 0:
                        priZeros.append(music)
                        continue
                
                return priZeros

            
            def changeMusic(music, pri):
                for priZero in getCurrentIslandMusic():
                    base.musicMgr.requestFadeOut(priZero.name, removeFromPlaylist = True)
                
                base.musicMgr.request(music, priority = 0, volume = 0.59999999999999998)

            mainMusic = SoundGlobals.getMainMusic(self.uniqueId)
            altMusic = SoundGlobals.getAltMusic(self.uniqueId)
            if mainMusic and altMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = True)
                todMgr = base.cr.timeOfDayManager
                todMgr.addTimeOfDayToggle('Day-Night Area Music', 6.0, 20.0, changeMusic, [
                    mainMusic,
                    0], changeMusic, [
                    altMusic,
                    0])
            elif mainMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = True)
                base.musicMgr.request(mainMusic, volume = 0.59999999999999998)
            elif altMusic:
                base.musicMgr.requestCurMusicFadeOut(removeFromPlaylist = True)
                base.musicMgr.request(altMusic, volume = 0.59999999999999998)
            
        
        self.builder.initEffects()