Ejemplo n.º 1
0
 def createHood(self, loadStorage = 1, AI = 0):
     if loadStorage:
         loadDNAFile(self.dnaStore, 'phase_4/dna/storage.dna')
         loadDNAFile(self.dnaStore, 'phase_4/dna/storage_TT.dna')
         loadDNAFile(self.dnaStore, 'phase_4/dna/storage_TT_sz.dna')
         loadDNAFile(self.dnaStore, 'phase_5/dna/storage_town.dna')
         loadDNAFile(self.dnaStore, 'phase_5/dna/storage_TT_town.dna')
     self.node = loadDNAFile(self.dnaStore, 'phase_4/dna/toontown_central_sz.dna')
     if self.node.getNumParents() == 1:
         self.geom = NodePath(self.node.getParent(0))
         self.geom.reparentTo(hidden)
     else:
         self.geom = hidden.attachNewNode(self.node)
     gsg = base.win.getGsg()
     if gsg:
         self.geom.prepareScene(gsg)
     self.geom.setName('toontown_central')
     self.geom.find('**/hill').setTransparency(TransparencyAttrib.MBinary, 1)
     self.createSky('tt')
     base.hoodBGM = base.loadMusic('phase_4/audio/bgm/TC_nbrhood.ogg')
     base.hoodBGM.setVolume(0.25)
     base.hoodBGM.setLoop(True)
     base.hoodBGM.play()
     self.clerk_node = render.attach_new_node('clerk_node')
     self.clerk_node.set_pos(-80, -85.57, 0.5)
     self.clerk_node.set_h(165.07)
     self.geom.find('**/toontown_central').setCollideMask(BitMask32.allOff())
     self.geom.find('**/coll_sidewalk').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/collision_1').node().setIntoCollideMask(CIGlobals.WallBitmask)
     self.geom.find('**/coll_mainFoolr').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/left_ear').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/right_ear').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_bridge_floor').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_bridge').node().setIntoCollideMask(CIGlobals.WallBitmask)
     self.geom.find('**/coll_r_stair').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_l_stair_2').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_l_stairend_1').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_r_satirend_1').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_plaza').node().setIntoCollideMask(CIGlobals.FloorBitmask)
     self.geom.find('**/coll_hedges').node().setIntoCollideMask(CIGlobals.WallBitmask)
     self.coll_list = ['coll_sidewalk',
      'collision_1',
      'coll_mainFoolr',
      'left_ear',
      'right_ear',
      'coll_bridge_floor',
      'coll_bridge',
      'coll_r_stair',
      'coll_l_stair_2',
      'coll_l_stairend_1',
      'coll_r_stairend_1',
      'coll_plaza',
      'coll_hedges']
     self.geom.reparentTo(render)
     self.telescope = Actor(self.geom.find('**/*animated_prop_HQTelescopeAnimatedProp*'), {'chan': 'phase_3.5/models/props/HQ_telescope-chan.bam'}, copy=0)
     self.telescope.reparentTo(self.geom.find('**/*toon_landmark_hqTT*'))
     self.createLights(1, 1, 1)
     taskMgr.add(self.telescopeTask, 'telescopeTask')
     self.isLoaded = 1
     messenger.send('loadedHood')
    def generate(self):
        DistributedObject.DistributedObject.generate(self)
        if self.butterfly:
            return
        self.butterfly = Actor.Actor()
        self.butterfly.loadModel('phase_4/models/props/SZ_butterfly-mod.bam')
        self.butterfly.loadAnims({
            'flutter':
            'phase_4/models/props/SZ_butterfly-flutter.bam',
            'glide':
            'phase_4/models/props/SZ_butterfly-glide.bam',
            'land':
            'phase_4/models/props/SZ_butterfly-land.bam'
        })
        index = self.doId % len(self.wingTypes)
        chosenType = self.wingTypes[index]
        node = self.butterfly.getGeomNode()
        for type in self.wingTypes:
            wing = node.find('**/' + type)
            if type != chosenType:
                wing.removeNode()
            else:
                if index == 0 or index == 1:
                    color = self.yellowColors[self.doId %
                                              len(self.yellowColors)]
                elif index == 2 or index == 3:
                    color = self.whiteColors[self.doId % len(self.whiteColors)]
                elif index == 4:
                    color = self.paleYellowColors[self.doId %
                                                  len(self.paleYellowColors)]
                else:
                    color = Vec4(1, 1, 1, 1)
                wing.setColor(color)

        self.butterfly2 = Actor.Actor(other=self.butterfly)
        self.butterfly.enableBlend(blendType=PartBundle.BTLinear)
        self.butterfly.loop('flutter')
        self.butterfly.loop('land')
        self.butterfly.loop('glide')
        rng = RandomNumGen.RandomNumGen(self.doId)
        playRate = 0.6 + 0.8 * rng.random()
        self.butterfly.setPlayRate(playRate, 'flutter')
        self.butterfly.setPlayRate(playRate, 'land')
        self.butterfly.setPlayRate(playRate, 'glide')
        self.butterfly2.setPlayRate(playRate, 'flutter')
        self.butterfly2.setPlayRate(playRate, 'land')
        self.butterfly2.setPlayRate(playRate, 'glide')
        self.glideWeight = rng.random() * 2
        lodNode = LODNode('butterfly-node')
        lodNode.addSwitch(100, 40)
        lodNode.addSwitch(40, 0)
        self.butterflyNode = NodePath(lodNode)
        self.butterfly2.setH(180.0)
        self.butterfly2.reparentTo(self.butterflyNode)
        self.butterfly.setH(180.0)
        self.butterfly.reparentTo(self.butterflyNode)
        self.__initCollisions()
        self.dropShadow = loader.loadModel('phase_3/models/props/drop_shadow')
        self.dropShadow.setColor(0, 0, 0, 0.3)
        self.dropShadow.setPos(0, 0.1, -0.05)
        self.dropShadow.setScale(self.shadowScaleBig)
        self.dropShadow.reparentTo(self.butterfly)
Ejemplo n.º 3
0
 def makeNodePath(self):
     self.nodePath = Actor.Actor()
     self.chair = self.nodePath.attachNewNode('myChair')
Ejemplo n.º 4
0
 def makeNodePath(self):
     self.nodePath = Actor.Actor()
     self.gavel = self.nodePath.attachNewNode('myGavel')
Ejemplo n.º 5
0
__all__ = []

if __name__ == "__main__":
    from direct.showbase.ShowBase import ShowBase
    from panda3d.core import *
    from .IntervalGlobal import *
    from direct.actor.Actor import *

    from direct.directutil import Mopath

    base = ShowBase()

    boat = loader.loadModel('models/misc/smiley')
    boat.reparentTo(render)

    donald = Actor()
    donald.loadModel("phase_6/models/char/donald-wheel-1000")
    donald.loadAnims({"steer": "phase_6/models/char/donald-wheel-wheel"})
    donald.reparentTo(boat)

    dock = loader.loadModel('models/misc/smiley')
    dock.reparentTo(render)

    sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
    foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')

    mp = Mopath.Mopath()
    mp.loadFile(Filename('phase_6/paths/dd-e-w'))

    # Set up the boat
    boatMopath = MopathInterval(mp, boat, 'boatpath')
Ejemplo n.º 6
0
 def createFish(self, fishcode):
     loadBase = 'phase_4/models/char/'
     if fishcode is 0:
         fish = Actor.Actor('phase_4/models/char/clownFish-zero.bam',
                            {'anim': loadBase + 'clownFish-swim.bam'})
         fish.name = 'clown'
     elif fishcode is 1:
         fish = Actor.Actor(
             'phase_4/models/char/PBJfish-zero.bam',
             {'anim': 'phase_4/models/char/PBJfish-swim.bam'})
         fish.name = 'pbj'
     elif fishcode is 2:
         fish = Actor.Actor(
             'phase_4/models/char/BearAcuda-zero.bam',
             {'anim': 'phase_4/models/char/BearAcuda-swim.bam'})
         fish.name = 'bear'
     elif fishcode is 3:
         fish = Actor.Actor(loadBase + 'balloonFish-zero.bam',
                            {'anim': loadBase + 'balloonFish-swim.bam'})
         fish.name = 'balloon'
     elif fishcode is 4:
         fish = Actor.Actor(loadBase + 'nurseShark-zero.bam',
                            {'anim': loadBase + 'nurseShark-swim.bam'})
         fish.name = 'nurse'
     elif fishcode is 5:
         fish = Actor.Actor(loadBase + 'pianoTuna-zero.bam',
                            {'anim': loadBase + 'pianoTuna-swim.bam'})
         fish.name = 'piano'
     else:
         return
     fish.active = 1
     fish.direction = self.direction
     idCode = self.getUniqueNumber()
     fish.code = str(self.spawnId) + str(idCode)
     self.fishArray[idCode] = fish
     fish.reparentTo(render)
     fish.setScale(1)
     fish.moveLerp = Sequence()
     if fish.name == 'clown':
         fish.setH(90 * self.direction)
         fish.loop('anim')
         cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.2)
     elif fish.name == 'pbj':
         fish.setH(15 * self.direction)
         fish.loop('anim')
         cSphere = CollisionSphere(0.0, 0.0, 0.0, 1)
     elif fish.name == 'balloon':
         fish.setH(0)
         fish.loop('anim', fromFrame=0, toFrame=94)
         fish.setScale(2)
         cSphere = CollisionSphere(0.0, 0.0, 0.0, 0.2)
     elif fish.name == 'bear':
         fish.setH(90 * self.direction)
         cSphere = CollisionSphere(0.0, -1.0, 3.5, 3.0)
         fish.loop('anim')
         fish.setScale(0.4, 1.7, 1.7)
     elif fish.name == 'nurse':
         fish.setH(90 * self.direction)
         cSphere = CollisionSphere(0.0, -1.0, 0.0, 1)
         fish.setScale(0.5, 1.7, 1.7)
         fish.loop('anim')
     elif fish.name == 'mackerel':
         fish.setH(90 * self.direction)
         cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.5)
         fish.loop('anim', fromFrame=36, toFrame=80)
     elif fish.name == 'piano':
         fish.loop('anim')
         fish.setScale(1.4)
         cSphere = CollisionSphere(0, 0, 0, 1)
         fishSoundName = 'Piano_Tuna.ogg'
         if self.direction is -1:
             fish.setH(0)
         else:
             fish.setH(180)
     cSphere.setTangible(0)
     fish.offset = 0
     cSphereNode = CollisionNode('fc' + str(fish.code))
     cSphereNode.addSolid(cSphere)
     cSphereNode.setFromCollideMask(BitMask32.allOff())
     cSphereNode.setIntoCollideMask(DivingGameGlobals.CollideMask)
     cSphereNodePath = fish.attachNewNode(cSphereNode)
     self.accept('into-fc' + str(fish.code), self.__handleFishCollide)
     fish.moveloop = Sequence(
         Wait(4), LerpScaleInterval(fish, startScale=1, scale=3,
                                    duration=1), Wait(1.5),
         LerpScaleInterval(fish, startScale=3, scale=1, duration=0.5))
     return fish
