コード例 #1
0
def createParticle(geom, pos, particleName, renderName):
    part = BattleParticles.loadParticleFile(particleName)
    part.setPos(*pos)
    partRender = geom.attachNewNode(renderName)
    partRender.setDepthWrite(2)
    partRender.setBin('fixed', 1)
    return (part, partRender)
コード例 #2
0
ファイル: TFSafeZoneLoader.py プロジェクト: abtechmg/rttim
 def loadConfetti(self):
     self.confetti = BattleParticles.loadParticleFile('confetti.ptf')
     self.confetti.setPos(0, 0, 5)
     self.confettiRender = self.geom.attachNewNode('snowRender')
     self.confettiRender.setDepthWrite(0)
     self.confettiRender.setBin('fixed', 1)
     self.confettiFade = None
コード例 #3
0
 def __init__(self, parent, smokeParent):
     NodePath.__init__(self)
     notify = DirectNotifyGlobal.directNotify.newCategory('RocketExplosionParticles')
     self.effectNode = parent.attachNewNode('RocketExplosion')
     self.effectNode.setBin('fixed', 1)
     self.effectNode.setDepthWrite(1)
     self.smokeEffectNode = smokeParent.attachNewNode('RocketSmoke')
     self.smokeEffectNode.setBin('fixed', 1)
     self.smokeEffectNode.setDepthWrite(0)
     self.effect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchFire.ptf')
     self.smokeEffect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchSmoke.ptf')
     ren = self.effect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_4/models/props/tt_m_efx_fireball', '**/*')
     ren = self.smokeEffect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_4/models/props/tt_m_efx_smoke', '**/*')
     self.endSeq = None
     self.cleanupCompleted = 0
コード例 #4
0
def createSnow(geom):
    snow = BattleParticles.loadParticleFile('snowdisk.ptf')
    snow.setPos(0, 0, 5)
    snowRender = geom.attachNewNode('snowRender')
    snowRender.setDepthWrite(0)
    snowRender.setBin('fixed', 1)

    return snow, snowRender
コード例 #5
0
 def load(self):
     SafeZoneLoader.SafeZoneLoader.load(self)
     self.windSound = map(base.loader.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg', 'phase_8/audio/sfx/SZ_TB_wind_2.ogg', 'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
コード例 #6
0
 def __init__(self, parent, smokeParent):
     NodePath.__init__(self)
     notify = DirectNotifyGlobal.directNotify.newCategory('RocketExplosionParticles')
     self.effectNode = parent.attachNewNode('RocketExplosion')
     self.effectNode.setBin('fixed', 1)
     self.effectNode.setDepthWrite(1)
     self.smokeEffectNode = smokeParent.attachNewNode('RocketSmoke')
     self.smokeEffectNode.setBin('fixed', 1)
     self.smokeEffectNode.setDepthWrite(0)
     self.effect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchFire.ptf')
     self.smokeEffect = BattleParticles.loadParticleFile('tt_p_efx_rocketLaunchSmoke.ptf')
     ren = self.effect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_4/models/props/tt_m_efx_fireball', '**/*')
     ren = self.smokeEffect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_4/models/props/tt_m_efx_smoke', '**/*')
     self.endSeq = None
     self.cleanupCompleted = 0
     return
コード例 #7
0
ファイル: BRSafeZoneLoader.py プロジェクト: nate97/src
 def load(self):
     SafeZoneLoader.SafeZoneLoader.load(self)
     self.windSound = map(base.loader.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_2.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
コード例 #8
0
ファイル: Sparks.py プロジェクト: n8x0b7T/Toontown-RTG
 def __init__(self, parent, renderParent):
     NodePath.__init__(self)
     notify = DirectNotifyGlobal.directNotify.newCategory('SparkParticles')
     self.renderParent = renderParent.attachNewNode('sparkRenderParent')
     self.renderParent.setBin('fixed', 0)
     self.renderParent.setDepthWrite(0)
     self.assign(parent.attachNewNode('sparks'))
     self.effect = BattleParticles.loadParticleFile('sparks.ptf')
     ren = self.effect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_6/models/karting/particleSpark', '**/*')
コード例 #9
0
ファイル: Sparks.py プロジェクト: BmanGames/ToontownStride
 def __init__(self, parent, renderParent):
     NodePath.__init__(self)
     notify = DirectNotifyGlobal.directNotify.newCategory('SparkParticles')
     self.renderParent = renderParent.attachNewNode('sparkRenderParent')
     self.renderParent.setBin('fixed', 0)
     self.renderParent.setDepthWrite(0)
     self.assign(parent.attachNewNode('sparks'))
     self.effect = BattleParticles.loadParticleFile('sparks.ptf')
     ren = self.effect.getParticlesNamed('particles-1').getRenderer()
     ren.setTextureFromNode('phase_6/models/karting/particleSpark', '**/*')
コード例 #10
0
 def load(self):
     SafeZoneLoader.SafeZoneLoader.load(self)
     self.wind1Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_1.mp3')
     self.wind2Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_2.mp3')
     self.wind3Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_3.mp3')
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
     self.snowFade = None
コード例 #11
0
 def load(self):
     SafeZoneLoader.SafeZoneLoader.load(self)
     self.wind1Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_1.mp3')
     self.wind2Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_2.mp3')
     self.wind3Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_3.mp3')
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)  # start the snow slightly above the camera
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
     self.snowFade = None
コード例 #12
0
 def enterRain(self, timestamp):
     taskMgr.doMethodLater(0.5, self.setSky, 'setSky', extraArgs=['rain'])
     self.rain = BattleParticles.loadParticleFile('raindisk.ptf')
     self.rain.setPos(0, 0, 20)
     self.rainRender = render.attachNewNode('rainRender')
     self.rainRender.setDepthWrite(0)
     self.rainRender.setBin('fixed', 1)
     self.rain.start(camera, self.rainRender)
     self.rainSound = base.loadSfx(
         'phase_12/audio/sfx/CHQ_rain_ambient.ogg')
     base.playSfx(self.rainSound, looping=1, volume=0.25)
     self.currentWeather = 0
コード例 #13
0
 def enterSnow(self, timestamp):
     self.rain = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.rain.setPos(0, 0, 20)
     self.rainRender = render.attachNewNode('rainRender')
     self.rainRender.setDepthWrite(0)
     self.rainRender.setBin('fixed', 1)
     self.rain.start(camera, self.rainRender)
     self.wind1Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_1.ogg')
     self.wind2Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_2.ogg')
     self.wind3Sound = base.loadSfx('phase_8/audio/sfx/SZ_TB_wind_3.ogg')
     taskMgr.add(self.snowWindSoundTask, 'snowWind')
     self.currentWeather = 0
コード例 #14
0
 def load(self, zoneId):
     TownLoader.TownLoader.load(self, zoneId)
     Suit.loadSuits(3)
     dnaFile = 'phase_8/dna/the_burrrgh_' + str(self.canonicalBranchZone) + '.pdna'
     self.createHood(dnaFile)
     self.windSound = map(base.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_2.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
コード例 #15
0
 def load(self, zoneId):
     TownLoader.TownLoader.load(self, zoneId)
     Suit.loadSuits(3)
     dnaFile = 'phase_8/dna/the_burrrgh_' + str(self.canonicalBranchZone) + '.pdna'
     self.createHood(dnaFile)
     self.windSound = map(base.loader.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_2.ogg',
                                         'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
     self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
     self.snow.setPos(0, 0, 5)
     self.snowRender = self.geom.attachNewNode('snowRender')
     self.snowRender.setDepthWrite(0)
     self.snowRender.setBin('fixed', 1)
コード例 #16
0
    def enter(self, requestStatus):
        self.fsm.enterInitialState()
        messenger.send('enterPlayground')
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)

        for i in self.loader.nodeList:
            self.loader.enterAnimatedProps(i)

        self._telemLimiter = TLGatherAllAvs('Playground', RotationLimitToH)

        def __lightDecorationOn__():
            geom = base.cr.playGame.hood.loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*christmas*')

            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(0)

        if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile:
            lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky), Func(__lightDecorationOn__))
            lightsOff.start()
        elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS) and self.loader.hood.snowySkyFile:
            lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.7, 0.7, 0.8, 1)), Func(self.loader.hood.startSnowySky), Func(__lightDecorationOn__))
            lightsOff.start()
            self.snowEvent = BattleParticles.loadParticleFile('snowdisk.ptf')
            self.snowEvent.setPos(0, 30, 10)
            self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode('snowRender')
            self.snowEventRender.setDepthWrite(2)
            self.snowEventRender.setBin('fixed', 1)
            self.snowEventFade = None
            self.snowEvent.start(camera, self.snowEventRender)
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()

        NametagGlobals.setMasterArrowsOn(1)
        self.zoneId = requestStatus['zoneId']
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList)
        how = requestStatus['how']
        if how == 'teleportIn':
            how = 'deathAck'
        self.fsm.request(how, [requestStatus])
