示例#1
0
 def unload(self):
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     self.hood.dnaStore.resetSuitPoints()
     self.hood.dnaStore.resetBattleCells()
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.nodeToZone
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     cleanupDialog('globalDialog')
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
示例#2
0
def createGoonExplosion(parent, explosionPoint, scale):
    BattleParticles.loadParticles()

    deathNode = NodePath('goonDeath')
    deathNode.setPos(explosionPoint)

    explosion = createExplosionTrack(parent, deathNode, scale)
    smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion',
                                                              numParticles=10)
    bigGearExplosion = BattleParticles.createParticleEffect(
        'WideGearExplosion', numParticles=30)
    deathSound = base.loadSfx("phase_3.5/audio/sfx/ENC_cogfall_apart.mp3")
    return Parallel(explosion,
                    SoundInterval(deathSound),
                    ParticleInterval(smallGearExplosion,
                                     deathNode,
                                     worldRelative=0,
                                     duration=4.3,
                                     cleanup=True),
                    ParticleInterval(bigGearExplosion,
                                     deathNode,
                                     worldRelative=0,
                                     duration=1.0,
                                     cleanup=True),
                    name='gears2MTrack')
示例#3
0
 def destroy(self):
     if self.isDestroyed:
         return
     self.isDestroyed = True
     if hasattr(self.suit, 'prop') and self.suit.prop:
         self.suit.prop.stash()
     if self.propTrack:
         self.propTrack.finish()
         self.propTrack = None
     if self.suitSound:
         self.suitSound.stop()
         del self.suitSound
     if self.animTrack:
         self.animTrack.finish()
         self.animTrack = None
     if self.shotTrack != None:
         self.shotTrack.finish()
         self.shotTrack = None
     if self.deathTrack != None:
         self.deathTrack.finish()
         self.deathTrack = None
     if self.deathSuit:
         self.deathSuit.detachNode()
         self.suit.cleanupLoseActor()
         self.deathSuit = None
     if self.moveIval:
         self.moveIval.pause()
         del self.moveIval
     if self.suit:
         self.suit.delete()
         self.suit = None
     BattleParticles.unloadParticles()
     self.ignore(self.game.uniqueName('enter' + self.suitName))
     self.game = None
     self.enemyMgr = None
示例#4
0
def __doSprinkle(attack, recipients, hp = 0):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    if toon == None:
        return
    targets = attack[recipients]
    level = 4
    battle = attack['battle']
    track = Sequence(teleportIn(attack, toon))

    def face90(target, toon, battle):
        vec = Point3(target.getPos(battle) - toon.getPos(battle))
        vec.setZ(0)
        temp = vec[0]
        vec.setX(-vec[1])
        vec.setY(temp)
        targetPoint = Point3(toon.getPos(battle) + vec)
        toon.headsUp(battle, targetPoint)

    delay = 2.5
    effectTrack = Sequence()
    for target in targets:
        sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
        dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
        explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
        poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
        wallEffect = BattleParticles.createParticleEffect(file='pixieWall')
        mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=3.1, node=toon), Sequence(Func(face90, target, toon, battle), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp)))
        effectTrack.append(mtrack)

    track.append(effectTrack)
    track.append(Func(toon.setHpr, Vec3(180.0, 0.0, 0.0)))
    track.append(teleportOut(attack, toon))
    return track
示例#5
0
 def __init__(self,
              serialNum,
              maze,
              randomNumGen,
              difficulty,
              startTile,
              cogdoSuitType,
              walkAnimName=None):
     data = Globals.SuitData[cogdoSuitType]
     MazeSuit.__init__(
         self,
         serialNum,
         maze,
         randomNumGen,
         data['cellWalkPeriod'],
         difficulty,
         data['dnaName'],
         startTile=startTile,
         walkSameDirectionProb=Globals.SuitWalkSameDirectionProb,
         walkTurnAroundProb=Globals.SuitWalkTurnAroundProb,
         uniqueRandomNumGen=False,
         walkAnimName=walkAnimName)
     FSM.__init__(self, 'CogdoMazeSuit')
     CogdoMazeSplattable.__init__(
         self, self.suit,
         '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
     if data.has_key('scale'):
         self.suit.setScale(data['scale'])
     self.hp = data['hp']
     self.type = cogdoSuitType
     self.memos = data['memos']
     self.deathSuit = self.suit.getLoseActor()
     self.deathSuit.pose('lose', 0)
     BattleParticles.loadParticles()
     self._initSfx()
示例#6
0
def __healSprinkle(heal, hasInteractivePropHealBonus):
    toon = heal['toon']
    target = heal['target']['toon']
    hp = heal['target']['hp']
    ineffective = heal['sidestep']
    level = heal['level']
    track = Sequence(__runToHealSpot(heal))
    sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
    dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
    explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
    poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
    wallEffect = BattleParticles.createParticleEffect(file='pixieWall')

    def face90(toon = toon, target = target):
        vec = Point3(target.getPos() - toon.getPos())
        vec.setZ(0)
        temp = vec[0]
        vec.setX(-vec[1])
        vec.setY(temp)
        targetPoint = Point3(toon.getPos() + vec)
        toon.headsUp(render, targetPoint)

    delay = 2.5
    mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=4.1, node=toon), Sequence(Func(face90), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus)))
    track.append(mtrack)
    track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