Ejemplo n.º 7
0
    def generate(self):
        """generate(self)
        This method is called when the DistributedObject is reintroduced
        to the world, either for the first time or from the cache.
        """
        DistributedObject.DistributedObject.generate(self)
        if self.butterfly:
            return

        self.butterfly = Actor.Actor()
        self.butterfly.loadModel('phase_4/models/props/SZ_butterfly-mod.bam')
        self.butterfly.loadAnims({
            'flutter':
            'phase_4/models/props/SZ_butterfly-flutter.bam',
            'glide':
            'phase_4/models/props/SZ_butterfly-glide.bam',
            'land':
            'phase_4/models/props/SZ_butterfly-land.bam'
        })

        # Randomly choose one of the butterfly wing patterns
        index = self.doId % len(self.wingTypes)
        chosenType = self.wingTypes[index]
        node = self.butterfly.getGeomNode()
        for type in self.wingTypes:
            wing = node.find('**/' + type)
            if (type != chosenType):
                wing.removeNode()
            else:
                # Choose an appropriate blend color
                if (index == 0 or index == 1):
                    color = self.yellowColors[self.doId %
                                              len(self.yellowColors)]
                elif (index == 2 or index == 3):
                    color = self.whiteColors[self.doId % len(self.whiteColors)]
                elif (index == 4):
                    color = self.paleYellowColors[self.doId %
                                                  len(self.paleYellowColors)]
                else:
                    color = Vec4(1, 1, 1, 1)
                wing.setColor(color)

        # Make another copy of the butterfly model so we can LOD the
        # blending.  Butterflies that are far away won't bother to
        # blend animations; nearby butterflies will use dynamic
        # blending to combine two or more animations at once on
        # playback for a nice fluttering and landing effect.
        self.butterfly2 = Actor.Actor(other=self.butterfly)

        # Allow the nearby butterfly to blend between its three
        # animations.  All animations will be playing all the time;
        # we'll control which one is visible by varying the control
        # effect.
        self.butterfly.enableBlend(blendType=PartBundle.BTLinear)
        self.butterfly.loop('flutter')
        self.butterfly.loop('land')
        self.butterfly.loop('glide')

        # Make a random play rate so all the butterflies will be
        # flapping at slightly different rates.  This doesn't affect
        # the rate at which the butterfly moves, just the rate at
        # which the animation plays on the butterfly.
        rng = RandomNumGen.RandomNumGen(self.doId)
        playRate = 0.6 + 0.8 * rng.random()
        self.butterfly.setPlayRate(playRate, 'flutter')
        self.butterfly.setPlayRate(playRate, 'land')
        self.butterfly.setPlayRate(playRate, 'glide')
        self.butterfly2.setPlayRate(playRate, 'flutter')
        self.butterfly2.setPlayRate(playRate, 'land')
        self.butterfly2.setPlayRate(playRate, 'glide')

        # Also, a random glide contribution ratio.  We'll blend a bit
        # of the glide animation in with the flutter animation to
        # dampen the effect of flutter.  The larger the number here,
        # the greater the dampening effect.  Some butterflies will be
        # more active than others.  (Except when seen from a long way
        # off, because of the LODNode, below.)
        self.glideWeight = rng.random() * 2

        lodNode = LODNode('butterfly-node')
        lodNode.addSwitch(100, 40)  # self.butterfly2
        lodNode.addSwitch(40, 0)  # self.butterfly

        self.butterflyNode = NodePath(lodNode)
        self.butterfly2.setH(180.0)
        self.butterfly2.reparentTo(self.butterflyNode)
        self.butterfly.setH(180.0)
        self.butterfly.reparentTo(self.butterflyNode)
        self.__initCollisions()

        # Set up the drop shadow
        self.dropShadow = loader.loadModel('phase_3/models/props/drop_shadow')
        self.dropShadow.setColor(0, 0, 0, 0.3)
        self.dropShadow.setPos(0, 0.1, -0.05)
        self.dropShadow.setScale(self.shadowScaleBig)
        self.dropShadow.reparentTo(self.butterfly)
    def __init__(self, name, x, y, h):
        NodePath.__init__(self, name)
        self.name = name
        decorId = PartyGlobals.DecorationIds.fromString(name)
        centerX, centerY = getCenterPosFromGridSize(
            x, y, PartyGlobals.DecorationInformationDict[decorId]['gridsize'])
        self.setPos(centerX, centerY, 0.0)
        self.setH(h)
        if self.name == 'CakeTower':
            self.partyCake = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_cakeTower')
            tntSeqNode = self.partyCake.find('**/seqNode_tnt').node()
            tntSeqNode.setFrameRate(20)
            self.partyCake.reparentTo(self)
        elif self.name == 'BannerJellyBean':
            partyBannerModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_bannerJellybean_model')
            banner = []
            banner1 = partyBannerModel.find('**/banner1')
            banner2 = partyBannerModel.find('**/banner2')
            temp = NodePath('Empty')
            banner1.reparentTo(temp)
            banner2.reparentTo(temp)
            banner.append(banner1)
            banner.append(banner2)
            self.partyBanner = Actor.Actor(partyBannerModel, {
                'float':
                'phase_13/models/parties/tt_m_ara_pty_bannerJellybean'
            })
            bannerSeqNodeParent = self.partyBanner.find('**/bannerJoint')
            bannerSeqNode = SequenceNode('banner')
            for bannerNode in banner:
                bannerSeqNode.addChild(bannerNode.node())

            temp.detachNode()
            del temp
            bannerSeqNodeParent.attachNewNode(bannerSeqNode)
            bannerSeqNode.setFrameRate(4)
            bannerSeqNode.loop(True)
            bannerSeqNode.setPlayRate(1)
            balloonLeft = self.partyBanner.find('**/balloonsLMesh')
            balloonRight = self.partyBanner.find('**/balloonsRMesh')
            balloonLeft.setBillboardAxis()
            balloonRight.setBillboardAxis()
            balloonLeftLocator = self.partyBanner.find('**/balloonJointL')
            balloonRightLocator = self.partyBanner.find('**/balloonJointR')
            balloonLeft.reparentTo(balloonLeftLocator)
            balloonRight.reparentTo(balloonRightLocator)
            self.partyBanner.loop('float')
            self.partyBanner.reparentTo(self)
        elif self.name == 'GagGlobe':
            self.partyGlobe = Actor.Actor(
                'phase_13/models/parties/tt_m_ara_pty_gagGlobe_model',
                {'idle': 'phase_13/models/parties/tt_m_ara_pty_gagGlobe'})
            self.partyGlobe.setBillboardAxis()
            confettiLocator = self.partyGlobe.find('**/uvj_confetti')
            confettiMesh = self.partyGlobe.find('**/innerGlobeMesh')
            confettiMesh.setTexProjector(
                confettiMesh.findTextureStage('default'), confettiLocator,
                self.partyGlobe)
            collisionMesh = self.partyGlobe.find('**/collisionMesh')
            collisionMesh.hide()
            self.globeSphere = CollisionSphere(
                confettiMesh.getBounds().getCenter(),
                confettiMesh.getBounds().getRadius())
            self.globeSphere.setTangible(1)
            self.globeSphereNode = CollisionNode('gagGlobe' +
                                                 str(self.getPos()))
            self.globeSphereNode.setIntoCollideMask(
                ToontownGlobals.WallBitmask)
            self.globeSphereNode.addSolid(self.globeSphere)
            self.globeSphereNodePath = self.partyGlobe.attachNewNode(
                self.globeSphereNode)
            self.partyGlobe.loop('idle')
            self.partyGlobe.reparentTo(self)
        elif self.name == 'FlyingHeart':
            flyingHeartModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_heartWing_model')
            self.flyingHeart = Actor.Actor(
                flyingHeartModel,
                {'idle': 'phase_13/models/parties/tt_m_ara_pty_heartWing'})
            wingsSeqNodeParent = self.flyingHeart.find('**/heartWingJoint')
            collisionMesh = self.flyingHeart.find('**/collision_heartWing')
            collisionMesh.hide()
            self.globeSphere = CollisionSphere(
                collisionMesh.getBounds().getCenter(),
                collisionMesh.getBounds().getRadius())
            self.globeSphere.setTangible(1)
            self.globeSphereNode = CollisionNode('flyingHeart' +
                                                 str(self.getPos()))
            self.globeSphereNode.setIntoCollideMask(
                ToontownGlobals.WallBitmask)
            self.globeSphereNode.addSolid(self.globeSphere)
            self.globeSphereNodePath = self.flyingHeart.attachNewNode(
                self.globeSphereNode)
            self.globeSphereNodePath.reparentTo(wingsSeqNodeParent)
            wings = []
            wingsSeqNode = SequenceNode('wingsSeqNode')
            temp = NodePath('Empty')
            wing1 = self.flyingHeart.find('**/wing1')
            wing2 = self.flyingHeart.find('**/wing2')
            wing3 = self.flyingHeart.find('**/wing3')
            wing4 = self.flyingHeart.find('**/wing4')
            wing1.reparentTo(temp)
            wing2.reparentTo(temp)
            wing3.reparentTo(temp)
            wing4.reparentTo(temp)
            wings.append(wing1)
            wings.append(wing2)
            wings.append(wing3)
            wings.append(wing4)
            wingsSeqNode.addChild(wing1.node())
            wingsSeqNode.addChild(wing2.node())
            wingsSeqNode.addChild(wing3.node())
            wingsSeqNode.addChild(wing4.node())
            wingsSeqNode.addChild(wing3.node())
            wingsSeqNode.addChild(wing2.node())
            temp.detachNode()
            del temp
            wingsSeqNodeParent.attachNewNode(wingsSeqNode)
            wingsSeqNode.setFrameRate(12)
            wingsSeqNode.loop(True)
            wingsSeqNode.setPlayRate(1)
            self.flyingHeart.loop('idle')
            self.flyingHeart.reparentTo(self)
        elif self.name == 'HeartBanner':
            self.heartBanner = Actor.Actor(
                'phase_13/models/parties/tt_m_ara_pty_bannerValentine_model', {
                    'idle':
                    'phase_13/models/parties/tt_m_ara_pty_bannerValentine'
                })
            balloonLeft = self.heartBanner.find('**/balloonsL')
            balloonRight = self.heartBanner.find('**/balloonsR')
            balloonLeft.setBillboardAxis()
            balloonRight.setBillboardAxis()
            balloonLeftLocator = self.heartBanner.find('**/balloonJointL')
            balloonRightLocator = self.heartBanner.find('**/balloonJointR')
            balloonLeft.reparentTo(balloonLeftLocator)
            balloonRight.reparentTo(balloonRightLocator)
            self.heartBanner.loop('idle')
            self.heartBanner.reparentTo(self)
        elif self.name == 'Hydra' or self.name == 'StageWinter':
            if self.name == 'StageWinter':
                self.hydra = Actor.Actor(
                    'phase_13/models/parties/tt_r_ara_pty_winterProps', {
                        'dance':
                        'phase_13/models/parties/tt_a_ara_pty_hydra_dance'
                    })
            else:
                self.hydra = Actor.Actor(
                    'phase_13/models/parties/tt_a_ara_pty_hydra_default', {
                        'dance':
                        'phase_13/models/parties/tt_a_ara_pty_hydra_dance'
                    })
            st = random.randint(0, 10)
            animIval = ActorInterval(self.hydra, 'dance')
            animIvalDur = animIval.getDuration()
            self.decSfx = loader.loadSfx(
                'phase_13/audio/sfx/tt_s_ara_pty_propsShow_dance.mp3')
            soundIval = SoundInterval(self.decSfx,
                                      node=self.hydra,
                                      listenerNode=base.localAvatar,
                                      volume=PartyGlobals.DECORATION_VOLUME,
                                      cutOff=PartyGlobals.DECORATION_CUTOFF,
                                      duration=animIvalDur)
            self.animSeq = Parallel(animIval, soundIval)
            self.animSeq.loop(st)
            collisions = self.hydra.find('**/*collision*')
            collisions.setPos(0, 0, -5)
            self.hydra.flattenStrong()
            self.hydra.reparentTo(self)
            if self.name == 'StageWinter':
                stageBounds = self.hydra.find('**/stage').node().getBounds()
                self.hydra.node().setBounds(stageBounds)
                self.hydra.node().setFinal(1)
        elif self.name == 'TubeCogVictory':
            self.tubeCog = Actor.Actor(
                'phase_5.5/models/estate/tt_a_ara_pty_tubeCogVictory_default',
                {
                    'wave':
                    'phase_5.5/models/estate/tt_a_ara_pty_tubeCogVictory_wave'
                })
            st = random.randint(0, 10)
            animIval = ActorInterval(self.tubeCog, 'wave')
            animIvalDur = animIval.getDuration()
            self.decSfx = loader.loadSfx(
                'phase_13/audio/sfx/tt_s_ara_pty_tubeCogVictory_wave.mp3')
            soundIval = SoundInterval(self.decSfx,
                                      node=self.tubeCog,
                                      listenerNode=base.localAvatar,
                                      volume=PartyGlobals.DECORATION_VOLUME,
                                      cutOff=PartyGlobals.DECORATION_CUTOFF,
                                      duration=animIvalDur)
            self.animSeq = Parallel(animIval, soundIval)
            self.animSeq.loop()
            self.animSeq.setT(st)
            self.tubeCog.flattenStrong()
            self.tubeCog.reparentTo(self)
        elif self.name == 'BannerVictory':
            self.bannerVictory = Actor.Actor(
                'phase_13/models/parties/tt_m_ara_pty_bannerVictory_model',
                {'idle': 'phase_13/models/parties/tt_m_ara_pty_bannerVictory'})
            balloonLeft = self.bannerVictory.find('**/balloonsLMesh')
            balloonRight = self.bannerVictory.find('**/balloonsRMesh')
            balloonLeft.setBillboardAxis()
            balloonRight.setBillboardAxis()
            balloonLeftLocator = self.bannerVictory.find('**/balloonJointL')
            balloonRightLocator = self.bannerVictory.find('**/balloonJointR')
            balloonLeft.reparentTo(balloonLeftLocator)
            balloonRight.reparentTo(balloonRightLocator)
            self.bannerVictory.loop('idle')
            self.bannerVictory.reparentTo(self)
        elif self.name == 'CannonVictory':
            self.cannonVictory = Actor.Actor(
                'phase_13/models/parties/tt_m_ara_pty_cannonVictory_model',
                {'idle': 'phase_13/models/parties/tt_m_ara_pty_cannonVictory'})
            confettiLocator = self.cannonVictory.findAllMatches(
                '**/uvj_confetties')[1]
            confettiMesh = self.cannonVictory.find('**/confettis')
            confettiMesh.setTexProjector(
                confettiMesh.findTextureStage('default'), self.cannonVictory,
                confettiLocator)
            self.cannonVictory.flattenStrong()
            self.cannonVictory.loop('idle')
            self.cannonVictory.reparentTo(self)
        elif self.name == 'CogStatueVictory':
            self.decorationModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_cogDoodleVictory')
            self.decorationModel.reparentTo(self)
            self.decorationShadow = self.setupAnimSeq()
        elif self.name == 'CogIceCreamVictory':
            self.decorationModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_cogIceCreamVictory')
            self.decorationModel.reparentTo(self)
            self.decorationShadow = self.setupAnimSeq()
        elif self.name == 'cogIceCreamWinter':
            self.decorationModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_cogIceCreamWinter')
            self.decorationModel.reparentTo(self)
            self.decorationShadow = self.setupAnimSeq()
        elif self.name == 'CogStatueWinter':
            self.decorationModel = loader.loadModel(
                'phase_13/models/parties/tt_m_ara_pty_cogDoodleWinter')
            self.decorationModel.reparentTo(self)
            self.decorationShadow = self.setupAnimSeq()
        elif self.name == 'snowman':
            self.decorationModel = loader.loadModel(
                'phase_13/models/estate/tt_m_prp_ext_snowman')
            self.decorationModel.reparentTo(self)
            self.decorationModel.find('**/growthStage_1').hide()
            self.decorationModel.find('**/growthStage_2').hide()
        elif self.name == 'snowDoodle':
            self.decorationModel = loader.loadModel(
                'phase_5.5/models/estate/tt_m_prp_ext_snowDoodle')
            self.decorationModel.reparentTo(self)
            self.decorationModel.find('**/growthStage_1').hide()
            self.decorationModel.find('**/growthStage_2').hide()
        else:
            self.decorationModels = loader.loadModel(
                'phase_4/models/parties/partyDecorations')
            self.decorationModels.copyTo(self)
            decors = self.findAllMatches('**/partyDecoration_*')
            for i in xrange(decors.getNumPaths()):
                decPiece = decors.getPath(i)
                n = decPiece.getName()
                if n.endswith('shadow') or n.endswith('base') or n.endswith(
                        'collision') or n.endswith(name):
                    pass
                else:
                    decPiece.reparentTo(hidden)

        self.reparentTo(base.cr.playGame.hood.loader.geom)