コード例 #17
0
 def startRain(self):
     if not settings.get('want-particle-effects', True):
         return
     elif self.geom is None:
         return
     else:
         self.rain = BattleParticles.loadParticleFile('raindisk.ptf')
         self.rain.setPos(0, 0, 20)
         self.rainRender = self.geom.attachNewNode('rainRender')
         self.rainRender.setDepthWrite(0)
         self.rainRender.setBin('fixed', 1)
         self.rain.start(camera, self.rainRender)
         self.rainSound = base.loadSfx('phase_12/audio/sfx/CHQ_rain_ambient.ogg')
         base.playSfx(self.rainSound, looping=1, volume=0.25)
         return
コード例 #18
0
def doEffect(textId, speakingToon, nearbyToons):
    menuIndex, _ = decodeId(textId)
    itemValue = getItemValue(textId)
    if menuIndex == RESISTANCE_TOONUP:
        effect = BattleParticles.loadParticleFile('resistanceEffectSparkle.ptf')
        fadeColor = VBase4(1, 0.5, 1, 1)
    elif menuIndex == RESISTANCE_MONEY:
        effect = BattleParticles.loadParticleFile('resistanceEffectBean.ptf')
        bean = loader.loadModel('phase_4/models/props/jellybean4.bam')
        bean = bean.find('**/jellybean')
        colors = {
            'particles-1': (1, 1, 0, 1),
            'particles-2': (1, 0, 0, 1),
            'particles-3': (0, 1, 0, 1),
            'particles-4': (0, 0, 1, 1),
            'particles-5': (1, 0, 1, 1)
        }
        for name, color in colors.items():
            node = bean.copyTo(NodePath())
            node.setColorScale(*color)
            p = effect.getParticlesNamed(name)
            p.renderer.setGeomNode(node.node())
        fadeColor = VBase4(0, 1, 0, 1)
    elif menuIndex == RESISTANCE_RESTOCK:
        effect = BattleParticles.loadParticleFile('resistanceEffectSprite.ptf')
        invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
        invModel.setScale(4)
        invModel.flattenLight()
        icons = []
        if itemValue != -1:
            for item in xrange(6):
                iconName = ToontownBattleGlobals.AvPropsNew[itemValue][item]
                icons.append(invModel.find('**/%s' % iconName))
        else:
            tracks = range(7)
            random.shuffle(tracks)
            for i in xrange(6):
                track = tracks[i]
                item = random.randint(0, 5)
                iconName = ToontownBattleGlobals.AvPropsNew[track][item]
                icons.append(invModel.find('**/%s' % iconName))
        iconDict = {
            'particles-1': icons[0],
            'particles-2': icons[1],
            'particles-3': icons[2],
            'particles-4': icons[3],
            'particles-5': icons[4],
            'particles-6': icons[5]
        }
        for name, icon in iconDict.items():
            p = effect.getParticlesNamed(name)
            p.renderer.setFromNode(icon)
        fadeColor = VBase4(0, 0, 1, 1)
    elif menuIndex == RESISTANCE_DANCE:
        effect = BattleParticles.loadParticleFile('resistanceEffectSparkle.ptf')
        fadeColor = VBase4(1, 0.5, 1, 1)
        for toonId in nearbyToons:
            toon = base.cr.doId2do.get(toonId)
            if toon and (not toon.ghostMode):
                toon.setAnimState('victory')
    elif menuIndex == RESISTANCE_CHEESY:
        effect = BattleParticles.loadParticleFile('resistanceEffectSparkle.ptf')
        fadeColor = VBase4(1, 0.5, 1, 1)
    else:
        return
    recolorToons = Parallel()
    for toonId in nearbyToons:
        toon = base.cr.doId2do.get(toonId)
        if toon and (not toon.ghostMode):
            i = Sequence(
                toon.doToonColorScale(fadeColor, 0.3),
                toon.doToonColorScale(toon.defaultColorScale, 0.3),
                Func(toon.restoreDefaultColorScale)
            )
            recolorToons.append(i)
    i = Parallel(
        ParticleInterval(effect, speakingToon, worldRelative=0, duration=3, cleanup=True),
        Sequence(Wait(0.2), recolorToons),
        autoFinish=1
    )
    i.start()