def createGoonExplosion(parent, explosionPoint, scale):
    BattleParticles.loadParticles()
    deathNode = NodePath('goonDeath')
    deathNode.setPos(explosionPoint)
    explosion = createExplosionTrack(parent, deathNode, scale)
    smallGearExplosion = BattleParticles.createParticleEffect(
        'GearExplosion', numParticles=10)
    bigGearExplosion = BattleParticles.createParticleEffect(
        'WideGearExplosion', numParticles=30)
    deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
    return Parallel(
        explosion,
        SoundInterval(deathSound),
        ParticleInterval(
            smallGearExplosion,
            deathNode,
            worldRelative=0,
            duration=4.3,
            cleanup=True),
        ParticleInterval(
            bigGearExplosion,
            deathNode,
            worldRelative=0,
            duration=1.0,
            cleanup=True),
        name='gears2MTrack')
 def unload(self):
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     self.hood.dnaStore.resetSuitPoints()
     self.hood.dnaStore.resetBattleCells()
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     cleanupDialog('globalDialog')
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
示例#9
0
    def makeSynergyTrack(self):
        particleEffect = BattleParticles.createParticleEffect('Synergy')
        waterfallEffect = BattleParticles.createParticleEffect(
            file='synergyWaterfall')
        soundTrack = Sequence(
            Wait(0.9), SoundInterval(self.synergySfx, node=self.virtualSuit))
        track = Sequence(
            Parallel(
                ActorInterval(self.virtualSuit, 'magic3'),
                Track(
                    (0.0, Func(self.sayFaceoffTaunt)),
                    (0.1,
                     ParticleInterval(waterfallEffect,
                                      self.virtualSuit,
                                      worldRelative=0,
                                      duration=1.9,
                                      cleanup=True)),
                    (0.2,
                     ParticleInterval(particleEffect,
                                      self.virtualSuit,
                                      worldRelative=0,
                                      duration=1.9,
                                      cleanup=True)),
                    (0.5, Func(self.synergyColl.unstash)),
                ), soundTrack),
            Func(self.synergyColl.stash),
            Func(self.virtualSuit.setHpr, 0, 0, 0),
            Func(self.virtualSuit.loop, 'walk', 0),
        )

        return track
 def __init__(self, serialNum, maze, randomNumGen, difficulty, startTile, cogdoSuitType, walkAnimName = None):
     data = Globals.SuitData[cogdoSuitType]
     MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName)
     FSM.__init__(self, 'CogdoMazeSuit')
     CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
     if data.has_key('scale'):
         self.suit.setScale(data['scale'])
     self.hp = data['hp']
     self.type = cogdoSuitType
     self.memos = data['memos']
     self.deathSuit = self.suit.getLoseActor()
     self.deathSuit.pose('lose', 0)
     BattleParticles.loadParticles()
     self._initSfx()
示例#11
0
    def enterFinaleBrainstormAttack(self, offset):
        if Vec3(base.localAvatar.getPos(self)).length() <= 40:
            # Currently, the cloud only forms over the local toon.
            # Preferably it would form over all toons in the area, but I'm not sure how to go about doing that.
            # That may not be good for performance either.
            braincloud = BattleProps.globalPropPool.getProp('stormcloud')
            braincloud.reparentTo(base.localAvatar)
            braincloud.setScale(0)
            braincloud.setZ(6)
            brainstorm = BattleParticles.createParticleEffect(name='BrainStorm')
            brainstorm.setDepthWrite(False)

            def __checkNearCloud(task):
                if Vec3(base.localAvatar.getPos(braincloud)).length() <= 5:
                    self.applyShakeAttack(base.localAvatar, SafezoneInvasionGlobals.FinaleSuitAttackDamage)

            self.finaleBrainstormSequence = Sequence(
                braincloud.scaleInterval(3, (3.5, 3.5, 2.5)),
                Parallel(
                    Func(base.playSfx, self.brainstormSfx),
                    Func(braincloud.wrtReparentTo, render),
                    ParticleInterval(brainstorm, braincloud, worldRelative=0, duration=4.3, cleanup=True)
                ),
                Wait(1),
                braincloud.scaleInterval(1, (0.0, 0.0, 0.0)),
            )
            taskMgr.doMethodLater(4, __checkNearCloud, 'CheckNearBraincloud')
            self.finaleBrainstormSequence.setT(offset)
            self.finaleBrainstormSequence.start()

        self.play('effort')
示例#12
0
 def __init__(self, parent=hidden, wantParticles=1):
     """__init()"""
     # Initialize the superclass
     NodePath.__init__(self, parent)
     # Create a toplevel node to hold splash effects
     self.assign(parent.attachNewNode('splash'))
     # Load up a copy of the splash actor
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     # Adjust transparency of splash to use MBinary
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     # Add in a ripple effect
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     # Add some particles
     self.wantParticles = wantParticles
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     # Track for playing back splash effect
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     # Start out hidden
     self.hide()
示例#13
0
 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