Ejemplo n.º 9
0
 def getTeleportOutTrack(self):
     if not self.teleportHole:
         self.teleportHole = Actor.Actor('phase_3.5/models/props/portal-mod', {'hole': 'phase_3.5/models/props/portal-chan'})
     track = Sequence(Wait(1.0), Parallel(self.getTeleportOutSoundInterval(), Sequence(ActorInterval(self, 'toDig'), Parallel(ActorInterval(self, 'dig'), Func(self.showHole), ActorInterval(self.teleportHole, 'hole', startFrame=81, endFrame=71)), ActorInterval(self, 'disappear'), ActorInterval(self.teleportHole, 'hole', startFrame=71, endFrame=81), Func(self.cleanupHole)), Sequence(Wait(1.0), Func(self.dropShadow.hide))))
     return track
Ejemplo n.º 10
0
 def loadModel(self):
     self.model = Actor.Actor(
         'phase_5.5/models/estate/prop_phone-mod', {
             'SS_phoneOut':
             'phase_5.5/models/estate/prop_phone-SS_phoneOut',
             'SS_takePhone':
             'phase_5.5/models/estate/prop_phone-SS_takePhone',
             'SS_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-SS_phoneNeutral',
             'SS_phoneBack':
             'phase_5.5/models/estate/prop_phone-SS_phoneBack',
             'SM_phoneOut':
             'phase_5.5/models/estate/prop_phone-SM_phoneOut',
             'SM_takePhone':
             'phase_5.5/models/estate/prop_phone-SM_takePhone',
             'SM_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-SM_phoneNeutral',
             'SM_phoneBack':
             'phase_5.5/models/estate/prop_phone-SM_phoneBack',
             'SL_phoneOut':
             'phase_5.5/models/estate/prop_phone-SL_phoneOut',
             'SL_takePhone':
             'phase_5.5/models/estate/prop_phone-SL_takePhone',
             'SL_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-SL_phoneNeutral',
             'SL_phoneBack':
             'phase_5.5/models/estate/prop_phone-SL_phoneBack',
             'MS_phoneOut':
             'phase_5.5/models/estate/prop_phone-MS_phoneOut',
             'MS_takePhone':
             'phase_5.5/models/estate/prop_phone-MS_takePhone',
             'MS_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-MS_phoneNeutral',
             'MS_phoneBack':
             'phase_5.5/models/estate/prop_phone-MS_phoneBack',
             'MM_phoneOut':
             'phase_5.5/models/estate/prop_phone-MM_phoneOut',
             'MM_takePhone':
             'phase_5.5/models/estate/prop_phone-MM_takePhone',
             'MM_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-MM_phoneNeutral',
             'MM_phoneBack':
             'phase_5.5/models/estate/prop_phone-MM_phoneBack',
             'ML_phoneOut':
             'phase_5.5/models/estate/prop_phone-ML_phoneOut',
             'ML_takePhone':
             'phase_5.5/models/estate/prop_phone-ML_takePhone',
             'ML_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-ML_phoneNeutral',
             'ML_phoneBack':
             'phase_5.5/models/estate/prop_phone-ML_phoneBack',
             'LS_phoneOut':
             'phase_5.5/models/estate/prop_phone-LS_phoneOut',
             'LS_takePhone':
             'phase_5.5/models/estate/prop_phone-LS_takePhone',
             'LS_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-LS_phoneNeutral',
             'LS_phoneBack':
             'phase_5.5/models/estate/prop_phone-LS_phoneBack',
             'LM_phoneOut':
             'phase_5.5/models/estate/prop_phone-LM_phoneOut',
             'LM_takePhone':
             'phase_5.5/models/estate/prop_phone-LM_takePhone',
             'LM_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-LM_phoneNeutral',
             'LM_phoneBack':
             'phase_5.5/models/estate/prop_phone-LM_phoneBack',
             'LL_phoneOut':
             'phase_5.5/models/estate/prop_phone-LL_phoneOut',
             'LL_takePhone':
             'phase_5.5/models/estate/prop_phone-LL_takePhone',
             'LL_phoneNeutral':
             'phase_5.5/models/estate/prop_phone-LL_phoneNeutral',
             'LL_phoneBack':
             'phase_5.5/models/estate/prop_phone-LL_phoneBack'
         })
     self.model.pose('SS_phoneOut', 0)
     self.receiverJoint = self.model.find('**/joint_receiver')
     self.receiverGeom = self.receiverJoint.getChild(0)
     mount = loader.loadModel('phase_5.5/models/estate/phoneMount-mod')
     mount.setTransparency(0, 1)
     self.model.reparentTo(mount)
     self.ringSfx = loader.loadSfx('phase_3.5/audio/sfx/telephone_ring.ogg')
     self.handleSfx = loader.loadSfx(
         'phase_5.5/audio/sfx/telephone_handle2.ogg')
     self.hangUpSfx = loader.loadSfx(
         'phase_5.5/audio/sfx/telephone_hang_up.ogg')
     self.pickUpSfx = loader.loadSfx(
         'phase_5.5/audio/sfx/telephone_pickup1.ogg')
     if self.initialScale:
         mount.setScale(*self.initialScale)
         self.usedInitialScale = 1
     phoneSphere = CollisionSphere(0, -0.66, 0, 0.2)
     phoneSphere.setTangible(0)
     phoneSphereNode = CollisionNode(self.phoneSphereEvent)
     phoneSphereNode.setIntoCollideMask(ToontownGlobals.WallBitmask)
     phoneSphereNode.addSolid(phoneSphere)
     mount.attachNewNode(phoneSphereNode)
     if not self.model.find('**/CurveNode7').isEmpty():
         self.setupCord()
     return mount
Ejemplo n.º 11
0
    def __init__(self, fileName, name, size, hpr, position, color, localSize,
                 localPosition, localOrientation, joints, animations,
                 defaultAnimation, frame, control, texture, cRadius, cFloor,
                 cTop, cType, duration, collection):
        if name is None:
            name = fileName  #  Should parse off the directories
        Handle.__init__(self, name=name, duration=duration)
        self.d.hasJoints = len(joints) != 0
        self.d.joints = joints
        self.d.jointNodes = {}
        self.cRadius = static(cRadius)
        self.cFloor = static(cFloor)
        self.cTop = static(cTop)
        self.cType = static(cType)
        self.d.noHPR = False
        self.d.defaultAnimation = defaultAnimation
        ctl = newSignalRefd(self, "control", controlType, scEmptyControl)
        self.__dict__["control"] = ctl
        for j, pj in joints:
            self.__dict__[j] = newSignalRefd(self, j, HPRType, HPR(0, 0, 0),
                                             ctl)
        self.d.fileName = findModelFile(fileName)
        if self.d.hasJoints:
            if animations != None:
                self.d.model = Actor.Actor(self.d.fileName, animations)
                #self.d.model.reparentTo(render)
                if frame != None:
                    self.d.frame = frame
                else:
                    undefinedSignal(self,
                                    'frame')  # ????  Bad error message ...
            else:
                self.d.model = Actor.Actor(self.d.fileName)
            for j, pj in joints:
                self.d.jointNodes[j] = self.d.model.controlJoint(
                    None, "modelRoot", pj)
                if self.d.jointNodes[j] == None:
                    print 'joint not found: ' + j
                    exit()
        else:  #  Not jointed
            self.d.model = loader.loadModel(self.d.fileName)
            if self.d.model == None:
                print 'Model not found: ' + fileName
                exit()
        g.nextModelId = g.nextModelId + 1
        self.d.model.setTag('rpandaid', str(g.nextModelId))
        self.d.localSize = localSize
        self.d.localPosition = localPosition
        self.d.localOrientation = localOrientation
        self.d.onScreen = False
        self.__dict__['position'] = newSignalRefd(self, 'position', P3Type,
                                                  P3(0, 0, 0), ctl)
        self.__dict__['hpr'] = newSignalRefd(self, 'hpr', HPRType,
                                             HPR(0, 0, 0), ctl)
        self.__dict__['color'] = newSignalRefd(self, 'color', ColorType,
                                               noColor, ctl)
        self.__dict__['size'] = newSignalRefd(self, 'size', numType, 1, ctl)
        if size is not None:
            self.size.setBehavior(size)
        if position is not None:
            self.position.setBehavior(position)
        if control is not None:
            # print "Setting control", control
            self.control.setBehavior(control)