コード例 #19
0
    def enter(self, requestStatus):
        self.fsm.enterInitialState()
        messenger.send('enterPlayground')
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        for i in self.loader.nodeList:
            self.loader.enterAnimatedProps(i)

        self._telemLimiter = TLGatherAllAvs('Playground', RotationLimitToH)

        def __lightDecorationOn__():
            geom = base.cr.playGame.hood.loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(0)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds
                    or ToontownGlobals.SPOOKY_COSTUMES
                    in holidayIds) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.55, 0.55, 0.65, 1)),
                    Func(self.loader.hood.startSpookySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds
                    or ToontownGlobals.WACKY_WINTER_DECORATIONS
                    in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.7, 0.7, 0.8, 1)),
                    Func(self.loader.hood.startSnowySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                self.snowEvent2 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode(
                    'snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(
                base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        NametagGlobals.setMasterArrowsOn(1)
        self.zoneId = requestStatus['zoneId']
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(
            self, self.loader.nodeList, self.zoneId)
        how = requestStatus['how']
        if how == 'teleportIn':
            how = 'deathAck'
        self.fsm.request(how, [requestStatus])
        return
コード例 #20
0
    def enter(self, requestStatus):
        self.fsm.enterInitialState()
        messenger.send('enterPlayground')
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        for i in self.loader.nodeList:
            self.loader.enterAnimatedProps(i)

        self._telemLimiter = TLGatherAllAvs('Playground', RotationLimitToH)

        def __lightDecorationOn__():
            geom = base.cr.playGame.hood.loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(0)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            #Halloween Event
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds
                    or ToontownGlobals.SPOOKY_COSTUMES
                    in holidayIds) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.55, 0.55, 0.65, 1)),
                    Func(self.loader.hood.startSpookySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            #Christmas Event
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds
                    or ToontownGlobals.WACKY_WINTER_DECORATIONS
                    in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.7, 0.7, 0.8, 1)),
                    Func(self.loader.hood.startSnowySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode(
                    'snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(
                base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        NametagGlobals.setWant2dNametags(True)
        self.zoneId = requestStatus['zoneId']
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(
            self, self.loader.nodeList, self.zoneId)
        how = requestStatus['how']
        if how == 'teleportIn':
            how = 'deathAck'
        self.fsm.request(how, [requestStatus])
        if base.config.GetBool('want-charity-screen', False):
            from toontown.events.CharityScreen import CharityScreen
            if self.zoneId in ([
                    ToontownGlobals.ToontownCentral,
                    ToontownGlobals.DonaldsDock, ToontownGlobals.DaisyGardens,
                    ToontownGlobals.MinniesMelodyland,
                    ToontownGlobals.TheBrrrgh, ToontownGlobals.DonaldsDreamland
            ]):
                self.screen = CharityScreen(base.cr)
                self.screen.start(self.zoneId)
コード例 #21
0
ファイル: Street.py プロジェクト: vincent15k/Toontown-House
    def enter(self, requestStatus, visibilityFlag = 1, arrowsOn = 1):
        teleportDebug(requestStatus, 'Street.enter(%s)' % (requestStatus,))
        self._ttfToken = None
        self.fsm.enterInitialState()
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        if visibilityFlag:
            self.visibilityOn()
        base.localAvatar.setGeom(self.loader.geom)
        base.localAvatar.setOnLevelGround(1)
        self._telemLimiter = TLGatherAllAvs('Street', RotationLimitToH)
        NametagGlobals.setMasterArrowsOn(arrowsOn)

        def __lightDecorationOn__():
            geom = base.cr.playGame.getPlace().loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(1)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            #Halloween Event
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            #Christmas Event
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.7, 0.7, 0.8, 1)), Func(self.loader.hood.startSnowySky), Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2 = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode('snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        
        # add street branch interest
        self.branchInterest = base.cr.addInterest(localAvatar.defaultShard, ZoneUtil.getBranchZone(requestStatus['zoneId']), "")
        
        self.enterZone(requestStatus['zoneId'])
        
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList, self.zoneId)
        self.fsm.request(requestStatus['how'], [requestStatus])
        self.replaceStreetSignTextures()