def __createToonInterval(sound, delay, toon, operaInstrument = None):
    isNPC = 0
    if sound.get('npc'):
        isNPC = 1
    battle = sound['battle']
    hasLuredSuits = __hasLuredSuits(sound)
    if not isNPC:
        oldPos, oldHpr = battle.getActorPosHpr(toon)
        newPos = Point3(oldPos)
        newPos.setY(newPos.getY() - DISTANCE_TO_WALK_BACK)
    retval = Sequence(Wait(delay))
    if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC:
        retval.append(Parallel(ActorInterval(toon, 'walk', startTime=1, duration=TIME_TO_WALK_BACK, endTime=0.0001), LerpPosInterval(toon, TIME_TO_WALK_BACK, newPos, other=battle)))
    if operaInstrument:
        sprayEffect = BattleParticles.createParticleEffect(file='soundWave')
        sprayEffect.setDepthWrite(0)
        sprayEffect.setDepthTest(0)
        sprayEffect.setTwoSided(1)
        I1 = 2.8
        retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=0.0, endTime=I1))
        retval.append(Func(setPosFromOther, sprayEffect, operaInstrument, Point3(0, 1.6, -0.18)))
        retval.append(__getPartTrack(sprayEffect, 0.0, 6.0, [sprayEffect, toon, 0], softStop=-3.5))
        retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=I1))
    else:
        retval.append(ActorInterval(toon, 'sound'))
    if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC:
        retval.append(Parallel(ActorInterval(toon, 'walk', startTime=0.0001, duration=TIME_TO_WALK_BACK, endTime=1), LerpPosInterval(toon, TIME_TO_WALK_BACK, oldPos, other=battle)))
    retval.append(Func(toon.loop, 'neutral'))
    return retval
示例#15
0
 def __init__(self, model, pos, serialNum, gameId, penalty = False):
     self.serialNum = serialNum
     self.penalty = penalty
     center = model.getBounds().getCenter()
     center = Point3(0, 0, 0)
     self.nodePath = model.copyTo(render)
     self.nodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
     self.nodePath.setZ(0)
     self.notify.debug('newPos = %s' % self.nodePath.getPos())
     if self.penalty:
         self.sphereName = 'penaltySphere-%s-%s' % (gameId, self.serialNum)
     else:
         self.sphereName = 'treasureSphere-%s-%s' % (gameId, self.serialNum)
     self.collSphere = CollisionSphere(center[0], center[1], center[2], self.RADIUS)
     self.collSphere.setTangible(0)
     self.collNode = CollisionNode(self.sphereName)
     self.collNode.setIntoCollideMask(ToontownGlobals.PieBitmask)
     self.collNode.addSolid(self.collSphere)
     self.collNodePath = render.attachNewNode(self.collNode)
     self.collNodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
     self.collNodePath.hide()
     self.track = None
     if self.penalty:
         self.tip = self.nodePath.find('**/fusetip')
         sparks = BattleParticles.createParticleEffect(file = 'icetnt')
         self.sparksEffect = sparks
         sparks.start(self.tip)
         self.penaltyGrabSound = loader.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.mp3')
         self.penaltyGrabSound.setVolume(0.75)
         kaboomAttachPoint = self.nodePath.attachNewNode('kaboomAttach')
         kaboomAttachPoint.setZ(3)
         self.kaboom = loader.loadModel('phase_4/models/minigames/ice_game_kaboom')
         self.kaboom.reparentTo(kaboomAttachPoint)
         self.kaboom.setScale(2.0)
         self.kaboom.setBillboardPointEye()
示例#16
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)
示例#17
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
示例#18
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)
 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
 def setHillType(self, type):
     if self.isUp:
         if (self.hillType == MoleFieldBase.HILL_MOLE or type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB) and type == MoleFieldBase.HILL_MOLE:
             return None
         
     self.hillType = type
     self.moleHead.remove()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles = 1)
             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles = 10)
             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles = 30)
             gears2MTrack = Track((0.0, ParticleInterval(singleGear, self.hill, worldRelative = 1, duration = 5.7000000000000002, cleanup = True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative = 0, duration = 1.2, cleanup = True)), (0.29999999999999999, ParticleInterval(bigGearExplosion, self.hill, worldRelative = 0, duration = 1.0, cleanup = True)), name = 'gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.23000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.28000000000000003)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.34999999999999998, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28000000000000003, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.32000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.47999999999999998)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28999999999999998, 0.0)))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         
         if self.downIval:
             self.downIval.finish()
         
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.14999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.14999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17000000000000001)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.0))), Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5), LerpScaleInterval(self.moleHead, 0.5, 1.0))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     
     self.moleHead.reparentTo(self.mole)
示例#21
0
 def setHillType(self, type):
     if self.isUp:
         if (self.hillType == MoleFieldBase.HILL_MOLE or type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB) and type == MoleFieldBase.HILL_MOLE:
             return None
         
     self.hillType = type
     self.moleHead.remove()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles = 1)
             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles = 10)
             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles = 30)
             gears2MTrack = Track((0.0, ParticleInterval(singleGear, self.hill, worldRelative = 1, duration = 5.7000000000000002, cleanup = True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative = 0, duration = 1.2, cleanup = True)), (0.29999999999999999, ParticleInterval(bigGearExplosion, self.hill, worldRelative = 0, duration = 1.0, cleanup = True)), name = 'gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.23000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.28000000000000003)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.34999999999999998, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28000000000000003, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.32000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.47999999999999998)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28999999999999998, 0.0)))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         
         if self.downIval:
             self.downIval.finish()
         
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.14999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.14999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17000000000000001)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.0))), Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5), LerpScaleInterval(self.moleHead, 0.5, 1.0))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     
     self.moleHead.reparentTo(self.mole)
 def destroy(self):
     if self.isDestroyed:
         return None
     
     self.isDestroyed = True
     if hasattr(self.suit, 'prop') and self.suit.prop:
         self.suit.prop.stash()
     
     if self.propTrack:
         self.propTrack.finish()
         self.propTrack = None
     
     if self.suitSound:
         self.suitSound.stop()
         del self.suitSound
     
     if self.animTrack:
         self.animTrack.finish()
         self.animTrack = None
     
     if self.shotTrack != None:
         self.shotTrack.finish()
         self.shotTrack = None
     
     if self.deathTrack != None:
         self.deathTrack.finish()
         self.deathTrack = None
     
     if self.deathSuit:
         self.deathSuit.detachNode()
         self.suit.cleanupLoseActor()
         self.deathSuit = None
     
     if self.moveIval:
         self.moveIval.pause()
         del self.moveIval
     
     if self.suit:
         self.suit.delete()
         self.suit = None
     
     BattleParticles.unloadParticles()
     self.ignore(self.game.uniqueName('enter' + self.suitName))
     self.game = None
     self.enemyMgr = None