#        print hpr
#        print self.hpr.signal
        if hpr is not None:
            self.hpr.setBehavior(hpr)


#        print "HPR: "
#        print self.hpr.signal
        if color is not None:
            self.color.setBehavior(color)
        self.d.animPlaying = False  # This initializes it so there is no animation playing.
        if texture is not None:
            tex = loader.loadTexture(findTexture(texture))
            self.d.model.setTexture(tex, 1)
        if collection is not None:
            collection.add(self)
Ejemplo n.º 12
0
 def load(self):
     self.done = 0
     self.geyserTrack = None
     SafeZoneLoader.load(self)
     self.birdSound = map(base.loader.loadSfx, [
         'phase_4/audio/sfx/SZ_TC_bird1.ogg',
         'phase_4/audio/sfx/SZ_TC_bird2.ogg',
         'phase_4/audio/sfx/SZ_TC_bird3.ogg'
     ])
     self.underwaterSound = base.loader.loadSfx(
         'phase_4/audio/sfx/AV_ambient_water.ogg')
     self.swimSound = base.loader.loadSfx(
         'phase_4/audio/sfx/AV_swim_single_stroke.ogg')
     self.submergeSound = base.loader.loadSfx(
         'phase_5.5/audio/sfx/AV_jump_in_water.ogg')
     geyserPlacer = self.geom.find('**/geyser*')
     waterfallPlacer = self.geom.find('**/waterfall*')
     binMgr = CullBinManager.getGlobalPtr()
     binMgr.addBin('water', CullBinManager.BTFixed, 29)
     binMgr = CullBinManager.getGlobalPtr()
     self.water = self.geom.find('**/water1*')
     self.water.setTransparency(1)
     self.water.setColorScale(1.0, 1.0, 1.0, 1.0)
     self.water.setBin('water', 51, 1)
     pool = self.geom.find('**/pPlane5*')
     pool.setTransparency(1)
     pool.setColorScale(1.0, 1.0, 1.0, 1.0)
     pool.setBin('water', 50, 1)
     self.geyserModel = loader.loadModel(
         'phase_6/models/golf/golf_geyser_model')
     self.geyserSound = loader.loadSfx('phase_6/audio/sfx/OZ_Geyser.ogg')
     self.geyserSoundInterval = SoundInterval(self.geyserSound,
                                              node=geyserPlacer,
                                              listenerNode=base.camera,
                                              seamlessLoop=False,
                                              volume=1.0,
                                              cutOff=120)
     self.geyserSoundNoToon = loader.loadSfx(
         'phase_6/audio/sfx/OZ_Geyser_No_Toon.ogg')
     self.geyserSoundNoToonInterval = SoundInterval(
         self.geyserSoundNoToon,
         node=geyserPlacer,
         listenerNode=base.camera,
         seamlessLoop=False,
         volume=1.0,
         cutOff=120)
     if self.geyserModel:
         self.geyserActor = Actor.Actor(self.geyserModel)
         self.geyserActor.loadAnims(
             {'idle': 'phase_6/models/golf/golf_geyser'})
         self.geyserActor.reparentTo(render)
         self.geyserActor.setPlayRate(8.6, 'idle')
         self.geyserActor.loop('idle')
         self.geyserActor.setDepthWrite(0)
         self.geyserActor.setTwoSided(True, 11)
         self.geyserActor.setColorScale(1.0, 1.0, 1.0, 1.0)
         self.geyserActor.setBin('fixed', 0)
         mesh = self.geyserActor.find('**/mesh_tide1')
         joint = self.geyserActor.find('**/uvj_WakeWhiteTide1')
         mesh.setTexProjector(mesh.findTextureStage('default'), joint,
                              self.geyserActor)
         self.geyserActor.setPos(geyserPlacer.getPos())
         self.geyserActor.setZ(geyserPlacer.getZ() - 100.0)
         self.geyserPos = geyserPlacer.getPos()
         self.geyserPlacer = geyserPlacer
         self.startGeyser()
         base.sfxPlayer.setCutoffDistance(160)
         self.geyserPoolSfx = loader.loadSfx(
             'phase_6/audio/sfx/OZ_Geyser_BuildUp_Loop.ogg')
         self.geyserPoolSoundInterval = SoundInterval(
             self.geyserPoolSfx,
             node=self.geyserPlacer,
             listenerNode=base.camera,
             seamlessLoop=True,
             volume=1.0,
             cutOff=120)
         self.geyserPoolSoundInterval.loop()
         self.bubbles = Bubbles.Bubbles(self.geyserPlacer, render)
         self.bubbles.renderParent.setDepthWrite(0)
         self.bubbles.start()
     self.collBase = render.attachNewNode('collisionBase')
     self.geyserCollSphere = CollisionSphere(0, 0, 0, 7.5)
     self.geyserCollSphere.setTangible(1)
     self.geyserCollNode = CollisionNode('barrelSphere')
     self.geyserCollNode.setIntoCollideMask(OTPGlobals.WallBitmask)
     self.geyserCollNode.addSolid(self.geyserCollSphere)
     self.geyserNodePath = self.collBase.attachNewNode(self.geyserCollNode)
     self.geyserNodePath.setPos(self.geyserPos[0], self.geyserPos[1],
                                self.geyserPos[2] - 100.0)
     self.waterfallModel = loader.loadModel(
         'phase_6/models/golf/golf_waterfall_model')
     if self.waterfallModel:
         self.waterfallActor = Actor.Actor(self.waterfallModel)
         self.waterfallActor.loadAnims(
             {'idle': 'phase_6/models/golf/golf_waterfall'})
         self.waterfallActor.reparentTo(render)
         self.waterfallActor.setPlayRate(3.5, 'idle')
         self.waterfallActor.loop('idle')
         mesh = self.waterfallActor.find('**/mesh_tide1')
         joint = self.waterfallActor.find('**/uvj_WakeWhiteTide1')
         mesh.setTexProjector(mesh.findTextureStage('default'), joint,
                              self.waterfallActor)
     self.waterfallActor.setPos(waterfallPlacer.getPos())
     self.accept('clientLogout', self._handleLogout)
     return
Ejemplo n.º 13
0
 def __init__(self):
     PooledEffect.__init__(self)
     EffectController.__init__(self)
     self.modelParent = self.attachNewNode('ModelParent')
     model = loader.loadModel('models/effects/particleCards')
     self.effectModel = model.find('**/particleWhiteGlow')
     self.effectModel.reparentTo(self.modelParent)
     model = loader.loadModel('models/effects/particleCards')
     self.effectModel2 = model.find('**/particleWhiteGlow')
     self.effectModel2.reparentTo(self.modelParent)
     self.modelParent.setBillboardAxis(0)
     self.modelParent.setBillboardPointWorld()
     self.modelParent.setBin
     self.modelParent.setScale(1.4)
     self.modelParent.setColorScale(0, 0, 0, 1.0)
     self.modelParent.setBin('fixed', 0)
     self.effectActor = Actor.Actor(
         'models/effects/mopath_none',
         {'spin': 'models/effects/mopath_spiral'})
     self.effectActor.setPlayRate(-1.6, 'spin')
     self.effectActor.reparentTo(self)
     self.effectActor.setH(-90)
     self.effectActor.setPos(-0.6, -0.2, 0)
     self.effectActor.setScale(1, 1.2, 1)
     self.effectActor.setBin('fixed', 2)
     self.joint = self.effectActor.find('**/joint1')
     model = loader.loadModel('models/effects/particleMaps')
     self.card = model.find('**/particleEvilSmoke')
     if not self.particleDummy:
         self.particleDummy = render.attachNewNode(
             ModelNode('FlamingSkullParticleDummy'))
         self.particleDummy.setBin('fixed', 1)
     self.setDepthWrite(0)
     self.setFogOff()
     self.setLightOff()
     self.setColorScaleOff()
     self.hide(OTPRender.ShadowCameraBitmask)
     self.f = ParticleEffect.ParticleEffect('BlackspotCurseSword')
     self.f.reparentTo(self)
     self.p0 = Particles.Particles('particles-1')
     self.p0.setFactory('ZSpinParticleFactory')
     self.p0.setRenderer('SpriteParticleRenderer')
     self.p0.setEmitter('SphereVolumeEmitter')
     self.f.addParticles(self.p0)
     self.p0.setPoolSize(64)
     self.p0.setBirthRate(0.2)
     self.p0.setLitterSize(1)
     self.p0.setLitterSpread(0)
     self.p0.setSystemLifespan(0.0)
     self.p0.setLocalVelocityFlag(1)
     self.p0.setSystemGrowsOlderFlag(0)
     self.p0.factory.setLifespanBase(1.2)
     self.p0.factory.setLifespanSpread(0.5)
     self.p0.factory.setMassBase(1.0)
     self.p0.factory.setMassSpread(0.2)
     self.p0.factory.setTerminalVelocityBase(400.0)
     self.p0.factory.setTerminalVelocitySpread(0.0)
     self.p0.factory.setInitialAngle(0.0)
     self.p0.factory.setInitialAngleSpread(90.0)
     self.p0.factory.enableAngularVelocity(1)
     self.p0.factory.setAngularVelocity(0.0)
     self.p0.factory.setAngularVelocitySpread(20.0)
     self.p0.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAOUT)
     self.p0.renderer.setUserAlpha(1.0)
     self.p0.renderer.setFromNode(self.card)
     self.p0.renderer.setColor(Vec4(1.0, 1.0, 1.0, 1.0))
     self.p0.renderer.setXScaleFlag(1)
     self.p0.renderer.setYScaleFlag(1)
     self.p0.renderer.setAnimAngleFlag(1)
     self.p0.renderer.setInitialXScale(0.001 * self.cardScale)
     self.p0.renderer.setInitialYScale(0.0012 * self.cardScale)
     self.p0.renderer.setFinalXScale(0.0003 * self.cardScale)
     self.p0.renderer.setFinalYScale(0.0003 * self.cardScale)
     self.p0.renderer.setNonanimatedTheta(0.0)
     self.p0.renderer.setAlphaBlendMethod(
         BaseParticleRenderer.PPBLENDLINEAR)
     self.p0.renderer.setAlphaDisable(0)
     self.p0.renderer.getColorInterpolationManager().addLinear(
         0.0, 1.0, Vec4(0.5, 0.5, 0.5, 1.0), Vec4(0, 0, 0, 1.0), 1)
     self.p0.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE)
     self.p0.emitter.setAmplitude(-0.25)
     self.p0.emitter.setAmplitudeSpread(0.5)
     self.p0.emitter.setOffsetForce(Vec3(0.0, 0.0, 0.5))
     self.p0.emitter.setExplicitLaunchVector(Vec3(1.0, 0.0, 0.0))
     self.p0.emitter.setRadiateOrigin(Point3(0.0, 0.0, 0.0))
     self.p0.emitter.setRadius(0.4)
     self.f2 = ParticleEffect.ParticleEffect('BlackspotPestilence')
     self.f2.reparentTo(self)
     self.p1 = Particles.Particles('particles-1')
     self.p1.setFactory('ZSpinParticleFactory')
     self.p1.setRenderer('SpriteParticleRenderer')
     self.p1.setEmitter('SphereVolumeEmitter')
     self.f2.addParticles(self.p1)
     self.p1.setPoolSize(128)
     self.p1.setBirthRate(0.01)
     self.p1.setLitterSize(2)
     self.p1.setLitterSpread(0)
     self.p1.setSystemLifespan(0.0)
     self.p1.setLocalVelocityFlag(0)
     self.p1.setSystemGrowsOlderFlag(0)
     self.p1.factory.setLifespanBase(1.0)
     self.p1.factory.setLifespanSpread(0.2)
     self.p1.factory.setMassBase(1.0)
     self.p1.factory.setMassSpread(0.0)
     self.p1.factory.setTerminalVelocityBase(400.0)
     self.p1.factory.setTerminalVelocitySpread(0.0)
     self.p1.factory.setInitialAngle(0.0)
     self.p1.factory.setInitialAngleSpread(360.0)
     self.p1.factory.enableAngularVelocity(1)
     self.p1.factory.setAngularVelocity(300.0)
     self.p1.factory.setAngularVelocitySpread(25.0)
     self.p1.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAOUT)
     self.p1.renderer.setUserAlpha(1.0)
     self.p1.renderer.setFromNode(self.card)
     self.p1.renderer.setXScaleFlag(1)
     self.p1.renderer.setYScaleFlag(1)
     self.p1.renderer.setAnimAngleFlag(1)
     self.p1.renderer.setNonanimatedTheta(0.0)
     self.p1.renderer.setAlphaBlendMethod(
         BaseParticleRenderer.PPBLENDLINEAR)
     self.p1.renderer.setAlphaDisable(0)
     self.p1.renderer.getColorInterpolationManager().addLinear(
         0.0, 1.0, Vec4(0.5, 0.5, 0.5, 1.0), Vec4(0, 0, 0, 1.0), 1)
     self.p1.renderer.setInitialXScale(0.001 * self.cardScale2)
     self.p1.renderer.setFinalXScale(0.0001 * self.cardScale2)
     self.p1.renderer.setInitialYScale(0.001 * self.cardScale2)
     self.p1.renderer.setFinalYScale(0.0001 * self.cardScale2)
     self.p1.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE)
     self.p1.emitter.setAmplitude(0.2)
     self.p1.emitter.setAmplitudeSpread(0.5)
     self.p1.emitter.setOffsetForce(Vec3(0.0, 0.0, -0.45))
     self.p1.emitter.setExplicitLaunchVector(Vec3(1.0, 0.0, 0.0))
     self.p1.emitter.setRadiateOrigin(Point3(0.0, 0.0, 0.0))
     self.p1.emitter.setRadius(0.01)