コード例 #22
0
    def enter(self, requestStatus, visibilityFlag=1, arrowsOn=1):
        teleportDebug(requestStatus, 'Street.enter(%s)' % (requestStatus, ))
        self._ttfToken = None
        self.fsm.enterInitialState()
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        if visibilityFlag:
            self.visibilityOn()
        base.localAvatar.setGeom(self.loader.geom)
        base.localAvatar.setOnLevelGround(1)
        self._telemLimiter = TLGatherAllAvs('Street', RotationLimitToH)
        NametagGlobals.setMasterArrowsOn(arrowsOn)
        self.zone = ZoneUtil.getBranchZone(requestStatus['zoneId'])

        def __lightDecorationOn__():
            try:
                geom = base.cr.playGame.getPlace().loader.geom
            except:
                loaderId = ZoneUtil.getBranchLoaderName(
                    2000)  # TEMP hack. This will port you to ttc if ^ fails
                whereId = ZoneUtil.getToonWhereName(200)
                how = 'teleportIn'
                print("This Should not happen.")
                requestStatus = [{
                    'loader': loaderId,
                    'where': whereId,
                    'how': how,
                    'hoodId': 2000,
                    'zoneId': 2000,
                    'shardId': None,
                    'avId': -1
                }]
                base.cr.playGame.getPlace().fsm.forceTransition(
                    'teleportOut', requestStatus)
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(1)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            #Halloween Event
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds
                    or ToontownGlobals.SPOOKY_COSTUMES
                    in holidayIds) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.55, 0.55, 0.65, 1)),
                    Func(self.loader.hood.startSpookySky))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            #Christmas Event
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds
                    or ToontownGlobals.WACKY_WINTER_DECORATIONS
                    in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.7, 0.7, 0.8, 1)),
                    Func(self.loader.hood.startSnowySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode(
                    'snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(
                base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        self.enterZone(requestStatus['zoneId'])
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(
            self, self.loader.nodeList, self.zoneId)
        self.fsm.request(requestStatus['how'], [requestStatus])
コード例 #23
0
    def getAnim(self, anim):
        # A low-level function to return an interval to play the
        # indicated animation, and update the internal state as if the
        # animation has been played.  This may be called by external
        # objects.
        ival = None
        if anim == None:
            # Neutral cycle
            partName = None

            if self.happy:
                animName = 'Ff_neutral'
            else:
                animName = 'Fb_neutral'

            if self.raised:
                # Play the animation on the whole boss.
                ival = ActorInterval(self, animName)
            else:
                # Play the animation on the upper part of the boss
                # only, and play the lowered animation on the legs.
                ival = Parallel(
                    ActorInterval(self, animName, partName=['torso', 'head']),
                    ActorInterval(self, 'Fb_downNeutral', partName='legs'))

            if not self.forward:
                ival = Sequence(Func(self.reverseBody), ival,
                                Func(self.forwardBody))

        elif anim == 'down2Up':
            ival = Parallel(SoundInterval(self.upSfx, node=self),
                            self.getAngryActorInterval('Fb_down2Up'))

            self.raised = 1

        elif anim == 'up2Down':
            # We fake this animation by playing down2Up backward.
            ival = Parallel(
                SoundInterval(self.downSfx, node=self),
                self.getAngryActorInterval('Fb_down2Up', playRate=-1))

            self.raised = 0

        elif anim == 'throw':
            self.doAnimate(None, raised=1, happy=0, queueNeutral=0)

            ival = Parallel(
                Sequence(SoundInterval(self.throwSfx, node=self), duration=0),
                self.getAngryActorInterval('Fb_UpThrow'))

        elif anim == 'hit':
            if self.raised:
                # Hits always knock us down.
                self.raised = 0
                ival = self.getAngryActorInterval('Fb_firstHit')
            else:
                ival = self.getAngryActorInterval('Fb_downHit')

            ival = Parallel(SoundInterval(self.reelSfx, node=self), ival)

        elif anim == 'ltSwing' or anim == 'rtSwing':
            self.doAnimate(None, raised=0, happy=0, queueNeutral=0)

            if anim == 'ltSwing':
                ival = Sequence(
                    Track((0, self.getAngryActorInterval('Fb_downLtSwing')),
                          (0.9, SoundInterval(self.swingSfx, node=self)),
                          (1, Func(self.bubbleL.unstash))),
                    Func(self.bubbleL.stash))
            else:
                ival = Sequence(
                    Track((0, self.getAngryActorInterval('Fb_downRtSwing')),
                          (0.9, SoundInterval(self.swingSfx, node=self)),
                          (1, Func(self.bubbleR.unstash))),
                    Func(self.bubbleR.stash))

        elif anim == 'frontAttack':
            # This is a bit hacky, and involves code defined in
            # DistributedSellbotBoss.py.
            self.doAnimate(None, raised=1, happy=0, queueNeutral=0)

            pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')

            # Keep the head reversed so we play the spin animation
            # with the sad face showing.
            ival = Sequence(Func(self.reverseHead),
                            ActorInterval(self, 'Bb2Ff_spin'),
                            Func(self.forwardHead))

            if self.forward:
                # The animation starts with the torso reversed; undo this.
                ival = Sequence(
                    Func(self.reverseBody),
                    ParallelEndTogether(
                        ival,
                        self.pelvis.hprInterval(0.5,
                                                self.pelvisForwardHpr,
                                                blendType='easeInOut')),
                )

            ival = Sequence(
                Track(
                    (0, ival),
                    (0, SoundInterval(self.spinSfx, node=self)),
                    (0.9,
                     Parallel(SoundInterval(self.rainGearsSfx, node=self),
                              ParticleInterval(pe,
                                               self.frontAttack,
                                               worldRelative=0,
                                               duration=1.5,
                                               cleanup=True),
                              duration=0)),
                    (1.9, Func(self.bubbleF.unstash)),
                ), Func(self.bubbleF.stash))
            self.forward = 1
            self.happy = 0
            self.raised = 1

        elif anim == 'areaAttack':
            # This is hacky too, just like above.
            if self.twoFaced:
                self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
            else:
                #RAU the lawbot is one faced
                self.doAnimate(None, raised=1, happy=1, queueNeutral=1)

            ival = Parallel(
                ActorInterval(self, 'Fb_jump'),
                Sequence(SoundInterval(self.swishSfx, duration=1.1, node=self),
                         SoundInterval(self.boomSfx, duration=1.9)),
                Sequence(Wait(1.21), Func(self.announceAreaAttack)))
            if self.twoFaced:
                self.happy = 0
            else:
                self.happy = 1

            self.raised = 1

        elif anim == 'Fb_fall':
            ival = Parallel(
                ActorInterval(self, 'Fb_fall'),
                Sequence(SoundInterval(self.reelSfx, node=self),
                         SoundInterval(self.deathSfx)))

        elif isinstance(anim, bytes):
            ival = ActorInterval(self, anim)

        else:
            # It must be an interval to play directly.
            ival = anim

        return ival
コード例 #24
0
ファイル: Playground.py プロジェクト: nate97/src
    def enter(self, requestStatus):
        self.fsm.enterInitialState()
        messenger.send('enterPlayground')
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        for i in self.loader.nodeList:
            self.loader.enterAnimatedProps(i)

        self._telemLimiter = TLGatherAllAvs('Playground', RotationLimitToH)

        def __lightDecorationOn__():
            geom = base.cr.playGame.hood.loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(0)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            #Halloween Event
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky), Func(__lightDecorationOn__))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            #Christmas Event
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.7, 0.7, 0.8, 1)), Func(self.loader.hood.startSnowySky), Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2 = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile('snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode('snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                #2 and 3 are only for the blizzard event and should be removed
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        NametagGlobals.setWant2dNametags(True)
        self.zoneId = requestStatus['zoneId']
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList, self.zoneId)
        how = requestStatus['how']
        if how == 'teleportIn':
            how = 'deathAck'
        self.fsm.request(how, [requestStatus])