示例#23
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
示例#24
0
 def unload(self):
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     self.hood.dnaStore.resetSuitPoints()
     self.hood.dnaStore.resetBattleCells()
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.nodeToZone
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     cleanupDialog('globalDialog')
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
     if base.cr.newsManager:
         if base.cr.newsManager.isHolidayRunning(APRIL_FOOLS_COSTUMES):
             taskMgr.remove('piano-drop-task')
             self.pianoDropSequence.finish()
             self.pianoDropSound.finish()
             del self.pianoDropSequence
             del self.pianoDropSound
             self.piano.removeNode()
             del self.pianoSfx
             del self.dropSfx
             del self.npc
def __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamage, hpbonus, toon, npcs):
    tracks = Parallel()
    attacks = 0
    uberDelay = 0.0
    isUber = 0
    if sound['level'] >= ToontownBattleGlobals.UBER_GAG_LEVEL_INDEX:
        uberDelay = 3.0
        isUber = 1
    for target in targets:
        suit = target['suit']
        if totalDamage > 0 and sound == lastSoundThatHit:
            hp = target['hp']
            died = target['died']
            battle = sound['battle']
            kbbonus = target['kbbonus']
            suitTrack = Sequence()
            showDamage = Func(suit.showHpText, -totalDamage, openEnded=0)
            updateHealthBar = Func(suit.updateHealthBar, totalDamage)
            if isUber:
                breakEffect = BattleParticles.createParticleEffect(file='soundBreak')
                breakEffect.setDepthWrite(0)
                breakEffect.setDepthTest(0)
                breakEffect.setTwoSided(1)
                soundEffect = globalBattleSoundCache.getSound(hitSoundFiles[0])
            suitTrack.append(Wait(delay + tSuitReact))
            if isUber:
                delayTime = random.random()
                suitTrack.append(Wait(delayTime + 2.0))
                suitTrack.append(Func(setPosFromOther, breakEffect, suit, Point3(0, 0.0, suit.getHeight() - 1.0)))
                #suitTrack.append(Parallel(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit), __getPartTrack(breakEffect, 0.0, 1.0, [breakEffect, suit, 0], softStop=-0.5))) THIS CRASHES PANDA WITH A BOUNDING SPHERE ERROR
                suitTrack.append(Sequence(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit)))
                if died and not suit.getSkelecog():
                    suitTrack.append(headExplodeTrack(suit, battle))
            else:
                suitTrack.append(showDamage)
                suitTrack.append(updateHealthBar)
            if hitCount == 1:
                suitTrack.append(Parallel(ActorInterval(suit, 'squirt-small-react'), MovieUtil.createSuitStunInterval(suit, 0.5, 1.8)))
            else:
                suitTrack.append(ActorInterval(suit, 'squirt-small-react'))
            if kbbonus == 0:
                suitTrack.append(__createSuitResetPosTrack(suit, battle))
                suitTrack.append(Func(battle.unlureSuit, suit))
            bonusTrack = None
            if hpbonus > 0:
                bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0), Func(suit.updateHealthBar, hpbonus))
            suitTrack.append(Func(suit.loop, 'neutral'))
            if bonusTrack == None:
                tracks.append(suitTrack)
            else:
                tracks.append(Parallel(suitTrack, bonusTrack))
        elif totalDamage <= 0:
            tracks.append(Sequence(Wait(2.9), Func(MovieUtil.indicateMissed, suit, 1.0)))
            tracks.append(MovieUtil.createSuitTeaseMultiTrack(suit, delay + tSuitReact))

    return tracks