Ejemplo n.º 14
0
    def generate(self, gender, head, headtype):
        if not head == 'dog':
            h = loader.loadModel(
                'phase_3/models/char/' + head + '-heads-' +
                str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam')
        else:
            h = Actor(
                'phase_3/models/char/tt_a_chr_' + headtype + '_head_' +
                str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam', {
                    'neutral':
                    'phase_3/models/char/tt_a_chr_' + headtype +
                    '_head_neutral.bam',
                    'run':
                    'phase_3/models/char/tt_a_chr_' + headtype +
                    '_head_run.bam',
                    'walk':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_walk.bam',
                    'pie':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_pie-throw.bam',
                    'fallb':
                    'phase_4/models/char/tt_a_chr_' + headtype +
                    '_head_slip-backward.bam',
                    'fallf':
                    'phase_4/models/char/tt_a_chr_' + headtype +
                    '_head_slip-forward.bam',
                    'lose':
                    'phase_5/models/char/tt_a_chr_' + headtype +
                    '_head_lose.bam',
                    'win':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_victory-dance.bam',
                    'squirt':
                    'phase_5/models/char/tt_a_chr_' + headtype +
                    '_head_water-gun.bam',
                    'zend':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_jump-zend.bam',
                    'tele':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_teleport.bam',
                    'book':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_book.bam',
                    'leap':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_leap_zhang.bam',
                    'jump':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_jump-zhang.bam',
                    'happy':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_jump.bam',
                    'shrug':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_shrug.bam',
                    'hdance':
                    'phase_5/models/char/tt_a_chr_' + headtype +
                    '_head_happy-dance.bam',
                    'wave':
                    'phase_3.5/models/char/tt_a_chr_' + headtype +
                    '_head_wave.bam'
                })
        if headtype == '1':
            try:
                h.find('**/eyes-long').hide()
            except:
                pass

            try:
                h.find('**/ears-long').hide()
            except:
                pass

            try:
                h.find('**/head-long').hide()
            except:
                pass

            try:
                h.find('**/joint_pupilR_long').hide()
                h.find('**/joint_pupilL_long').hide()
            except:
                pass

            try:
                h.find('**/head-front-long').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-surprise').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-neutral').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-surprise').hide()
            except:
                pass

        else:
            if headtype == '2':
                try:
                    h.find('**/eyes-short').hide()
                except:
                    pass

                try:
                    h.find('**/ears-short').hide()
                except:
                    pass

                try:
                    h.find('**/head-short').hide()
                except:
                    pass

                try:
                    h.find('**/joint_pupilR_short').hide()
                    h.find('**/joint_pupilL_short').hide()
                except:
                    pass

                try:
                    h.find('**/head-front-short').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-laugh').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-angry').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-smile').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-sad').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-surprise').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-long-neutral').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-short-laugh').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-short-angry').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-short-smile').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-short-sad').hide()
                except:
                    pass

                try:
                    h.find('**/muzzle-short-surprise').hide()
                except:
                    pass

            else:
                if headtype == '3':
                    try:
                        h.find('**/eyes-long').hide()
                    except:
                        pass

                    try:
                        h.find('**/ears-long').hide()
                    except:
                        pass

                    try:
                        h.find('**/head-long').hide()
                    except:
                        pass

                    try:
                        h.find('**/joint_pupilR_long').hide()
                        h.find('**/joint_pupilL_long').hide()
                    except:
                        pass

                    try:
                        h.find('**/head-front-long').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-long-laugh').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-long-angry').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-long-smile').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-long-sad').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-long-surprise').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-neutral').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-laugh').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-angry').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-smile').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-sad').hide()
                    except:
                        pass

                    try:
                        h.find('**/muzzle-short-surprise').hide()
                    except:
                        pass

                else:
                    if headtype == '4':
                        try:
                            h.find('**/eyes-short').hide()
                        except:
                            pass

                        try:
                            h.find('**/ears-short').hide()
                        except:
                            pass

                        try:
                            h.find('**/head-short').hide()
                        except:
                            pass

                        try:
                            h.find('**/head-front-short').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-long-laugh').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-long-angry').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-long-smile').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-long-sad').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-long-surprise').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-neutral').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-laugh').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-angry').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-smile').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-sad').hide()
                        except:
                            pass

                        try:
                            h.find('**/muzzle-short-surprise').hide()
                        except:
                            pass

            if gender == 'girl':
                lashes = loader.loadModel('phase_3/models/char/' + head +
                                          '-lashes.bam')
                lashes.reparentTo(h)
                if headtype == '1' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts':
                    lashes.find('**/open-long').hide()
                    lashes.find('**/closed-long').hide()
                    lashes.find('**/closed-short').hide()
                else:
                    if headtype == '2' or headtype == 'dgl_shorts':
                        lashes.find('**/open-short').hide()
                        lashes.find('**/closed-short').hide()
                        lashes.find('**/closed-long').hide()
                    else:
                        if headtype == '3' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts':
                            lashes.find('**/open-long').hide()
                            lashes.find('**/closed-long').hide()
                            lashes.find('**/closed-short').hide()
                        else:
                            if headtype == '4' or headtype == 'dgl_shorts':
                                lashes.find('**/open-short').hide()
                                lashes.find('**/closed-short').hide()
                                lashes.find('**/closed-long').hide()
                return tuple((h, lashes))
        return h
Ejemplo n.º 15
0
    def load(self):
        self.done = 0
        self.geyserTrack = None
        SafeZoneLoader.load(self)
        self.birdSound = map(base.loadSfx, [
            'phase_4/audio/sfx/SZ_TC_bird1.ogg',
            'phase_4/audio/sfx/SZ_TC_bird2.ogg',
            'phase_4/audio/sfx/SZ_TC_bird3.ogg'
        ])
        self.underwaterSound = base.loadSfx(
            'phase_4/audio/sfx/AV_ambient_water.ogg')
        self.swimSound = base.loadSfx(
            'phase_4/audio/sfx/AV_swim_single_stroke.ogg')
        self.submergeSound = base.loadSfx(
            'phase_5.5/audio/sfx/AV_jump_in_water.ogg')
        geyserPlacer = self.geom.find('**/geyser*')
        waterfallPlacer = self.geom.find('**/waterfall*')
        binMgr = CullBinManager.getGlobalPtr()
        binMgr.addBin('water', CullBinManager.BTFixed, 29)
        binMgr = CullBinManager.getGlobalPtr()
        water = self.geom.find('**/water1')
        water.setTransparency(1)
        water.setColorScale(1, 1, 1, 1)
        water.setBin('water', 51, 1)
        pool = self.geom.find('**/pPlane5*')
        pool.setTransparency(1)
        pool.setColorScale(1.0, 1.0, 1.0, 1.0)
        pool.setBin('water', 50, 1)
        self.geyserModel = loader.loadModel(
            'phase_6/models/golf/golf_geyser_model')
        self.geyserSound = loader.loadSfx('phase_6/audio/sfx/OZ_Geyser.ogg')
        self.geyserSoundInterval = SoundInterval(self.geyserSound,
                                                 node=geyserPlacer,
                                                 listenerNode=base.camera,
                                                 seamlessLoop=False,
                                                 volume=1.0,
                                                 cutOff=120)
        self.geyserSoundNoToon = loader.loadSfx(
            'phase_6/audio/sfx/OZ_Geyser_No_Toon.ogg')
        self.geyserSoundNoToonInterval = SoundInterval(
            self.geyserSoundNoToon,
            node=geyserPlacer,
            listenerNode=base.camera,
            seamlessLoop=False,
            volume=1.0,
            cutOff=120)
        if self.geyserModel:
            self.geyserActor = Actor.Actor(self.geyserModel)
            self.geyserActor.loadAnims(
                {'idle': 'phase_6/models/golf/golf_geyser'})
            self.geyserActor.reparentTo(render)
            self.geyserActor.setPlayRate(8.6, 'idle')
            self.geyserActor.loop('idle')
            self.geyserActor.setDepthWrite(0)
            self.geyserActor.setTwoSided(True, 11)
            self.geyserActor.setColorScale(1.0, 1.0, 1.0, 1.0)
            self.geyserActor.setBin('fixed', 0)
            mesh = self.geyserActor.find('**/mesh_tide1')
            joint = self.geyserActor.find('**/uvj_WakeWhiteTide1')
            mesh.setTexProjector(mesh.findTextureStage('default'), joint,
                                 self.geyserActor)
            self.geyserActor.setPos(geyserPlacer.getPos())
            self.geyserActor.setZ(geyserPlacer.getZ() - 100.0)
            self.geyserPos = geyserPlacer.getPos()
            self.geyserPlacer = geyserPlacer
            self.startGeyser()
            base.sfxPlayer.setCutoffDistance(160)
            self.geyserPoolSfx = loader.loadSfx(
                'phase_6/audio/sfx/OZ_Geyser_BuildUp_Loop.ogg')
            self.geyserPoolSoundInterval = SoundInterval(
                self.geyserPoolSfx,
                node=self.geyserPlacer,
                listenerNode=base.camera,
                seamlessLoop=True,
                volume=1.0,
                cutOff=120)
            self.geyserPoolSoundInterval.loop()
            self.bubbles = Bubbles.Bubbles(self.geyserPlacer, render)
            self.bubbles.renderParent.setDepthWrite(0)
            self.bubbles.start()
        self.collBase = render.attachNewNode('collisionBase')
        self.geyserCollSphere = CollisionSphere(0, 0, 0, 7.5)
        self.geyserCollSphere.setTangible(1)
        self.geyserCollNode = CollisionNode('barrelSphere')
        self.geyserCollNode.setIntoCollideMask(OTPGlobals.WallBitmask)
        self.geyserCollNode.addSolid(self.geyserCollSphere)
        self.geyserNodePath = self.collBase.attachNewNode(self.geyserCollNode)
        self.geyserNodePath.setPos(self.geyserPos[0], self.geyserPos[1],
                                   self.geyserPos[2] - 100.0)
        self.waterfallModel = loader.loadModel(
            'phase_6/models/golf/golf_waterfall_model')
        if self.waterfallModel:
            self.waterfallActor = Actor.Actor(self.waterfallModel)
            self.waterfallActor.loadAnims(
                {'idle': 'phase_6/models/golf/golf_waterfall'})
            self.waterfallActor.reparentTo(render)
            self.waterfallActor.setPlayRate(3.5, 'idle')
            self.waterfallActor.loop('idle')
            mesh = self.waterfallActor.find('**/mesh_tide1')
            joint = self.waterfallActor.find('**/uvj_WakeWhiteTide1')
            mesh.setTexProjector(mesh.findTextureStage('default'), joint,
                                 self.waterfallActor)
        self.waterfallActor.setPos(waterfallPlacer.getPos())
        self.accept('clientLogout', self._handleLogout)

        # If Chestnut Park is under construction, create the construction site:
        if base.config.GetBool('want-chestnut-park-construction', False):
            if base.config.GetBool('want-oz-painter-pete', False):
                self.painterPete = Toon.Toon()

                self.painterPete.setName('Painter Pete')
                self.painterPete.setPickable(0)
                self.painterPete.setPlayerType(NametagGlobals.CCNonPlayer)

                dna = ToonDNA.ToonDNA()
                dna.newToonFromProperties('hls', 'ss', 'm', 'm', 18, 0, 13, 9,
                                          0, 0, 0, 0, 2, 15)
                self.painterPete.setDNA(dna)

                self.painterPete.setHat(43, 0, 0)

                self.painterPete.animFSM.request('neutral')
                self.painterPete.reparentTo(self.constructionSite)
                self.painterPete.setPosHpr(-52.5, -133.5, 0.025, 338, 0, 0)

                self.painterPete.sadEyes()
                self.painterPete.blinkEyes()

        return