コード例 #25
0
ファイル: BossCog.py プロジェクト: perpi06/ttoffline
 def getAnim(self, anim):
     ival = None
     if anim == None:
         partName = None
         if self.happy:
             animName = 'Ff_neutral'
         else:
             animName = 'Fb_neutral'
         if self.raised:
             ival = ActorInterval(self, animName)
         else:
             ival = Parallel(ActorInterval(self, animName, partName=['torso', 'head']), ActorInterval(self, 'Fb_downNeutral', partName='legs'))
         if not self.forward:
             ival = Sequence(Func(self.reverseBody), ival, Func(self.forwardBody))
     else:
         if anim == 'down2Up':
             ival = Parallel(SoundInterval(self.upSfx, node=self), self.getAngryActorInterval('Fb_down2Up'))
             self.raised = 1
         else:
             if anim == 'up2Down':
                 ival = Parallel(SoundInterval(self.downSfx, node=self), self.getAngryActorInterval('Fb_down2Up', playRate=-1))
                 self.raised = 0
             else:
                 if anim == 'throw':
                     self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
                     ival = Parallel(Sequence(SoundInterval(self.throwSfx, node=self), duration=0), self.getAngryActorInterval('Fb_UpThrow'))
                 else:
                     if anim == 'hit':
                         if self.raised:
                             self.raised = 0
                             ival = self.getAngryActorInterval('Fb_firstHit')
                         else:
                             ival = self.getAngryActorInterval('Fb_downHit')
                         ival = Parallel(SoundInterval(self.reelSfx, node=self), ival)
                     else:
                         if anim == 'ltSwing' or anim == 'rtSwing':
                             self.doAnimate(None, raised=0, happy=0, queueNeutral=0)
                             if anim == 'ltSwing':
                                 ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downLtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleL.unstash))), Func(self.bubbleL.stash))
                             else:
                                 ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downRtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleR.unstash))), Func(self.bubbleR.stash))
                         else:
                             if anim == 'frontAttack':
                                 self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
                                 pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
                                 ival = Sequence(Func(self.reverseHead), ActorInterval(self, 'Bb2Ff_spin'), Func(self.forwardHead))
                                 if self.forward:
                                     ival = Sequence(Func(self.reverseBody), ParallelEndTogether(ival, self.pelvis.hprInterval(0.5, self.pelvisForwardHpr, blendType='easeInOut')))
                                 ival = Sequence(Track((0, ival), (0, SoundInterval(self.spinSfx, node=self)), (0.9, Parallel(SoundInterval(self.rainGearsSfx, node=self), ParticleInterval(pe, self.frontAttack, worldRelative=0, duration=1.5, cleanup=True), duration=0)), (1.9, Func(self.bubbleF.unstash))), Func(self.bubbleF.stash))
                                 self.forward = 1
                                 self.happy = 0
                                 self.raised = 1
                             else:
                                 if anim == 'areaAttack':
                                     if self.twoFaced:
                                         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
                                     else:
                                         self.doAnimate(None, raised=1, happy=1, queueNeutral=1)
                                     ival = Parallel(ActorInterval(self, 'Fb_jump'), Sequence(SoundInterval(self.swishSfx, duration=1.1), SoundInterval(self.boomSfx, duration=1.9)), Sequence(Wait(1.21), Func(self.announceAreaAttack)))
                                     if self.twoFaced:
                                         self.happy = 0
                                     else:
                                         self.happy = 1
                                     self.raised = 1
                                 else:
                                     if anim == 'Fb_fall':
                                         ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), Wait(1.2), SoundInterval(self.deathSfx)))
                                     else:
                                         if anim == 'death':
                                             spinningSound = base.loader.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
                                             deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
                                             deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32))
                                             BattleParticles.loadParticles()
                                             smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
                                             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
                                             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
                                             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
                                             smallGears.setDepthWrite(False)
                                             smallGears.setScale(5)
                                             singleGear.setDepthWrite(False)
                                             singleGear.setScale(5)
                                             smallGearExplosion.setDepthWrite(False)
                                             smallGearExplosion.setScale(5)
                                             bigGearExplosion.setDepthWrite(False)
                                             bigGearExplosion.setScale(5)
                                             explosionTrack = Sequence()
                                             explosionTrack.append(Wait(5.4))
                                             explosionTrack.append(self.createKapowExplosionTrack(self))
                                             gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, self, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
                                             gears2MTrack = Track((0.0, explosionTrack), (
                                              0.7, ParticleInterval(singleGear, self, worldRelative=0, duration=5.7, cleanup=True)), (5.2,
                                              ParticleInterval(smallGearExplosion, self, worldRelative=0, duration=1.2, cleanup=True)), (
                                              5.4,
                                              ParticleInterval(bigGearExplosion, self, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
                                             ival = Parallel(Func(self.forwardHead), Sequence(ActorInterval(self, 'death', playRate=1.125), Func(self.getGeomNode().hide)), deathSoundTrack, gears1Track, gears2MTrack)
                                         else:
                                             if isinstance(anim, types.StringType):
                                                 ival = ActorInterval(self, anim)
                                             else:
                                                 ival = anim
     return ival
コード例 #26
0
    def enter(self, requestStatus, visibilityFlag=1, arrowsOn=1):
        teleportDebug(requestStatus, 'Street.enter(%s)' % (requestStatus, ))
        self._ttfToken = None
        self.fsm.enterInitialState()
        base.playMusic(self.loader.music, looping=1, volume=0.8)
        self.loader.geom.reparentTo(render)
        if visibilityFlag:
            self.visibilityOn()
        base.localAvatar.setGeom(self.loader.geom)
        base.localAvatar.setOnLevelGround(1)
        self._telemLimiter = TLGatherAllAvs('Street', RotationLimitToH)
        NametagGlobals.setMasterArrowsOn(arrowsOn)

        def __lightDecorationOn__():
            geom = base.cr.playGame.getPlace().loader.geom
            self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
            self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_snow_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/prop_tree*')
            self.loader.hood.eventLights += geom.findAllMatches(
                '**/*christmas*')
            for light in self.loader.hood.eventLights:
                light.setColorScaleOff(1)

        newsManager = base.cr.newsManager
        if newsManager:
            holidayIds = base.cr.newsManager.getDecorationHolidayId()
            if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds
                    or ToontownGlobals.SPOOKY_COSTUMES in holidayIds
                    or base.cr.newsManager.isHolidayRunning(
                        ToontownGlobals.HALLOWEEN)
                ) and self.loader.hood.spookySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.55, 0.55, 0.65, 1)),
                    Func(self.loader.hood.startSpookySky))
                lightsOff.start()
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
            if (ToontownGlobals.WINTER_DECORATIONS in holidayIds
                    or ToontownGlobals.WACKY_WINTER_DECORATIONS
                    in holidayIds) and self.loader.hood.snowySkyFile:
                lightsOff = Sequence(
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           0.1, Vec4(0.7, 0.7, 0.8, 1)),
                    Func(self.loader.hood.startSnowySky),
                    Func(__lightDecorationOn__))
                lightsOff.start()
                self.snowEvent = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent.setPos(0, 30, 10)
                self.snowEvent2 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent2.setPos(0, 10, 10)
                self.snowEvent3 = BattleParticles.loadParticleFile(
                    'snowdisk.ptf')
                self.snowEvent3.setPos(0, 20, 5)
                self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode(
                    'snowRender')
                self.snowEventRender.setDepthWrite(2)
                self.snowEventRender.setBin('fixed', 1)
                self.snowEventFade = None
                self.snowEvent.start(camera, self.snowEventRender)
                self.snowEvent2.start(camera, self.snowEventRender)
                self.snowEvent3.start(camera, self.snowEventRender)
            else:
                self.loader.hood.startSky()
                lightsOn = LerpColorScaleInterval(
                    base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
                lightsOn.start()
        else:
            self.loader.hood.startSky()
            lightsOn = LerpColorScaleInterval(
                base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
            lightsOn.start()
        self.accept('doorDoneEvent', self.handleDoorDoneEvent)
        self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
        self.enterZone(requestStatus['zoneId'])
        self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(
            self, self.loader.nodeList, self.zoneId)
        self.fsm.request(requestStatus['how'], [requestStatus])
        self.replaceStreetSignTextures()
        return
コード例 #27
0
ファイル: BossCog.py プロジェクト: CalmBit/ToonboxSource
 def getAnim(self, anim):
     ival = None
     if anim == None:
         partName = None
         if self.happy:
             animName = 'Ff_neutral'
         else:
             animName = 'Fb_neutral'
         if self.raised:
             ival = ActorInterval(self, animName)
         else:
             ival = Parallel(ActorInterval(self, animName, partName=['torso', 'head']), ActorInterval(self, 'Fb_downNeutral', partName='legs'))
         if not self.forward:
             ival = Sequence(Func(self.reverseBody), ival, Func(self.forwardBody))
     elif anim == 'down2Up':
         ival = Parallel(SoundInterval(self.upSfx, node=self), self.getAngryActorInterval('Fb_down2Up'))
         self.raised = 1
     elif anim == 'up2Down':
         ival = Parallel(SoundInterval(self.downSfx, node=self), self.getAngryActorInterval('Fb_down2Up', playRate=-1))
         self.raised = 0
     elif anim == 'throw':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         ival = Parallel(Sequence(SoundInterval(self.throwSfx, node=self), duration=0), self.getAngryActorInterval('Fb_UpThrow'))
     elif anim == 'hit':
         if self.raised:
             self.raised = 0
             ival = self.getAngryActorInterval('Fb_firstHit')
         else:
             ival = self.getAngryActorInterval('Fb_downHit')
         ival = Parallel(SoundInterval(self.reelSfx, node=self), ival)
     elif anim == 'ltSwing' or anim == 'rtSwing':
         self.doAnimate(None, raised=0, happy=0, queueNeutral=0)
         if anim == 'ltSwing':
             ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downLtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleL.unstash))), Func(self.bubbleL.stash))
         else:
             ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downRtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleR.unstash))), Func(self.bubbleR.stash))
     elif anim == 'frontAttack':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         ival = Sequence(Func(self.reverseHead), ActorInterval(self, 'Bb2Ff_spin'), Func(self.forwardHead))
         if self.forward:
             ival = Sequence(Func(self.reverseBody), ParallelEndTogether(ival, self.pelvis.hprInterval(0.5, self.pelvisForwardHpr, blendType='easeInOut')))
         ival = Sequence(Track((0, ival), (0, SoundInterval(self.spinSfx, node=self)), (0.9, Parallel(SoundInterval(self.rainGearsSfx, node=self), ParticleInterval(pe, self.frontAttack, worldRelative=0, duration=1.5, cleanup=True), duration=0)), (1.9, Func(self.bubbleF.unstash))), Func(self.bubbleF.stash))
         self.forward = 1
         self.happy = 0
         self.raised = 1
     elif anim == 'areaAttack':
         if self.twoFaced:
             self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         else:
             self.doAnimate(None, raised=1, happy=1, queueNeutral=1)
         ival = Parallel(ActorInterval(self, 'Fb_jump'), Sequence(SoundInterval(self.swishSfx, duration=1.1, node=self), SoundInterval(self.boomSfx, duration=1.9)), Sequence(Wait(1.21), Func(self.announceAreaAttack)))
         if self.twoFaced:
             self.happy = 0
         else:
             self.happy = 1
         self.raised = 1
     elif anim == 'Fb_fall':
         ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), SoundInterval(self.deathSfx)))
     elif isinstance(anim, types.StringType):
         ival = ActorInterval(self, anim)
     else:
         ival = anim
     return ival