示例#26
0
 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', '**/*')
 def __init__(self, enemyMgr, index, suitAttribs):
     self.enemyMgr = enemyMgr
     self.game = self.enemyMgr.section.sectionMgr.game
     self.index = index
     self.moveIval = None
     self.propTrack = None
     self.animTrack = None
     self.shotTrack = None
     self.deathTrack = None
     self.deathSuit = None
     self.suitSound = None
     self.deleteMeCallback = None
     self.isMovingUpDown = False
     self.isMovingLeftRight = False
     self.showCollSpheres = False
     self.isDestroyed = False
     self.isGoingUp = False
     self.setupEnemy(suitAttribs)
     BattleParticles.loadParticles()
示例#28
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)
示例#29
0
 def __init__(self, enemyMgr, index, suitAttribs):
     self.enemyMgr = enemyMgr
     self.game = self.enemyMgr.section.sectionMgr.game
     self.index = index
     self.moveIval = None
     self.propTrack = None
     self.animTrack = None
     self.shotTrack = None
     self.deathTrack = None
     self.deathSuit = None
     self.suitSound = None
     self.deleteMeCallback = None
     self.isMovingUpDown = False
     self.isMovingLeftRight = False
     self.showCollSpheres = False
     self.isDestroyed = False
     self.isGoingUp = False
     self.setupEnemy(suitAttribs)
     BattleParticles.loadParticles()
示例#30
0
 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', '**/*')
 def unload(self):
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     self.hood.dnaStore.resetSuitPoints()
     self.hood.dnaStore.resetBattleCells()
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.nodeToZone
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     cleanupDialog('globalDialog')
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
     if base.config.GetBool('want-april-toons', 0):
         self.pianoDropSequence.finish()
         self.pianoDropSound.finish()
         del self.pianoDropSequence
         del self.pianoDropSound
         self.piano.removeNode()
         del self.pianoSfx
         del self.dropSfx
         del self.npc
示例#32
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
 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
 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
 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
 def unload(self):
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.nodeToZone
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     cleanupDialog('globalDialog')
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
     if config.GetBool('want-april-toons', 0):
         self.pianoDropSequence.finish()
         self.pianoDropSound.finish()
         del self.pianoDropSequence
         del self.pianoDropSound
         self.piano.removeNode()
         del self.pianoSfx
         del self.dropSfx
         del self.npc
示例#37
0
def shortCircuitTrack(suit, battle):
    if suit.isHidden():
        return Sequence()
    else:
        suitTrack = Sequence()
        suitPos, suitHpr = battle.getActorPosHpr(suit)
        suitTrack.append(Wait(0.15))
        suitTrack.append(Func(MovieUtil.avatarHide, suit))
        deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
        deathSoundTrack = Sequence(Wait(0.5), SoundInterval(deathSound, volume=0.8))
        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)
        gearPoint = Point3(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        explosionTrack = Sequence()
        explosionTrack.append(MovieUtil.createKapowExplosionTrack(battle, explosionPoint=gearPoint))
        gears1Track = Sequence(Wait(0.5), ParticleInterval(smallGears, battle, worldRelative=0, duration=1.0, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.1, ParticleInterval(singleGear, battle, worldRelative=0, duration=0.4, cleanup=True)), (0.5, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=0.5, cleanup=True)), (0.9, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=2.0, cleanup=True)), name='gears2MTrack')
        return Parallel(suitTrack, explosionTrack, deathSoundTrack, gears1Track, gears2MTrack)
示例#38
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)
示例#39
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)
示例#40
0
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        self.deathSuit.reparentTo(self.suit.getParent())
        self.deathSuit.setScale(self.suit.getScale())
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
        explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
        gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Sequence(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, self._deathSoundIval), removeParticles)
        self.deathTrack.start()
示例#41
0
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        self.deathSuit.reparentTo(self.suit.getParent())
        self.deathSuit.setScale(self.suit.getScale())
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
        explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
        gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Sequence(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, self._deathSoundIval), removeParticles)
        self.deathTrack.start()
示例#42
0
 def unload(self):
     assert self.notify.debug("unload()")
     # unload Toon battle anims and props
     self.unloadBattleAnims()
     globalPropPool.unloadProps()
     globalBattleSoundCache.clear()
     BattleParticles.unloadParticles()
     self.parentFSMState.removeChild(self.fsm)
     del self.parentFSMState
     del self.fsm
     del self.streetClass
     self.landmarkBlocks.removeNode()
     del self.landmarkBlocks
     # Clear out the old neighborhoods suit points
     self.hood.dnaStore.resetSuitPoints()
     # Clear out the battle cells
     self.hood.dnaStore.resetBattleCells()
     del self.hood
     del self.nodeDict
     del self.zoneDict
     del self.fadeInDict
     del self.fadeOutDict
     del self.nodeList
     self.geom.removeNode()
     del self.geom
     self.townBattle.unload()
     self.townBattle.cleanup()
     del self.townBattle
     del self.battleMusic
     del self.music
     del self.activityMusic
     del self.holidayPropTransforms
     self.deleteAnimatedProps()
     # remove any dfa dialogs
     cleanupDialog("globalDialog")
     # Get rid of any references to models or textures from this town
     ModelPool.garbageCollect()
     TexturePool.garbageCollect()
示例#43
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])
    def makeSynergyTrack(self):
        particleEffect = BattleParticles.createParticleEffect('Synergy')
        waterfallEffect = BattleParticles.createParticleEffect(file='synergyWaterfall')
        soundTrack = Sequence(
            Wait(0.9),
            SoundInterval(self.synergySfx, node=self.virtualSuit)
        )
        track = Sequence(
            Parallel(
                ActorInterval(self.virtualSuit, 'magic3'),
                Track(
                    (0.0, Func(self.sayFaceoffTaunt)),
                    (0.1, ParticleInterval(waterfallEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)),
                    (0.2, ParticleInterval(particleEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)),
                    (0.5, Func(self.synergyColl.unstash)),
                ),
                soundTrack
            ),
            Func(self.synergyColl.stash),
            Func(self.virtualSuit.setHpr, 0, 0, 0),
            Func(self.virtualSuit.loop, 'walk', 0),
        )

        return track