Ejemplo n.º 16
0
    def __init__(self):
        # Preliminary capabilities check.

        if not base.win.getGsg().getSupportsBasicShaders():
            self.t = addTitle(
                "Shadow Demo: Video driver reports that shaders are not supported."
            )
            return
        if not base.win.getGsg().getSupportsDepthTexture():
            self.t = addTitle(
                "Shadow Demo: Video driver reports that depth textures are not supported."
            )
            return

        # creating the offscreen buffer.

        winprops = WindowProperties.size(512, 512)
        props = FrameBufferProperties()
        props.setRgbColor(1)
        props.setAlphaBits(1)
        props.setDepthBits(1)
        LBuffer = base.graphicsEngine.makeOutput(base.pipe, "offscreen buffer",
                                                 -2, props, winprops,
                                                 GraphicsPipe.BFRefuseWindow,
                                                 base.win.getGsg(), base.win)
        self.buffer = LBuffer

        if not LBuffer:
            self.t = addTitle(
                "Shadow Demo: Video driver cannot create an offscreen buffer.")
            return

        Ldepthmap = Texture()
        LBuffer.addRenderTexture(Ldepthmap, GraphicsOutput.RTMBindOrCopy,
                                 GraphicsOutput.RTPDepthStencil)
        if base.win.getGsg().getSupportsShadowFilter():
            Ldepthmap.setMinfilter(Texture.FTShadow)
            Ldepthmap.setMagfilter(Texture.FTShadow)

        # Adding a color texture is totally unnecessary, but it helps with
        # debugging.
        Lcolormap = Texture()
        LBuffer.addRenderTexture(Lcolormap, GraphicsOutput.RTMBindOrCopy,
                                 GraphicsOutput.RTPColor)

        self.inst_p = addInstructions(0.06,
                                      'P : stop/start the Panda Rotation')
        self.inst_w = addInstructions(0.12, 'W : stop/start the Walk Cycle')
        self.inst_t = addInstructions(0.18, 'T : stop/start the Teapot')
        self.inst_l = addInstructions(0.24,
                                      'L : move light source far or close')
        self.inst_v = addInstructions(0.30,
                                      'V : View the Depth-Texture results')
        self.inst_u = addInstructions(0.36,
                                      'U : toggle updating the shadow map')
        self.inst_x = addInstructions(
            0.42, 'Left/Right Arrow : switch camera angles')
        self.inst_a = addInstructions(0.48,
                                      'Something about A/Z and push bias')

        base.setBackgroundColor(0, 0, 0.2, 1)

        base.camLens.setNearFar(1.0, 10000)
        base.camLens.setFov(75)
        base.disableMouse()

        # Load the scene.

        floorTex = loader.loadTexture('maps/envir-ground.jpg')
        cm = CardMaker('')
        cm.setFrame(-2, 2, -2, 2)
        floor = render.attachNewNode(PandaNode("floor"))
        for y in range(12):
            for x in range(12):
                nn = floor.attachNewNode(cm.generate())
                nn.setP(-90)
                nn.setPos((x - 6) * 4, (y - 6) * 4, 0)
        floor.setTexture(floorTex)
        floor.flattenStrong()

        self.pandaAxis = render.attachNewNode('panda axis')
        self.pandaModel = Actor.Actor('panda-model', {'walk': 'panda-walk4'})
        self.pandaModel.reparentTo(self.pandaAxis)
        self.pandaModel.setPos(9, 0, 0)
        self.pandaModel.setShaderInput("scale", 0.01, 0.01, 0.01, 1.0)
        self.pandaWalk = self.pandaModel.actorInterval('walk', playRate=1.8)
        self.pandaWalk.loop()
        self.pandaMovement = self.pandaAxis.hprInterval(20.0,
                                                        LPoint3(-360, 0, 0),
                                                        startHpr=LPoint3(
                                                            0, 0, 0))
        self.pandaMovement.loop()

        self.teapot = loader.loadModel('teapot')
        self.teapot.reparentTo(render)
        self.teapot.setPos(0, -20, 10)
        self.teapot.setShaderInput("texDisable", 1, 1, 1, 1)
        self.teapotMovement = self.teapot.hprInterval(50, LPoint3(0, 360, 360))
        self.teapotMovement.loop()

        self.accept('escape', sys.exit)

        self.accept("arrow_left", self.incrementCameraPosition, [-1])
        self.accept("arrow_right", self.incrementCameraPosition, [1])
        self.accept("p", self.toggleInterval, [self.pandaMovement])
        self.accept("t", self.toggleInterval, [self.teapotMovement])
        self.accept("w", self.toggleInterval, [self.pandaWalk])
        self.accept("v", base.bufferViewer.toggleEnable)
        self.accept("u", self.toggleUpdateShadowMap)
        self.accept("l", self.incrementLightPosition, [1])
        self.accept("o", base.oobe)
        self.accept('a', self.adjustPushBias, [1.1])
        self.accept('z', self.adjustPushBias, [0.9])

        self.LCam = base.makeCamera(LBuffer)
        self.LCam.node().setScene(render)
        self.LCam.node().getLens().setFov(40)
        self.LCam.node().getLens().setNearFar(10, 100)

        # default values
        self.pushBias = 0.04
        self.ambient = 0.2
        self.cameraSelection = 0
        self.lightSelection = 0

        # setting up shader
        render.setShaderInput('light', self.LCam)
        render.setShaderInput('Ldepthmap', Ldepthmap)
        render.setShaderInput('ambient', self.ambient, 0, 0, 1.0)
        render.setShaderInput('texDisable', 0, 0, 0, 0)
        render.setShaderInput('scale', 1, 1, 1, 1)

        # Put a shader on the Light camera.
        lci = NodePath(PandaNode("Light Camera Initializer"))
        lci.setShader(loader.loadShader('caster.sha'))
        self.LCam.node().setInitialState(lci.getState())

        # Put a shader on the Main camera.
        # Some video cards have special hardware for shadow maps.
        # If the card has that, use it.  If not, use a different
        # shader that does not require hardware support.

        mci = NodePath(PandaNode("Main Camera Initializer"))
        if base.win.getGsg().getSupportsShadowFilter():
            mci.setShader(loader.loadShader('shadow.sha'))
        else:
            mci.setShader(loader.loadShader('shadow-nosupport.sha'))
        base.cam.node().setInitialState(mci.getState())

        self.incrementCameraPosition(0)
        self.incrementLightPosition(0)
        self.adjustPushBias(1.0)
Ejemplo n.º 17
0
def copyProp(prop):
    from direct.actor import Actor
    if isinstance(prop, Actor.Actor):
        return Actor.Actor(other=prop)
    else:
        return prop.copyTo(hidden)