コード例 #28
0
def doEffect(textId, speakingToon, nearbyToons):
    menuIndex, itemIndex = decodeId(textId)
    itemValue = getItemValue(textId)
    if menuIndex == RESISTANCE_TOONUP:
        effect = BattleParticles.loadParticleFile(
            'resistanceEffectSparkle.ptf')
        fadeColor = VBase4(1, 0.5, 1, 1)
    elif menuIndex == RESISTANCE_MONEY:
        effect = BattleParticles.loadParticleFile('resistanceEffectBean.ptf')
        bean = loader.loadModel('phase_4/models/props/jellybean4.bam')
        bean = bean.find('**/jellybean')
        colors = {
            'particles-1': (1, 1, 0, 1),
            'particles-2': (1, 0, 0, 1),
            'particles-3': (0, 1, 0, 1),
            'particles-4': (0, 0, 1, 1),
            'particles-5': (1, 0, 1, 1)
        }
        for name, color in colors.items():
            node = bean.copyTo(NodePath())
            node.setColorScale(*color)
            p = effect.getParticlesNamed(name)
            p.renderer.setGeomNode(node.node())

        fadeColor = VBase4(0, 1, 0, 1)
    elif menuIndex == RESISTANCE_RESTOCK:
        effect = BattleParticles.loadParticleFile('resistanceEffectSprite.ptf')
        invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
        invModel.setScale(4)
        invModel.flattenLight()
        icons = []
        if itemValue != -1:
            for item in xrange(6):
                iconName = ToontownBattleGlobals.AvPropsNew[itemValue][item]
                icons.append(invModel.find('**/%s' % iconName))

        else:
            tracks = range(7)
            random.shuffle(tracks)
            for i in xrange(6):
                track = tracks[i]
                item = random.randint(0, 5)
                iconName = ToontownBattleGlobals.AvPropsNew[track][item]
                icons.append(invModel.find('**/%s' % iconName))

        iconDict = {
            'particles-1': icons[0],
            'particles-2': icons[1],
            'particles-3': icons[2],
            'particles-4': icons[3],
            'particles-5': icons[4],
            'particles-6': icons[5]
        }
        for name, icon in iconDict.items():
            p = effect.getParticlesNamed(name)
            p.renderer.setFromNode(icon)

        fadeColor = VBase4(0, 0, 1, 1)
    else:
        return
    recolorToons = Parallel()
    for toonId in nearbyToons:
        toon = base.cr.doId2do.get(toonId)
        if toon and not toon.ghostMode:
            i = Sequence(toon.doToonColorScale(fadeColor, 0.3),
                         toon.doToonColorScale(toon.defaultColorScale, 0.3),
                         Func(toon.restoreDefaultColorScale))
            recolorToons.append(i)

    i = Parallel(ParticleInterval(effect,
                                  speakingToon,
                                  worldRelative=0,
                                  duration=3,
                                  cleanup=True),
                 Sequence(Wait(0.2), recolorToons),
                 autoFinish=1)
    i.start()