示例#45
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
    def createExplosionTrack(self):
        if self.explodeTrack and self.explodeTrack.isPlaying():
            self.explodeTrack.finish()
        # Our real actor is going to head back and get ready for the next time he is needed,
        # so we need to spawn a "LoseActor" in his place.
        loseActor = self.suit.getLoseActor()
        loseActor.reparentTo(render)
        spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
        deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')

        # Now for our main interval and soundtrack
        explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150)
        deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=loseActor), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=loseActor), SoundInterval(deathSound, volume=0.32, node=loseActor))

        # Next, load the particle effects
        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)
        gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ())
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        cleanupTrack = Track((6.5, Func(self.suit.cleanupLoseActor)))

        # Now for the big KAPOW
        def createKapowExplosionTrack(parent):
            explosionTrack = Sequence()
            explosion = loader.loadModel('phase_3.5/models/props/explosion')
            explosion.setBillboardPointEye()
            explosion.setDepthWrite(False)
            explosionPoint = Point3(0, 0, 4.1)
            explosionTrack.append(Func(explosion.reparentTo, parent))
            explosionTrack.append(Func(explosion.setPos, explosionPoint))
            explosionTrack.append(Func(explosion.setScale, 0.4))
            explosionTrack.append(Wait(0.6))
            explosionTrack.append(Func(explosion.removeNode))
            return explosionTrack
        explosionTrack = Sequence()
        explosionTrack.append(Wait(5.4))
        explosionTrack.append(createKapowExplosionTrack(loseActor))

        gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        # Let's tie it all together.
        self.explodeTrack = Sequence(Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack, cleanupTrack))
        self.explodeTrack.start()