Ejemplo n.º 18
0
    def __init__(self, fileName, size, hpr, position, tag, color, texture,
                 name, parent, duration, frame, joints, animation):
        Proxy.Proxy.__init__(self,
                             name=str(name) + ":" +
                             str(PandaGlobals.nextModelId),
                             updater=modelUpdater,
                             types={
                                 "position": p3Type,
                                 "hpr": hprType,
                                 "size": numType,
                                 "color": colorType,
                                 "texture": stringType
                             })
        modelTypes = {
            "localOrientation": hprType,
            "localSize": numType,
            "localPosition": p3Type,
            "cRadius": numType,
            "cType": stringType,
            "cFloor": numType,
            "cTop": numType
        }
        #(p3Type, SP3(0,0,0)), "hpr": (hprType, SHPR(0,0,0)), "size": (numType, 1)})
        PandaGlobals.nextModelId = PandaGlobals.nextModelId + 1
        self._parent = getModel(parent)
        self._mFile = FileSearch.fileSearch(fileName, "models", ["egg"])
        #print("Object Name: "+ str(fileName)+"-gID: "+str(PandaGlobals.nextModelId))
        if type(tag) == type("s"):
            collections = [tag]
        else:
            collections = tag
        self._collections = collections
        if fileName in parameterCache:
            self._mParams = parameterCache[fileName]
        elif self._mFile is None:
            print("Can't find model " +
                  repr(fileName))  #should substitute pandafor unknown models
        #self._mFile = Filename("/c/Panda3D-1.8.1/models/"+fileName)
        #print("File Path: " + repr(mFile))
        else:
            mParamFile = Filename(self._mFile)
            #print(repr(mParamFile))
            mParamFile.setExtension("model")
            if mParamFile.exists():
                self._mParams = FileIO.loadDict(
                    mParamFile,
                    types=modelTypes,
                    defaults=defaultModelParameters)
            else:
                print("No .model for " + str(fileName))
                self._mParams = defaultModelParameters
            parameterCache[fileName] = self._mParams
        self._hasJoints = len(joints) != 0
        self._joints = joints
        self._jointNodes = {}
        self._animation = animation

        if animation != None:
            self._pandaModel = Actor.Actor(fileName, animation)
            if frame != None:
                self._frame = frame
        else:  #  Not animated
            self._pandaModel = loader.loadModel(self._mFile)
            if self._pandaModel == None:
                print('Model not found: ' + fileName)
                exit()
        if self._hasJoints:
            for j, pj in joints:
                self._jointNodes[j] = self._pandaModel.controlJoint(
                    None, "modelRoot", pj)
                if self._jointNodes[j] == None:
                    print('joint not found: ' + j)
                    exit()
        self._pandaModel.setTag('rpandaid', str(self._name))
        self._fileName = fileName
        self._onScreen = False
        self._animPlaying = False
        self._size = self._mParams['localSize']
        self._hpr = self._mParams['localOrientation']
        self._position = self._mParams['localPosition']
        self._cRadius = float(self._mParams['cRadius'])
        self._cType = self._mParams['cType']
        self._cFloor = float(self._mParams['cFloor'])
        self._cTop = float(self._mParams['cTop'])
        self._currentTexture = ""
        self._onscreen = False  # This defers the reparenting until the model has been updated the first time
        self._parent = getModel(parent)
        if position is not None:
            self.position = position
        else:
            self.position = P3(0, 0, 0)
        if hpr is not None:
            self.hpr = hpr
        else:
            self.hpr = SHPR(0, 0, 0)
        if size is not None:
            self.size = size
        else:
            self.size = 1
        if texture is not None:
            self.texture = texture
        else:
            self.texture = ""
        if color is not None:
            self.color = color
        else:
            self.color = noColor
        for tag in collections:
            if tag not in frpGlobals.collections:
                frpGlobals.collections[tag] = [self]
            frpGlobals.collections[tag].append(self)

        #Get saved reaction functions for this collection
        for t, v in frpGlobals.collectionReactions.items():
            for tag in collections:
                if tag in v:
                    for args in v[tag]:
                        getattr(Functions, t)(self, args[0], what=args[1])
        if duration > 0:
            react(self, delay(duration), exitScene)
    def enterSetup(self):
        # ropes = loader.loadModel('phase_4/models/modules/tt_m_ara_int_ropes')
        # ropes.reparentTo(self.interior)
        self.sillyMeter = Actor.Actor('phase_4/models/props/tt_a_ara_ttc_sillyMeter_default', {'arrowTube': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_arrowFluid',
         'phaseOne': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseOne',
         'phaseTwo': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseTwo',
         'phaseThree': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseThree',
         'phaseFour': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseFour',
         'phaseFourToFive': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseFourToFive',
         'phaseFive': 'phase_4/models/props/tt_a_ara_ttc_sillyMeter_phaseFive'})
        # self.sillyMeter.reparentTo(self.interior)
        self.interior.find('**/sillyOMeterSign').removeNode()

        # self.flatSillyMeter = loader.loadModel('phase_3.5/models/modules/tt_m_ara_int_sillyMeterFlat')
        # self.flatSillyMeter.reparentTo(self.interior)
        # self.flatSillyMeter.hide()
        # self.flatDuck = loader.loadModel('phase_3.5/models/modules/tt_m_ara_int_scientistDuckFlat')
        # loc1 = self.interior.find('**/npc_origin_1')
        # if loc1:
            # self.flatDuck.reparentTo(loc1)
        # self.flatDuck.hide()
        # self.flatMonkey = loader.loadModel('phase_3.5/models/modules/tt_m_ara_int_scientistMonkeyFlat')
        # loc1 = self.interior.find('**/npc_origin_2')
        # if loc1:
            # self.flatMonkey.reparentTo(loc1)
        # self.flatMonkey.hide()
        # self.flatHorse = loader.loadModel('phase_3.5/models/modules/tt_m_ara_int_scientistHorseFlat')
        # loc1 = self.interior.find('**/npc_origin_3')
        # if loc1:
            # self.flatHorse.reparentTo(loc1)
        # self.flatHorse.hide()
        self.smPhase1 = self.sillyMeter.find('**/stage1')
        self.smPhase2 = self.sillyMeter.find('**/stage2')
        self.smPhase3 = self.sillyMeter.find('**/stage3')
        self.smPhase4 = self.sillyMeter.find('**/stage4')
        self.smPhase2.hide()
        self.smPhase3.hide()
        self.smPhase4.hide()
        thermometerLocator = self.sillyMeter.findAllMatches('**/uvj_progressBar')[1]
        thermometerMesh = self.sillyMeter.find('**/tube')
        thermometerMesh.setTexProjector(thermometerMesh.findTextureStage('default'), thermometerLocator, self.sillyMeter)
        self.sillyMeter.flattenMedium()
        self.sillyMeter.makeSubpart('arrow', ['uvj_progressBar*', 'def_springA'])
        self.sillyMeter.makeSubpart('meter', ['def_pivot'], ['uvj_progressBar*', 'def_springA'])
        self.audio3d = Audio3DManager.Audio3DManager(base.sfxManagerList[0], base.camera)
        self.phase1Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseOne.ogg')
        self.phase1Sfx.setLoop(True)
        self.phase2Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseTwo.ogg')
        self.phase2Sfx.setLoop(True)
        self.phase3Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseThree.ogg')
        self.phase3Sfx.setLoop(True)
        self.phase4Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseFour.ogg')
        self.phase4Sfx.setLoop(True)
        self.phase4To5Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseFourToFive.ogg')
        self.phase4To5Sfx.setLoop(False)
        self.phase5Sfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterPhaseFive.ogg')
        self.phase5Sfx.setLoop(True)
        self.arrowSfx = self.audio3d.loadSfx('phase_4/audio/sfx/tt_s_prp_sillyMeterArrow.ogg')
        self.arrowSfx.setLoop(False)
        self.audio3d.setDropOffFactor(0.1)
        self.accept('SillyMeterPhase', self.selectPhase)
        self.accept('SillyMeterIsRunning', self.sillyMeterIsRunning)
        self.startIfNeeded()
Ejemplo n.º 20
0
    def makeNodePath(self):
        self.nodePath = Actor.Actor() #NodePath(self.uniqueName("chairNodePath"))        

        self.chair = self.nodePath.attachNewNode('myChair')
Ejemplo n.º 21
0
    def setGameReady(self):
        self.notify.debug('setGameReady')
        if not self.hasLocalToon:
            return
        if DistributedMinigame.setGameReady(self):
            return
        self.dead = 0
        self.difficultyPatterns = {
            ToontownGlobals.ToontownCentral: [1, 1.5, 65, 3],
            ToontownGlobals.DonaldsDock: [1, 1.3, 65, 1],
            ToontownGlobals.DaisyGardens: [2, 1.2, 65, 1],
            ToontownGlobals.MinniesMelodyland: [2, 1.0, 65, 1],
            ToontownGlobals.TheBrrrgh: [3, 1.0, 65, 1],
            ToontownGlobals.DonaldsDreamland: [3, 1.0, 65, 1]
        }
        pattern = self.difficultyPatterns[self.getSafezoneId()]
        self.NUMCRABS = pattern[0]
        self.SPEEDMULT = pattern[1]
        self.TIME = pattern[2]
        loadBase = 'phase_4/models/char/'
        for i in xrange(self.NUMCRABS):
            self.crabs.append(
                Actor.Actor(loadBase + 'kingCrab-zero.bam',
                            {'anim': loadBase + 'kingCrab-swimLOOP.bam'}))

        for i in xrange(len(self.crabs)):
            crab = self.crabs[i]
            crab.reparentTo(render)
            crab.name = 'king'
            crab.crabId = i
            cSphere = CollisionSphere(0.0, 0.0, 1, 1.3)
            cSphereNode = CollisionNode('crabby' + str(i))
            cSphereNode.addSolid(cSphere)
            cSphereNode.setFromCollideMask(BitMask32.allOff())
            cSphereNode.setIntoCollideMask(DivingGameGlobals.CollideMask)
            cSphereNodePath = crab.attachNewNode(cSphereNode)
            cSphereNodePath.setScale(1, 3, 1)
            self.accept('hitby-' + 'crabby' + str(i), self.fishCollision)
            if i % 2 is 0:
                crab.setPos(20, 0, -40)
                crab.direction = -1
            else:
                crab.setPos(-20, 0, -40)
                crab.direction = 1
            crab.loop('anim')
            crab.setScale(1, 0.3, 1)
            crab.moveLerp = Sequence()

        self.collHandEvent = CollisionHandlerEvent()
        self.cTrav = CollisionTraverser('DistributedDiverGame')
        self.cTrav2 = CollisionTraverser('DistributedDiverGame')
        self.collHandEvent.addInPattern('reach-%in')
        self.collHandEvent.addAgainPattern('reach-%in')
        self.collHandEvent.addInPattern('into-%in')
        self.collHandEvent.addInPattern('hitby-%in')
        loadBase = 'phase_4/models/minigames/'
        self.treasures = []
        self.chestIcons = {}
        for i in xrange(self.NUMTREASURES):
            self.chestIcons[i] = loader.loadModel(loadBase +
                                                  'treasure_chest.bam')
            self.chestIcons[i].reparentTo(self.mapModel)
            self.chestIcons[i].setScale(1.5)
            treasure = DivingTreasure.DivingTreasure(i)
            self.accept('grab-' + str(i), self.__treasureGrabbed)
            self.collHandEvent.addInPattern('grab-%in')
            self.collHandEvent.addAgainPattern('grab-%in')
            self.treasures.append(treasure)

        self.cTrav.traverse(render)
        spawnX = 24 * self.LAG_COMP
        spawnY = 0.6
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(0, 1, Point3(-spawnX, spawnY, 25),
                                            self.collHandEvent))
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(1, -1, Point3(spawnX, spawnY, 16),
                                            self.collHandEvent))
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(2, 1, Point3(-spawnX, spawnY, 6),
                                            self.collHandEvent))
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(3, -1, Point3(spawnX, spawnY, -4),
                                            self.collHandEvent))
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(4, 1, Point3(-spawnX, spawnY, -15),
                                            self.collHandEvent))
        self.spawners.append(
            DivingFishSpawn.DivingFishSpawn(5, -1, Point3(spawnX, spawnY, -23),
                                            self.collHandEvent))
        for spawner in self.spawners:
            spawner.lastSpawn = 0

        cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.4)
        cSphereNode = CollisionNode('%s' % self.localAvId)
        cSphereNode.addSolid(cSphere)
        cSphereNode.setFromCollideMask(DivingGameGlobals.CollideMask)
        cSphereNode.setIntoCollideMask(BitMask32.allOff())
        headparts = base.localAvatar.getHeadParts()
        pos = headparts[2].getPos()
        self.cSphereNodePath1 = base.localAvatar.attachNewNode(cSphereNode)
        self.cSphereNodePath1.setPos(pos + Point3(0, 1.5, 1))
        self.cTrav.addCollider(self.cSphereNodePath1, self.collHandEvent)
        cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.4)
        cSphereNode = CollisionNode('%s' % self.localAvId)
        cSphereNode.addSolid(cSphere)
        cSphereNode.setFromCollideMask(DivingGameGlobals.CollideMask)
        cSphereNode.setFromCollideMask(BitMask32.allOff())
        cSphereNode.setIntoCollideMask(BitMask32.allOff())
        headparts = base.localAvatar.getHeadParts()
        pos = headparts[2].getPos()
        self.cSphereNodePath2 = base.localAvatar.attachNewNode(cSphereNode)
        self.cSphereNodePath2.setPos(pos + Point3(0, 1.5, -1))
        self.cTrav.addCollider(self.cSphereNodePath2, self.collHandEvent)
        self.pusher = CollisionHandlerPusher()
        self.pusher.addCollider(self.cSphereNodePath1, base.localAvatar)
        self.pusher.addCollider(self.cSphereNodePath2, base.localAvatar)
        self.pusher.setHorizontal(0)
        self.cTrav2.addCollider(self.cSphereNodePath1, self.pusher)
        self.cTrav2.addCollider(self.cSphereNodePath2, self.pusher)
        self.remoteToonCollNPs = {}
        for avId in self.remoteAvIdList:
            toon = self.getAvatar(avId)
            if toon:
                headparts = toon.getHeadParts()
                pos = headparts[2].getPos()
                cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.4)
                cSphereNode = CollisionNode('%s' % avId)
                cSphereNode.addSolid(cSphere)
                cSphereNode.setCollideMask(DivingGameGlobals.CollideMask)
                cSphereNP = toon.attachNewNode(cSphereNode)
                cSphereNP.setPos(pos + Point3(0, 1.5, 1))
                self.remoteToonCollNPs[int(str(avId) + str(1))] = cSphereNP
                cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.4)
                cSphereNode = CollisionNode('%s' % avId)
                cSphereNode.addSolid(cSphere)
                cSphereNode.setCollideMask(DivingGameGlobals.CollideMask)
                cSphereNP = toon.attachNewNode(cSphereNode)
                cSphereNP.setPos(pos + Point3(0, 1.5, -1))
                self.remoteToonCollNPs[int(str(avId) + str(1))] = cSphereNP
                toonSD = DivingGameToonSD.DivingGameToonSD(avId, self)
                self.toonSDs[avId] = toonSD
                toonSD.load()
                toonSD.enter()
                toonSD.fsm.request('normal')

        for avId in self.remoteAvIdList:
            toon = self.getAvatar(avId)
            if toon:
                toon.reparentTo(render)
                self.__placeToon(avId)
                toon.startSmooth()

        self.remoteToons = {}
        for avId in self.remoteAvIdList:
            toon = self.getAvatar(avId)
            self.remoteToons[avId] = toon