コード例 #29
0
 def getAnim(self, anim):
     ival = None
     if anim == None:
         partName = None
         if self.happy:
             animName = 'Ff_neutral'
         else:
             animName = 'Fb_neutral'
         if self.raised:
             ival = ActorInterval(self, animName)
         else:
             ival = Parallel(
                 ActorInterval(self, animName, partName=['torso', 'head']),
                 ActorInterval(self, 'Fb_downNeutral', partName='legs'))
         if not self.forward:
             ival = Sequence(Func(self.reverseBody), ival,
                             Func(self.forwardBody))
     elif anim == 'down2Up':
         ival = Parallel(SoundInterval(self.upSfx, node=self),
                         self.getAngryActorInterval('Fb_down2Up'))
         self.raised = 1
     elif anim == 'up2Down':
         ival = Parallel(
             SoundInterval(self.downSfx, node=self),
             self.getAngryActorInterval('Fb_down2Up', playRate=-1))
         self.raised = 0
     elif anim == 'throw':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         ival = Parallel(
             Sequence(SoundInterval(self.throwSfx, node=self), duration=0),
             self.getAngryActorInterval('Fb_UpThrow'))
     elif anim == 'hit':
         if self.raised:
             self.raised = 0
             ival = self.getAngryActorInterval('Fb_firstHit')
         else:
             ival = self.getAngryActorInterval('Fb_downHit')
         ival = Parallel(SoundInterval(self.reelSfx, node=self), ival)
     elif anim == 'ltSwing' or anim == 'rtSwing':
         self.doAnimate(None, raised=0, happy=0, queueNeutral=0)
         if anim == 'ltSwing':
             ival = Sequence(
                 Track((0, self.getAngryActorInterval('Fb_downLtSwing')),
                       (0.9, SoundInterval(self.swingSfx, node=self)),
                       (1, Func(self.bubbleL.unstash))),
                 Func(self.bubbleL.stash))
         else:
             ival = Sequence(
                 Track((0, self.getAngryActorInterval('Fb_downRtSwing')),
                       (0.9, SoundInterval(self.swingSfx, node=self)),
                       (1, Func(self.bubbleR.unstash))),
                 Func(self.bubbleR.stash))
     elif anim == 'frontAttack':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         ival = Sequence(Func(self.reverseHead),
                         ActorInterval(self, 'Bb2Ff_spin'),
                         Func(self.forwardHead))
         if self.forward:
             ival = Sequence(
                 Func(self.reverseBody),
                 ParallelEndTogether(
                     ival,
                     self.pelvis.hprInterval(0.5,
                                             self.pelvisForwardHpr,
                                             blendType='easeInOut')))
         ival = Sequence(
             Track((0, ival),
                   (0,
                    Sequence(
                        Func(self.setChatAbsolute,
                             random.choice(TTLocalizer.VPSpinMessages),
                             CFSpeech | CFTimeout),
                        SoundInterval(self.spinSfx, node=self))),
                   (0.9,
                    Parallel(SoundInterval(self.rainGearsSfx, node=self),
                             ParticleInterval(pe,
                                              self.frontAttack,
                                              worldRelative=0,
                                              duration=1.5,
                                              cleanup=True),
                             duration=0)),
                   (1.9, Func(self.bubbleF.unstash))),
             Func(self.bubbleF.stash))
         self.forward = 1
         self.happy = 0
         self.raised = 1
     elif anim == 'areaAttack':
         if self.twoFaced:
             self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         else:
             self.doAnimate(None, raised=1, happy=1, queueNeutral=1)
         ival = Sequence()
         if self.dna.dept == 'm':
             ival.append(Func(self.loop, 'Ff_neutral'))
             ival.append(
                 Parallel(
                     SoundInterval(self.warningSfx, node=self, volume=2.0),
                     Wait(3.0)))
         ival.append(
             Parallel(
                 ActorInterval(self, 'Fb_jump'),
                 Sequence(
                     Func(
                         self.setChatAbsolute,
                         random.choice(
                             TTLocalizer.JumpBossTaunts[self.dna.dept]),
                         CFSpeech | CFTimeout),
                     SoundInterval(self.swishSfx, duration=1.1, node=self),
                     SoundInterval(self.boomSfx, duration=1.9)),
                 Sequence(Wait(1.21), Func(self.announceAreaAttack))))
         if self.twoFaced:
             self.happy = 0
         else:
             self.happy = 1
         self.raised = 1
     elif anim == 'Fb_fall':
         ival = Parallel(
             ActorInterval(self, 'Fb_fall'),
             Sequence(SoundInterval(self.reelSfx, node=self),
                      SoundInterval(self.deathSfx)))
     elif isinstance(anim, types.StringType):
         ival = ActorInterval(self, anim)
     else:
         ival = anim
     return ival