示例#47
0
 def __init__(self, model, pos, serialNum, gameId, penalty=False):
     self.serialNum = serialNum
     self.penalty = penalty
     center = model.getBounds().getCenter()
     center = Point3(0, 0, 0)
     self.nodePath = model.copyTo(render)
     self.nodePath.setPos(pos[0] - center[0], pos[1] - center[1],
                          pos[2] - center[2])
     self.nodePath.setZ(0)
     self.notify.debug('newPos = %s' % self.nodePath.getPos())
     if self.penalty:
         self.sphereName = 'penaltySphere-%s-%s' % (gameId, self.serialNum)
     else:
         self.sphereName = 'treasureSphere-%s-%s' % (gameId, self.serialNum)
     self.collSphere = CollisionSphere(center[0], center[1], center[2],
                                       self.RADIUS)
     self.collSphere.setTangible(0)
     self.collNode = CollisionNode(self.sphereName)
     self.collNode.setIntoCollideMask(ToontownGlobals.PieBitmask)
     self.collNode.addSolid(self.collSphere)
     self.collNodePath = render.attachNewNode(self.collNode)
     self.collNodePath.setPos(pos[0] - center[0], pos[1] - center[1],
                              pos[2] - center[2])
     self.collNodePath.hide()
     self.track = None
     if self.penalty:
         self.tip = self.nodePath.find('**/fusetip')
         sparks = BattleParticles.createParticleEffect(file='icetnt')
         self.sparksEffect = sparks
         sparks.start(self.tip)
         self.penaltyGrabSound = loader.loadSfx(
             'phase_4/audio/sfx/MG_cannon_fire_alt.mp3')
         self.penaltyGrabSound.setVolume(0.75)
         kaboomAttachPoint = self.nodePath.attachNewNode('kaboomAttach')
         kaboomAttachPoint.setZ(3)
         self.kaboom = loader.loadModel(
             'phase_4/models/minigames/ice_game_kaboom')
         self.kaboom.reparentTo(kaboomAttachPoint)
         self.kaboom.setScale(2.0)
         self.kaboom.setBillboardPointEye()
     return
    def enterExplode(self, time):
        # Are we exploding?
        self.exploding = True

        # Lets create a specific actor for the explosion and load the explosion stuff
        loseActor = self.getLoseActor()
        loseActor.reparentTo(render)
        spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
        deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')

        # We're done with this guy
        self.stash()

        # Oh boy, time to load all of our explosion effects!
        explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150)
        deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=loseActor), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=loseActor), SoundInterval(deathSound, volume=0.32, node=loseActor))
        
        # Load the particles for the explosion
        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)
        gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ())
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)

        # Create the explosion track
        explosionTrack = Sequence()
        explosionTrack.append(Wait(5.4))
        explosionTrack.append(self.createKapowExplosionTrack(loseActor))

        gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
        
        # Cleanup
        
        cleanupTrack = Track((6.5, Func(self.cleanupLoseActor))) # Better delete the poor guy when we're done

        # Blow the sucker up
        self.explodeTrack = Sequence(Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack))
        self.explodeTrack.delayDelete = DelayDelete(self, 'cleanupExplode')
        self.explodeTrack.append(Func(self.explodeTrack.delayDelete.destroy))
        self.explodeTrack.start()
        self.explodeTrack.setT(time)
 def __init__(self, parent = hidden, wantParticles = 1):
     NodePath.__init__(self, parent)
     self.assign(parent.attachNewNode('splash'))
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     self.wantParticles = 1
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
示例#50
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, 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
示例#51
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()
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        if self.suitSound:
            self.suitSound.stop()
        self.deathSuit = self.suit.getLoseActor()
        self.deathSuit.reparentTo(self.enemyMgr.enemiesNP)
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        treasureSpawnPoint = Point3(self.suit.getX(), self.suit.getY(), self.suit.getZ() + self.suit.height / 2.0)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.mp3')
        deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.mp3')
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        if self.isMovingLeftRight:
            self.enterPause()
            suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
            explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
            soundTrack = Sequence(SoundInterval(spinningSound, duration=1.6, startTime=0.6, volume=0.8, node=self.deathSuit), SoundInterval(deathSound, volume=0.32, node=self.deathSuit))
            gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
            gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
        elif self.isMovingUpDown:

            def getFinalPos():
                if self.isGoingUp:
                    direction = 1.0
                else:
                    direction = -1.0
                pos = Point3(self.deathSuit.getX(), self.deathSuit.getY(), self.deathSuit.getZ() + 2.0 * direction)
                return pos

            deathMoveIval = LerpPosInterval(self.deathSuit, 1.5, pos=getFinalPos(), name='%s-deathSuitMove' % self.suitName, blendType='easeInOut', fluid=1)
            suitTrack = Sequence(Func(self.collNodePath.stash), Parallel(ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), deathMoveIval), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
            explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
            soundTrack = Sequence(SoundInterval(spinningSound, duration=1.6, startTime=0.6, volume=0.8, node=self.deathSuit), SoundInterval(deathSound, volume=0.32, node=self.deathSuit))
            gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
            gears2MTrack = Track((0.0, explosionTrack), (0.0, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (2.7, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (2.9, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Parallel(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, soundTrack), removeParticles, Func(self.destroy))
        self.deathTrack.start()
    def makeWriteOffTrack(self):
        pad = BattleProps.globalPropPool.getProp('pad')
        pad.setScale(1.89)
        pencil = BattleProps.globalPropPool.getProp('pencil')
        BattleParticles.loadParticles()
        checkmark = copyProp(BattleParticles.getParticle('checkmark'))
        checkmark.setBillboardPointEye()

        # Make prop virtual:
        pad.setColorScale(1.0, 0.0, 0.0, 0.8)
        pad.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
        pencil.setColorScale(1.0, 0.0, 0.0, 0.8)
        pencil.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
        checkmark.setColorScale(1.0, 0.0, 0.0, 0.8)
        checkmark.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))

        # Prop collisions:
        colNode = CollisionNode(self.uniqueName('SuitAttack'))
        colNode.setTag('damage', str(self.attackInfo[1]))

        bounds = checkmark.getBounds()
        center = bounds.getCenter()
        radius = bounds.getRadius()
        sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius)
        sphere.setTangible(0)
        colNode.addSolid(sphere)
        colNode.setIntoCollideMask(WallBitmask)
        checkmark.attachNewNode(colNode)

        toonId = self.toon

        toon = base.cr.doId2do.get(toonId)
        if not toon:
            return

        self.virtualSuit.lookAt(toon)

        if self.virtualSuit.style.body in ['a', 'b']:
            throwDelay = 3
        elif self.virtualSuit.style.body == 'c':
            throwDelay = 2.3
        else:
            throwDelay = 2

        def throwProp():
            if not self.virtualSuit:
                return

            toon = self.cr.doId2do.get(toonId)
            if not toon:
                self.cleanupProp(checkmark, False)
                self.finishPropAttack()
                return

            self.virtualSuit.lookAt(toon)

            checkmark.wrtReparentTo(render)

            hitPos = toon.getPos() + Vec3(0, 0, 2.5)
            distance = (checkmark.getPos() - hitPos).length()
            speed = 50.0

            if self.attackProp == 'teeth':
                throwSequence = Sequence(
                    Parallel(
                        checkmark.posInterval(distance / speed, hitPos),
                        ActorInterval(checkmark, 'teeth', duration=distance / speed),
                    ),
                    Func(self.cleanupProp, checkmark, False),
                )
            else:
                throwSequence = Sequence(
                    checkmark.posInterval(distance / speed, hitPos),
                    Func(self.cleanupProp, checkmark, False)
                )

            throwSequence.start()

        pencilTrack = Sequence(
            Wait(0.5),
            Func(pencil.setPosHpr, -0.47, 1.08, 0.28, 21.045, 12.702, -176.374),
            Func(pencil.reparentTo, self.virtualSuit.getRightHand()),
            LerpScaleInterval(pencil, 0.5, Point3(1.5, 1.5, 1.5),
                              startScale=Point3(0.01)),
            Wait(throwDelay),
            Func(checkmark.reparentTo, render),
            Func(checkmark.setScale, 1.6),
            Func(checkmark.setPosHpr, pencil, 0, 0, 0, 0, 0, 0),
            Func(checkmark.setP, 0),
            Func(checkmark.setR, 0),
            Func(throwProp),
            Wait(0.3),
            LerpScaleInterval(pencil, 0.5, Point3(0.01, 0.01, 0.01)),
            Func(pencil.removeNode),
        )

        suitTrack = Sequence(
            ActorInterval(self.virtualSuit, 'hold-pencil'),
            Func(self.virtualSuit.loop, 'neutral', 0),
        )

        soundTrack = Sequence(
            Wait(2.3),
            SoundInterval(self.writeOffSfx, duration=0.9, node=self.virtualSuit),
            SoundInterval(self.dingSfx, node=self.virtualSuit)
        )

        padTrack = Track(
            (0.0, Func(pad.setPosHpr, -0.25, 1.38, -0.08, -19.078, -6.603, -171.594)),
            (0.4, Func(pad.reparentTo, self.virtualSuit.getLeftHand())),
            (3.0, Func(pad.removeNode)),
        )

        track = Sequence(
            Parallel(
                suitTrack, soundTrack, padTrack, pencilTrack, Func(self.sayFaceoffTaunt)
            ),
            Func(self.virtualSuit.loop, 'walk', 0)
        )
        return track