Ejemplo n.º 22
0
class TTCHood:

    def __init__(self, cr):
        self.cr = cr
        self.dnaStore = DNAStorage()
        self.isLoaded = 0
        self.suitEffectEnabled = False
        self.amblight = None
        self.ambNode = None
        self.sky = None
        self.skyTrack = None
        self.skySeq = None
        self.lightTrack = None
        self.skyUtil = SkyUtil()
        return

    def createHood(self, loadStorage = 1, AI = 0):
        if loadStorage:
            loadDNAFile(self.dnaStore, 'phase_4/dna/storage.dna')
            loadDNAFile(self.dnaStore, 'phase_4/dna/storage_TT.dna')
            loadDNAFile(self.dnaStore, 'phase_4/dna/storage_TT_sz.dna')
            loadDNAFile(self.dnaStore, 'phase_5/dna/storage_town.dna')
            loadDNAFile(self.dnaStore, 'phase_5/dna/storage_TT_town.dna')
        self.node = loadDNAFile(self.dnaStore, 'phase_4/dna/toontown_central_sz.dna')
        if self.node.getNumParents() == 1:
            self.geom = NodePath(self.node.getParent(0))
            self.geom.reparentTo(hidden)
        else:
            self.geom = hidden.attachNewNode(self.node)
        gsg = base.win.getGsg()
        if gsg:
            self.geom.prepareScene(gsg)
        self.geom.setName('toontown_central')
        self.geom.find('**/hill').setTransparency(TransparencyAttrib.MBinary, 1)
        self.createSky('tt')
        base.hoodBGM = base.loadMusic('phase_4/audio/bgm/TC_nbrhood.ogg')
        base.hoodBGM.setVolume(0.25)
        base.hoodBGM.setLoop(True)
        base.hoodBGM.play()
        self.clerk_node = render.attach_new_node('clerk_node')
        self.clerk_node.set_pos(-80, -85.57, 0.5)
        self.clerk_node.set_h(165.07)
        self.geom.find('**/toontown_central').setCollideMask(BitMask32.allOff())
        self.geom.find('**/coll_sidewalk').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/collision_1').node().setIntoCollideMask(CIGlobals.WallBitmask)
        self.geom.find('**/coll_mainFoolr').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/left_ear').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/right_ear').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_bridge_floor').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_bridge').node().setIntoCollideMask(CIGlobals.WallBitmask)
        self.geom.find('**/coll_r_stair').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_l_stair_2').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_l_stairend_1').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_r_satirend_1').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_plaza').node().setIntoCollideMask(CIGlobals.FloorBitmask)
        self.geom.find('**/coll_hedges').node().setIntoCollideMask(CIGlobals.WallBitmask)
        self.coll_list = ['coll_sidewalk',
         'collision_1',
         'coll_mainFoolr',
         'left_ear',
         'right_ear',
         'coll_bridge_floor',
         'coll_bridge',
         'coll_r_stair',
         'coll_l_stair_2',
         'coll_l_stairend_1',
         'coll_r_stairend_1',
         'coll_plaza',
         'coll_hedges']
        self.geom.reparentTo(render)
        self.telescope = Actor(self.geom.find('**/*animated_prop_HQTelescopeAnimatedProp*'), {'chan': 'phase_3.5/models/props/HQ_telescope-chan.bam'}, copy=0)
        self.telescope.reparentTo(self.geom.find('**/*toon_landmark_hqTT*'))
        self.createLights(1, 1, 1)
        taskMgr.add(self.telescopeTask, 'telescopeTask')
        self.isLoaded = 1
        messenger.send('loadedHood')

    def createLights(self, r, g, b, startColor = 1, fade = 0):
        self.deleteLights()
        self.amblight = AmbientLight('amblight')
        self.amblight.setColor(VBase4(r, g, b, 1))
        self.ambNode = render.attachNewNode(self.amblight)
        render.setLight(self.ambNode)
        if fade:
            self.lightTrack = LerpFunc(self.setLightColor, fromData=startColor, toData=r, duration=2.5, blendType='easeInOut')
            self.lightTrack.start()
            self.skyTrack = LerpColorInterval(self.sky, color=VBase4(r + 0.4, g + 0.4, b + 0.4, 1.0), startColor=VBase4(startColor, startColor, startColor, 1.0), duration=1.5)
            self.skyTrack.start()
            sky = 'tt'
            if r < 0.6:
                sky = 'br'
            self.skySeq = Sequence(Wait(1.5), Func(self.createSky, sky))
            self.skySeq.start()

    def createSky(self, sky):
        self.deleteSky()
        skyPath = 'phase_3.5/models/props/' + sky.upper() + '_sky.bam'
        self.sky = loader.loadModel(skyPath)
        self.sky.reparentTo(self.geom)
        self.sky.setPos(9.15527e-05, -1.90735e-06, 2.6226e-06)
        self.sky.setH(-90)
        if sky == 'tt':
            self.skyUtil.startSky(self.sky)

    def deleteSky(self):
        self.skyUtil.stopSky()
        if self.sky:
            self.sky.removeNode()
            self.sky = None
        if self.lightTrack:
            self.lightTrack.pause()
            self.lightTrack = None
        if self.skyTrack:
            self.skyTrack.pause()
            self.skyTrack = None
        if self.skySeq:
            self.skySeq.pause()
            self.skySeq = None
        return

    def setLightColor(self, color):
        self.amblight.setColor(VBase4(color, color, color, 1))

    def deleteLights(self):
        if self.ambNode:
            render.clearLight(self.ambNode)
            self.ambNode.removeNode()
            self.ambNode = None
        return

    def telescopeTask(self, task):
        if not self.isLoaded:
            return task.done
        self.telescope.play('chan')
        task.delayTime = 12
        return task.again

    def createTrolley(self):
        self.trolley = TrolleyBase(self.cr)

    def enableSuitEffect(self, size):
        self.createLights(0.4, 0.4, 0.4, startColor=1, fade=1)
        self.fogNode = Fog('fog')
        self.fogNode.setColor(0.3, 0.3, 0.3)
        self.fogNode.setExpDensity(0.0025)
        render.setFog(self.fogNode)
        base.hoodBGM.stop()
        song = random.randint(1, 4)
        base.hoodBGM = base.loadMusic('phase_3.5/audio/bgm/encntr_general_bg.ogg')
        base.hoodBGM.setVolume(0.7)
        base.hoodBGM.setLoop(True)
        base.hoodBGM.play()
        self.suitEffectEnabled = True

    def bossSpawned(self):
        base.hoodBGM.stop()
        base.hoodBGM = base.loadMusic('phase_7/audio/bgm/encntr_suit_winning_indoor.ogg')
        base.hoodBGM.setVolume(0.7)
        base.hoodBGM.setLoop(True)
        Sequence(Wait(0.5), Func(base.hoodBGM.play)).start()

    def disableSuitEffect(self):
        self.createLights(1, 1, 1)
        self.createSky('tt')
        base.hoodBGM.stop()
        base.hoodBGM = base.loadMusic('phase_4/audio/bgm/TC_nbrhood.ogg')
        base.hoodBGM.setVolume(0.25)
        base.hoodBGM.setLoop(True)
        base.hoodBGM.play()
        self.suitEffectEnabled = False

    def unloadHood(self):
        self.isLoaded = 0
        if self.suitEffectEnabled:
            self.disableSuitEffect()
        self.deleteSky()
        self.deleteLights()
        self.geom.remove()
        self.clerk_node.remove_node()
        base.hoodBGM.stop()
Ejemplo n.º 23
0
__all__ = []


if __name__ == "__main__":
    from direct.directbase import DirectStart
    from pandac.PandaModules import *
    from IntervalGlobal import *
    from direct.actor.Actor import *

    from direct.directutil import Mopath

    boat = loader.loadModel('models/misc/smiley')
    boat.reparentTo(render)

    donald = Actor()
    donald.loadModel("phase_6/models/char/donald-wheel-1000")
    donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
    donald.reparentTo(boat)

    dock = loader.loadModel('models/misc/smiley')
    dock.reparentTo(render)

    sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
    foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')

    mp = Mopath.Mopath()
    mp.loadFile(Filename('phase_6/paths/dd-e-w'))

    # Set up the boat
    boatMopath = MopathInterval(mp, boat, 'boatpath')
Ejemplo n.º 24
0
    def generate(self, gender, head, headtype):
        if not head == 'dog':
            h = loader.loadModel('phase_3/models/char/' + head + '-heads-' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam')
        else:
            h = Actor('phase_3/models/char/tt_a_chr_' + headtype + '_head_' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam', {'neutral': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_neutral.bam',
             'run': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_run.bam',
             'walk': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_walk.bam',
             'pie': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_pie-throw.bam',
             'fallb': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-backward.bam',
             'fallf': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-forward.bam',
             'lose': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_lose.bam',
             'win': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_victory-dance.bam',
             'squirt': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_water-gun.bam',
             'zend': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zend.bam',
             'tele': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_teleport.bam',
             'book': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_book.bam',
             'leap': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_leap_zhang.bam',
             'jump': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zhang.bam',
             'happy': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump.bam',
             'shrug': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_shrug.bam',
             'hdance': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_happy-dance.bam',
             'wave': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_wave.bam'})
        if headtype == '1':
            try:
                h.find('**/eyes-long').hide()
            except:
                pass

            try:
                h.find('**/ears-long').hide()
            except:
                pass

            try:
                h.find('**/head-long').hide()
            except:
                pass

            try:
                h.find('**/joint_pupilR_long').hide()
                h.find('**/joint_pupilL_long').hide()
            except:
                pass

            try:
                h.find('**/head-front-long').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-surprise').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-neutral').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-surprise').hide()
            except:
                pass

        elif headtype == '2':
            try:
                h.find('**/eyes-short').hide()
            except:
                pass

            try:
                h.find('**/ears-short').hide()
            except:
                pass

            try:
                h.find('**/head-short').hide()
            except:
                pass

            try:
                h.find('**/joint_pupilR_short').hide()
                h.find('**/joint_pupilL_short').hide()
            except:
                pass

            try:
                h.find('**/head-front-short').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-surprise').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-neutral').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-surprise').hide()
            except:
                pass

        elif headtype == '3':
            try:
                h.find('**/eyes-long').hide()
            except:
                pass

            try:
                h.find('**/ears-long').hide()
            except:
                pass

            try:
                h.find('**/head-long').hide()
            except:
                pass

            try:
                h.find('**/joint_pupilR_long').hide()
                h.find('**/joint_pupilL_long').hide()
            except:
                pass

            try:
                h.find('**/head-front-long').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-surprise').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-neutral').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-surprise').hide()
            except:
                pass

        elif headtype == '4':
            try:
                h.find('**/eyes-short').hide()
            except:
                pass

            try:
                h.find('**/ears-short').hide()
            except:
                pass

            try:
                h.find('**/head-short').hide()
            except:
                pass

            try:
                h.find('**/head-front-short').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-long-surprise').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-neutral').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-laugh').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-angry').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-smile').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-sad').hide()
            except:
                pass

            try:
                h.find('**/muzzle-short-surprise').hide()
            except:
                pass

        if gender == 'girl':
            lashes = loader.loadModel('phase_3/models/char/' + head + '-lashes.bam')
            lashes.reparentTo(h)
            if headtype == '1' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts':
                lashes.find('**/open-long').hide()
                lashes.find('**/closed-long').hide()
                lashes.find('**/closed-short').hide()
            elif headtype == '2' or headtype == 'dgl_shorts':
                lashes.find('**/open-short').hide()
                lashes.find('**/closed-short').hide()
                lashes.find('**/closed-long').hide()
            elif headtype == '3' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts':
                lashes.find('**/open-long').hide()
                lashes.find('**/closed-long').hide()
                lashes.find('**/closed-short').hide()
            elif headtype == '4' or headtype == 'dgl_shorts':
                lashes.find('**/open-short').hide()
                lashes.find('**/closed-short').hide()
                lashes.find('**/closed-long').hide()
            return tuple((h, lashes))
        else:
            return h