コード例 #30
0
 def getAnim(self, anim):
     ival = None
     if anim == None:
         partName = None
         if self.happy:
             animName = 'Ff_neutral'
         else:
             animName = 'Fb_neutral'
         if self.raised:
             ival = ActorInterval(self, animName)
         else:
             ival = Parallel(
                 ActorInterval(self, animName, partName=['torso', 'head']),
                 ActorInterval(self, 'Fb_downNeutral', partName='legs'))
         if not self.forward:
             ival = Sequence(Func(self.reverseBody), ival,
                             Func(self.forwardBody))
     elif anim == 'down2Up':
         ival = Parallel(SoundInterval(self.upSfx, node=self),
                         self.getAngryActorInterval('Fb_down2Up'))
         self.raised = 1
     elif anim == 'up2Down':
         ival = Parallel(
             SoundInterval(self.downSfx, node=self),
             self.getAngryActorInterval('Fb_down2Up', playRate=-1))
         self.raised = 0
     elif anim == 'throw':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         ival = Parallel(
             Sequence(SoundInterval(self.throwSfx, node=self), duration=0),
             self.getAngryActorInterval('Fb_UpThrow'))
     elif anim == 'hit':
         if self.raised:
             self.raised = 0
             ival = self.getAngryActorInterval('Fb_firstHit')
         else:
             ival = self.getAngryActorInterval('Fb_downHit')
         ival = Parallel(SoundInterval(self.reelSfx, node=self), ival)
     elif anim == 'ltSwing' or anim == 'rtSwing':
         self.doAnimate(None, raised=0, happy=0, queueNeutral=0)
         if anim == 'ltSwing':
             ival = Sequence(
                 Track((0, self.getAngryActorInterval('Fb_downLtSwing')),
                       (0.9, SoundInterval(self.swingSfx, node=self)),
                       (1, Func(self.bubbleL.unstash))),
                 Func(self.bubbleL.stash))
         else:
             ival = Sequence(
                 Track((0, self.getAngryActorInterval('Fb_downRtSwing')),
                       (0.9, SoundInterval(self.swingSfx, node=self)),
                       (1, Func(self.bubbleR.unstash))),
                 Func(self.bubbleR.stash))
     elif anim == 'frontAttack':
         self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         pe2 = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         pe3 = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         pe4 = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf')
         pe2.setH(180)
         pe3.setH(90)
         pe4.setH(270)
         ival = Sequence(Func(self.reverseHead),
                         ActorInterval(self, 'Bb2Ff_spin'),
                         Func(self.forwardHead))
         if self.forward:
             ival = Sequence(
                 Func(self.reverseBody),
                 ParallelEndTogether(
                     ival,
                     self.pelvis.hprInterval(0.5,
                                             self.pelvisForwardHpr,
                                             blendType='easeInOut')))
         ival = Sequence(
             Track((0, ival),
                   (0, Sequence(SoundInterval(self.spinSfx, node=self))),
                   (1.3,
                    Parallel(SoundInterval(self.rainGearsSfx, node=self),
                             ParticleInterval(pe4,
                                              self.leftAttack,
                                              worldRelative=0,
                                              duration=1.5,
                                              cleanup=True),
                             ParticleInterval(pe3,
                                              self.rightAttack,
                                              worldRelative=0,
                                              duration=1.5,
                                              cleanup=True),
                             ParticleInterval(pe2,
                                              self.backAttack,
                                              worldRelative=0,
                                              duration=1.5,
                                              cleanup=True),
                             ParticleInterval(pe,
                                              self.frontAttack,
                                              worldRelative=0,
                                              duration=1.5,
                                              cleanup=True),
                             duration=0)),
                   (1.9, Func(self.bubbleF.unstash)),
                   (1.9, Func(self.bubbleFL.unstash)),
                   (1.9, Func(self.bubbleFR.unstash)),
                   (1.9, Func(self.bubbleB.unstash))),
             Func(self.bubbleF.stash), Func(self.bubbleFL.stash),
             Func(self.bubbleFR.stash), Func(self.bubbleB.stash))
         self.forward = 1
         self.happy = 0
         self.raised = 1
     elif anim == 'areaAttack':
         if self.twoFaced:
             self.doAnimate(None, raised=1, happy=0, queueNeutral=0)
         else:
             self.doAnimate(None, raised=1, happy=1, queueNeutral=1)
         ival = Parallel(
             ActorInterval(self, 'Fb_jump'),
             Sequence(SoundInterval(self.swishSfx, duration=1.1, node=self),
                      SoundInterval(self.boomSfx, duration=1.9)),
             Sequence(Wait(1.21), Func(self.announceAreaAttack), Wait(0.1),
                      Func(self.announceAreaAttack), Wait(0.1),
                      Func(self.announceAreaAttack), Wait(0.1),
                      Func(self.announceAreaAttack), Wait(0.1),
                      Func(self.announceAreaAttack), Wait(0.1)))
         if self.twoFaced:
             self.happy = 0
         else:
             self.happy = 1
         self.raised = 1
     elif anim == 'Fb_fall':
         ival = Parallel(
             ActorInterval(self, 'Fb_fall'),
             Sequence(SoundInterval(self.reelSfx, node=self),
                      SoundInterval(self.deathSfx)))
     elif isinstance(anim, types.StringType):
         ival = ActorInterval(self, anim)
     else:
         ival = anim
     return ival
コード例 #31
0
def doEffect(textId, speakingToon, nearbyToons):
    (menuIndex, itemIndex) = decodeId(textId)
    itemValue = getItemValue(textId)
    if menuIndex == RESISTANCE_TOONUP:
        effect = BattleParticles.loadParticleFile("resistanceEffectSparkle.ptf")
        fadeColor = VBase4(1, 0.5, 1, 1)
    elif menuIndex == RESISTANCE_MONEY:
        effect = BattleParticles.loadParticleFile("resistanceEffectBean.ptf")
        bean = loader.loadModel("phase_4/models/props/jellybean4.bam")
        bean = bean.find("**/jellybean")
        colors = {
            "particles-1": (1, 1, 0, 1),
            "particles-2": (1, 0, 0, 1),
            "particles-3": (0, 1, 0, 1),
            "particles-4": (0, 0, 1, 1),
            "particles-5": (1, 0, 1, 1),
        }
        for (name, color) in colors.items():
            node = bean.copyTo(NodePath())
            node.setColorScale(*color)
            p = effect.getParticlesNamed(name)
            p.renderer.setGeomNode(node.node())

        fadeColor = VBase4(0, 1, 0, 1)
    elif menuIndex == RESISTANCE_RESTOCK:
        effect = BattleParticles.loadParticleFile("resistanceEffectSprite.ptf")
        invModel = loader.loadModel("phase_3.5/models/gui/inventory_icons")
        invModel.setScale(4)
        invModel.flattenLight()
        icons = []
        if itemValue != -1:
            for item in range(6):
                iconName = ToontownBattleGlobals.AvPropsNew[itemValue][item]
                icons.append(invModel.find("**/%s" % iconName))

        else:
            tracks = range(7)
            random.shuffle(tracks)
            for i in range(6):
                track = tracks[i]
                item = random.randint(0, 5)
                iconName = ToontownBattleGlobals.AvPropsNew[track][item]
                icons.append(invModel.find("**/%s" % iconName))

        iconDict = {
            "particles-1": icons[0],
            "particles-2": icons[1],
            "particles-3": icons[2],
            "particles-4": icons[3],
            "particles-5": icons[4],
            "particles-6": icons[5],
        }
        for (name, icon) in iconDict.items():
            p = effect.getParticlesNamed(name)
            p.renderer.setFromNode(icon)

        fadeColor = VBase4(0, 0, 1, 1)
    else:
        return None
    recolorToons = Parallel()
    for toonId in nearbyToons:
        toon = base.cr.doId2do.get(toonId)
        if toon and not (toon.ghostMode):
            i = Sequence(
                toon.doToonColorScale(fadeColor, 0.29999999999999999),
                toon.doToonColorScale(toon.defaultColorScale, 0.29999999999999999),
                Func(toon.restoreDefaultColorScale),
            )
            recolorToons.append(i)
            continue

    i = Parallel(
        ParticleInterval(effect, speakingToon, worldRelative=0, duration=3, cleanup=True),
        Sequence(Wait(0.20000000000000001), recolorToons),
        autoFinish=1,
    )
    i.start()