示例#54
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])
示例#55
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()
            #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()
示例#56
0
 def destroy(self):
     BattleParticles.unloadParticles()
     self.ignoreAll()
     self._destroySfx()
     CogdoMazeSplattable.destroy(self)
     MazeSuit.destroy(self)
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()
    def makeCrunchTrack(self):
        toonId = self.toon

        toon = base.cr.doId2do.get(toonId)
        if not toon:
            return

        self.virtualSuit.lookAt(toon)

        if self.virtualSuit.style.body in ['a', 'b']:
            throwDelay = 3
        elif self.virtualSuit.style.body == 'c':
            throwDelay = 2.3
        else:
            throwDelay = 2

        numberNames = ['one',
         'two',
         'three',
         'four',
         'five',
         'six']
        BattleParticles.loadParticles()
        numberSpill1 = BattleParticles.createParticleEffect(file='numberSpill')
        numberSpill2 = BattleParticles.createParticleEffect(file='numberSpill')
        spillTexture1 = random.choice(numberNames)
        spillTexture2 = random.choice(numberNames)
        BattleParticles.setEffectTexture(numberSpill1, 'audit-' + spillTexture1)
        BattleParticles.setEffectTexture(numberSpill2, 'audit-' + spillTexture2)
        numberSpillTrack1 = getPartTrack(numberSpill1, 1.1, 2.2, [numberSpill1, self.virtualSuit, 0])
        numberSpillTrack2 = getPartTrack(numberSpill2, 1.5, 1.0, [numberSpill2, self.virtualSuit, 0])
        numberSprayTracks = Parallel()
        numOfNumbers = random.randint(5, 9)
        for i in xrange(0, numOfNumbers - 1):
            nextSpray = BattleParticles.createParticleEffect(file='numberSpray')
            nextTexture = random.choice(numberNames)
            BattleParticles.setEffectTexture(nextSpray, 'audit-' + nextTexture)
            nextStartTime = random.random() * 0.6 + 3.03
            nextDuration = random.random() * 0.4 + 1.4
            nextSprayTrack = getPartTrack(nextSpray, nextStartTime, nextDuration, [nextSpray, self.virtualSuit, 0])
            numberSprayTracks.append(nextSprayTrack)

        def throwProp(prop):
            if not self.virtualSuit:
                return

            toon = self.cr.doId2do.get(toonId)
            if not toon:
                self.cleanupProp(prop, False)
                self.finishPropAttack()
                return

            self.virtualSuit.lookAt(toon)

            prop.wrtReparentTo(render)

            hitPos = toon.getPos() + Vec3(0, 0, 2.5)
            distance = (prop.getPos() - hitPos).length()
            speed = 50.0

            throwSequence = Sequence(
                prop.posInterval(distance / speed, hitPos),
                Func(self.cleanupProp, prop, False)
            )

            throwSequence.start()

        numberTracks = Parallel()
        for i in xrange(0, numOfNumbers):
            texture = random.choice(numberNames)
            next = copyProp(BattleParticles.getParticle('audit-' + texture))
            next.reparentTo(self.virtualSuit.getRightHand())
            next.setScale(0.01, 0.01, 0.01)
            next.setColor(Vec4(0.0, 0.0, 0.0, 1.0))
            next.setPos(random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3)
            next.setHpr(VBase3(-1.15, 86.58, -76.78))

            # Make prop virtual:
            next.setColorScale(1.0, 0.0, 0.0, 0.8)
            next.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))

            # Prop collisions:
            colNode = CollisionNode(self.uniqueName('SuitAttack'))
            colNode.setTag('damage', str(self.attackInfo[1]))

            bounds = next.getBounds()
            center = bounds.getCenter()
            radius = bounds.getRadius()
            sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius)
            sphere.setTangible(0)
            colNode.addSolid(sphere)
            colNode.setIntoCollideMask(WallBitmask)
            next.attachNewNode(colNode)

            numberTrack = Sequence(
                Wait(throwDelay),
                Parallel(
                    LerpScaleInterval(next, 0.6, Point3(1.0, 1.0, 1.0)),
                    Func(throwProp, next),
                ),
            )
            numberTracks.append(numberTrack)

            suitTrack = Parallel(
                    Func(self.sayFaceoffTaunt),
                    Sequence(
                        ActorInterval(self.virtualSuit, 'throw-object'),
                        ActorInterval(self.virtualSuit, 'neutral')
                    ),
            )

            return Sequence(
                Parallel(
                    suitTrack,
                    numberSpillTrack1,
                    numberSpillTrack2,
                    numberTracks,
                    numberSprayTracks
                ),
                Func(self.virtualSuit.loop, 'walk', 0),
                Func(self.virtualSuit.setHpr, 0, 0, 0),
            )