Esempio n. 1
0
    def setupAssets(cls):
        cls.animInfo = Creature.animInfo.copy()
        cls.setupAnimInfo()
        filePrefix = cls.ModelInfo[1]
        animList = cls.AnimList
        animDict = {}
        for anim in animList:
            animDict[anim[0]] = filePrefix + anim[1]

        cls.animDict = animDict
        filePrefix = cls.ModelInfo[1]
        for name in cls.SfxNames:
            cls.sfx[name] = loadSfx(cls.SfxNames[name])

        cls.actor = Actor.Actor()
        avatarDetail = base.config.GetString('avatar-detail', 'high')
        if avatarDetail == 'high':
            dist = [0, 1000, 4000, 24000]
        elif avatarDetail == 'med':
            dist = [0, 600, 3000, 24000]
        elif avatarDetail == 'low':
            dist = [0, 200, 2000, 24000]
        else:
            raise StandardError, 'Invalid avatar-detail: %s' % avatarDetail
        cls.actor.setLODNode()
        cls.actor.addLOD('hi', dist[1], dist[0])
        cls.actor.addLOD('med', dist[2], dist[1])
        cls.actor.addLOD('low', dist[3], dist[2])
        cls.actor.loadModel(filePrefix + 'high', 'modelRoot', 'hi')
        cls.actor.loadModel(filePrefix + 'medium', 'modelRoot', 'med')
        cls.actor.loadModel(filePrefix + 'low', 'modelRoot', 'low')
        cls.actor.loadAnims(cls.animDict, 'modelRoot', 'all')
Esempio n. 2
0
 def setup(self):
     self.dnaStore = base.cr.playGame.dnaStore
     self.randomGenerator = random.Random()
     self.randomGenerator.seed(self.zoneId)
     self.interior = loader.loadModel('phase_4/models/modules/PetShopInterior')
     self.interior.reparentTo(render)
     self.fish = Actor.Actor('phase_4/models/props/interiorfish-zero', {'swim': 'phase_4/models/props/interiorfish-swim'})
     self.fish.reparentTo(self.interior)
     self.fish.setColorScale(0.8, 0.9, 1, 0.8)
     self.fish.setScale(0.8)
     self.fish.setPos(0, 6, -4)
     self.fish.setPlayRate(0.7, 'swim')
     self.fish.loop('swim')
     hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
     self.colors = ToonInteriorColors.colors[hoodId]
     self.replaceRandomInModel(self.interior)
     door = self.chooseDoor()
     doorOrigin = render.find('**/door_origin;+s')
     doorNP = door.copyTo(doorOrigin)
     doorOrigin.setScale(0.8, 0.8, 0.8)
     doorOrigin.setPos(doorOrigin, 0, -0.25, 0)
     doorColor = self.randomGenerator.choice(self.colors['TI_door'])
     DNADoor.setupDoor(doorNP, self.interior, doorOrigin, self.dnaStore, str(self.block), doorColor)
     doorFrame = doorNP.find('door_*_flat')
     doorFrame.wrtReparentTo(self.interior)
     doorFrame.setColor(doorColor)
     del self.colors
     del self.dnaStore
     del self.randomGenerator
     self.interior.flattenMedium()
     for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase):
         npcToon.initToonState()
    def __init__(self, cr):
        DistributedObject.__init__(self, cr)
        FSM.__init__(self, 'FlippyStandFSM')
        self.geom = base.cr.playGame.hood.loader.geom
        self.flippyStand = Actor.Actor('phase_4/models/events/election_flippyStand-mod', {'idle': 'phase_4/models/events/election_flippyStand-idle'})
        self.flippyStand.setBlend(frameBlend=config.GetBool('interpolate-animations', True))
        self.flippyStand.reparentTo(self.geom)
        self.flippyStand.setScale(0.55)
        self.flippyStand.setH(315)
        self.flippyStand.setPos(180, -250, 4.62)
        self.flippyStand.exposeJoint(None, 'modelRoot', 'LInnerShoulder')
        flippyTable = self.flippyStand.find('**/LInnerShoulder')
        self.flippyStand.exposeJoint(None, 'modelRoot', 'Box_Joint')
        wheelbarrowJoint = self.flippyStand.find('**/Box_Joint').attachNewNode('Pie_Joint')
        wheelbarrow = self.flippyStand.find('**/Box')
        wheelbarrow.setPosHprScale(-2.39, 0.0, 1.77, 0.0, 0.0, 6.0, 1.14, 1.54, 0.93)
        pie = loader.loadModel('phase_3.5/models/props/tart')
        pieS = pie.copyTo(flippyTable)
        pieS.setPosHprScale(-2.61, -0.37, -1.99, 355.6, 90.0, 4.09, 1.6, 1.6, 1.6)
        for pieSettings in ElectionGlobals.FlippyWheelbarrowPies:
            pieModel = pie.copyTo(wheelbarrowJoint)
            pieModel.setPosHprScale(*pieSettings)

        wheelbarrowJoint.setPosHprScale(3.94, 0.0, 1.06, 270.0, 344.74, 0.0, 1.43, 1.12, 1.0)
        self.restockSfx = loader.loadSfx('phase_9/audio/sfx/CHQ_SOS_pies_restock.ogg')
        cs = CollisionBox(Point3(7, 0, 0), 12, 5, 18)
        self.pieCollision = self.flippyStand.attachNewNode(CollisionNode('wheelbarrow_collision'))
        self.pieCollision.node().addSolid(cs)
        self.accept('enter' + self.pieCollision.node().getName(), self.handleWheelbarrowCollisionSphereEnter)
        self.flippyStand.loop('idle')
        return
def _findAnimations(self):
    files = [f for f in os.listdir('.') if os.path.isfile(f)]
    for f in files:
        if ".egg" in f and f is not self.filename:
            self._animation = {"default":f}
            self._pandaModel = Actor.Actor(self._fileName, self._animation)
            return "default"
Esempio n. 5
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
Esempio n. 6
0
 def setupActor(self, node):
     anim = node.getTag('DNAAnim')
     self.trashcan = Actor.Actor(node, copy=0)
     self.trashcan.reparentTo(node)
     self.trashcan.loadAnims({'anim': '%s/%s' % (self.path, anim)})
     self.trashcan.pose('anim', 0)
     self.node = self.trashcan
 def getPicture(self, avatar):
     photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel']
     if GardenGlobals.Specials[self.gardenIndex].has_key('photoAnimation'):
         modelPath = photoModel + GardenGlobals.Specials[
             self.gardenIndex]['photoAnimation'][0]
         animationName = GardenGlobals.Specials[
             self.gardenIndex]['photoAnimation'][1]
         animationPath = photoModel + animationName
         self.model = Actor.Actor()
         self.model.loadModel(modelPath)
         self.model.loadAnims(dict([[animationName, animationPath]]))
         frame, ival = self.makeFrameModel(self.model, 0)
         ival = ActorInterval(self.model, animationName, 2.0)
         photoPos = GardenGlobals.Specials[self.gardenIndex]['photoPos']
         frame.setPos(photoPos)
         photoScale = GardenGlobals.Specials[self.gardenIndex]['photoScale']
         self.model.setScale(photoScale)
         self.hasPicture = True
         return (frame, ival)
     else:
         self.model = loader.loadModel(photoModel)
         frame = self.makeFrame()
         self.model.reparentTo(frame)
         photoPos = GardenGlobals.Specials[self.gardenIndex]['photoPos']
         self.model.setPos(*photoPos)
         photoScale = GardenGlobals.Specials[self.gardenIndex]['photoScale']
         self.model.setScale(photoScale)
         self.hasPicture = True
         return (frame, None)
     return None
Esempio n. 8
0
 def loadAssets(self):
     self.beltModel = NodePath('beltModel')
     self.beltModel.reparentTo(self.boss.geom)
     self.startLocator = self.boss.geom.find('**/conveyer_belt_start_%d' % (self.index + 1))
     self.endLocator = self.boss.geom.find('**/conveyer_belt_end_%d' % (self.index + 1))
     center = (self.startLocator.getPos() + self.endLocator.getPos()) / 2.0
     self.beltHeight = center.getZ()
     self.beltHeight += 0.1
     center.setZ(0)
     self.beltLength = (self.endLocator.getPos() - self.startLocator.getPos()).length()
     self.distBetweenFoodNodes = self.beltLength / self.NumFoodNodes
     self.notify.debug('setting beltModelPos to %s' % center)
     self.beltModel.setPos(center)
     self.setupFoodNodes()
     self.setupFoodIvals()
     self.setupToonupIvals()
     if self.index == 0:
         self.beltActorModel = loader.loadModel('phase_12/models/bossbotHQ/food_belt1_model')
     else:
         self.beltActorModel = loader.loadModel('phase_12/models/bossbotHQ/food_belt2_model')
     if self.beltActorModel:
         self.beltActor = Actor.Actor(self.beltActorModel)
         if self.index == 0:
             self.beltActor.loadAnims({'idle': 'phase_12/models/bossbotHQ/food_belt1'})
         else:
             self.beltActor.loadAnims({'idle': 'phase_12/models/bossbotHQ/food_belt2'})
         self.beltActor.reparentTo(render)
         self.beltActor.setPlayRate(self.BeltActorPlayRate, 'idle')
         mesh = self.beltActor.find('**/mesh_tide1')
         joint = self.beltActor.find('**/uvj_WakeWhiteTide1')
         mesh.setTexProjector(mesh.findTextureStage('default'), joint, self.beltActor)
         self.beltActor.setPos(self.startLocator.getPos())
     self.beltSound = base.loader.loadSfx('phase_12/audio/sfx/CHQ_FACT_conveyor_belt.ogg')
     self.beltSound.setLoop(1)
     self.beltSoundInterval = SoundInterval(self.beltSound, node=self.beltModel, listenerNode=base.localAvatar, seamlessLoop=True, volume=0.25, cutOff=100)
 def loadProp(self):
     if self.prop:
         return
     if self.type != PiratesGlobals.QUEST_PROP_DIG_SPOT:
         modelPath = PiratesGlobals.QUEST_PROP_MODELS.get(
             self.type, 'models/props/crate_04')
         anims = PiratesGlobals.QUEST_PROP_ANIMS.get(self.type, {})
         if anims:
             self.isActor = True
             self.prop = Actor.Actor(modelPath)
             anims = PiratesGlobals.QUEST_PROP_ANIMS.get(self.type, {})
             self.prop.loadAnims(anims)
         else:
             self.isActor = False
             self.prop = self.getPropModel(modelPath)
         propColor = self.getPropColor()
         self.prop.setColorScale(propColor[0], propColor[1], propColor[2],
                                 propColor[3])
         self.prop.reparentTo(self)
     if self.type == PiratesGlobals.QUEST_PROP_POWDER_KEG:
         self.lightUp()
     if self.type == PiratesGlobals.QUEST_PROP_TRS_CHEST_02:
         cb = self.prop.find('**/+Character').node().getBundle(0)
         ab = self.prop.find('**/+AnimBundleNode').node().getBundle()
         self.openAnim = cb.bindAnim(ab, -1)
         self.openAnim.pose(0)
         self.openSound = loadSfx(SoundGlobals.SFX_FX_OPEN_CHEST_02)
         self.openSound.setVolume(0.8)
Esempio n. 10
0
 def __updateFishingRods(self):
     self.fishingRods_preview['text'] = TTLocalizer.FishingRodNameDict.get(
         base.localAvatar.fishingRods[self.fishingRods_index])
     rodPath = FishGlobals.RodFileDict.get(
         base.localAvatar.fishingRods[self.fishingRods_index])
     if self.geom:
         self.geom.cleanup()
         self.geom.removeNode()
         self.geom = None
         if self.geomRotate:
             self.geomRotate.finish()
     self.geom = Actor.Actor(
         rodPath, {'cast': 'phase_4/models/props/fishing-pole-chan'})
     self.geom.setHpr(90, 55, -90)
     self.geom.setPos(0, 0, -0.5)
     self.geom.setScale(0.4)
     self.geomRotate = self.geom.hprInterval(4, Vec3(450, 55, -90)).loop()
     self.geom.reparentTo(self.fishingRods_previewPanel)
     self.geom.pose('cast', 130)
     nametagCount = len(base.localAvatar.fishingRods)
     if nametagCount == 0:
         self.fishingRods_rightButton.hide()
         self.fishingRods_leftButton.hide()
     if self.fishingRods_index >= nametagCount - 1:
         self.fishingRods_rightButton.hide()
     else:
         self.fishingRods_rightButton.show()
     if self.fishingRods_index <= 0:
         self.fishingRods_leftButton.hide()
     else:
         self.fishingRods_leftButton.show()
Esempio n. 11
0
 def attachTNT(self):
     self.detachTNT()
     self.tnt = Actor("phase_5/models/props/tnt-mod.bam",
                      {"chan": "phase_5/models/props/tnt-chan.bam"})
     self.tnt.reparentTo(self.avatar.find('**/def_joint_right_hold'))
     self.tntSparks = ParticleEffect()
     self.tntSparks.loadConfig("phase_5/etc/tnt.ptf")
Esempio n. 12
0
    def tntExplode(self):
        if not self.tnt:
            return

        self.tntExplosion = Actor(
            "phase_5/models/props/kapow-mod.bam",
            {"chan": "phase_5/models/props/kapow-chan.bam"})
        self.tntExplosion.reparentTo(render)
        self.tntExplosion.setBillboardPointEye()
        self.tntExplosion.setPos(self.tnt.getPos(render) + (0, 0, 4))
        self.tntExplosion.setScale(0.5)
        self.tntExplosion.play("chan")
        if self.dynamiteSfx:
            self.dynamiteSfx.stop()
            self.dynamiteSfx = None
        explosionSfx = audio3d.loadSfx(
            "phase_3.5/audio/sfx/ENC_cogfall_apart.mp3")
        audio3d.attachSoundToObject(explosionSfx, self.tntExplosion)
        SoundInterval(explosionSfx).start()
        if self.tntSparks:
            self.tntSparks.cleanup()
            self.tntSparks = None
        if self.tnt:
            self.tnt.cleanup()
            self.tnt = None
        self.tnt_state = "ready"
        if self.getAmmo(3) > 0 and self.getPieType() == 3:
            self.attachTNT()
            if hasattr(self.avatar, "enablePieKeys"):
                # This must be the local avatar
                self.avatar.enablePieKeys()
        taskMgr.doMethodLater(0.5, self.delTntExplosion, "delTntExplosion")
Esempio n. 13
0
 def __loadStuff(self):
     rodId = self.av.getFishingRod()
     rodPath = FishGlobals.RodFileDict.get(rodId)
     if not rodPath:
         self.notify.warning('Rod id: %s model not found' % rodId)
         rodPath = RodFileDict[0]
     self.pole = Actor.Actor()
     self.pole.loadModel(rodPath)
     self.pole.loadAnims({'cast': 'phase_4/models/props/fishing-pole-chan'})
     self.pole.pose('cast', 0)
     self.ptop = self.pole.find('**/joint_attachBill')
     if self.line == None:
         self.line = Rope.Rope(self.uniqueName('Line'))
         self.line.setColor(1, 1, 1, 0.4)
         self.line.setTransparency(1)
         self.lineSphere = BoundingSphere(Point3(-0.6, -2, -5), 5.5)
     if self.bob == None:
         self.bob = loader.loadModel('phase_4/models/props/fishing_bob')
         self.bob.setScale(1.5)
         self.ripples = Ripples.Ripples(self.nodePath)
         self.ripples.setScale(0.4)
         self.ripples.hide()
     if self.splashSounds == None:
         self.splashSounds = (
             base.loader.loadSfx('phase_4/audio/sfx/TT_splash1.ogg'),
             base.loader.loadSfx('phase_4/audio/sfx/TT_splash2.ogg'))
Esempio n. 14
0
    def generateKartDisappearTrack(self):

        def getHoleTrack(hole, holeParent):
            holeTrack = Sequence(
                Wait(0.2),
                Func(hole.setBin, 'shadow', 0),
                Func(hole.setDepthTest, 0),
                Func(hole.setDepthWrite, 0),
                Func(hole.reparentTo, holeParent),
                Func(hole.setPos, holeParent, Point3(0, 0.0, -.6)),
                ActorInterval(hole, 'hole', startTime=3.4, endTime=3.1),
                Wait(0.4),
                ActorInterval(hole, 'hole', startTime=3.1, endTime=3.4))
            return holeTrack

        def getKartShrinkTrack(kart):
            pos = kart.getPos()
            pos.addZ(-1.0)
            kartTrack = Sequence(LerpScaleInterval(kart, scale=Point3(1.0, 1.0, 0.9), duration=0.1), LerpScaleInterval(kart, scale=Point3(1.0, 1.0, 1.1), duration=0.1), LerpScaleInterval(kart, scale=Point3(1.0, 1.0, 0.1), duration=0.2), LerpScaleInterval(kart, scale=Point3(0.9, 0.9, 0.1), duration=0.1), LerpScaleInterval(kart, scale=Point3(1.1, 1.1, 0.1), duration=0.1), LerpScaleInterval(kart, scale=Point3(0.1, 0.1, 0.1), duration=0.2), Wait(0.2), LerpPosInterval(kart, pos=pos, duration=0.2), Func(kart.hide))
            return kartTrack

        if not self.holeActor:
            self.holeActor = Actor.Actor('phase_3.5/models/props/portal-mod', {'hole': 'phase_3.5/models/props/portal-chan'})
        holeTrack = getHoleTrack(self.holeActor, self.kartNode)
        shrinkTrack = getKartShrinkTrack(self.kart)
        kartTrack = Parallel(shrinkTrack, holeTrack)
        return kartTrack
Esempio n. 15
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)
     
     #if AI:
     #    self.createTrolley()
     
     taskMgr.add(self.telescopeTask, "telescopeTask")
     self.isLoaded = 1
     messenger.send("loadedHood")
Esempio n. 16
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
Esempio n. 17
0
    def setupActor(self, node):
        if self.hoodId in self.ZoneToIdles:
            self.numIdles = len(self.ZoneToIdles[self.hoodId])
        if self.hoodId in self.ZoneToFightAnims:
            self.numFightAnims = len(self.ZoneToFightAnims[self.hoodId])
        if len(self.ZoneToIdles) <= 0:
            self.notify.warning(
                "No Idle Animations for Interactive Animated Prop!")
            return
        if self.numIdles <= 0:
            self.notify.warning(
                "No Idle Animations for Interactive Animated Prop!")
            return
        self.idleInterval = None
        anim = node.getTag('DNAAnim')
        self.trashcan = Actor.Actor(node, copy=0)
        self.trashcan.reparentTo(node)
        animDict = {}
        animDict['anim'] = '%s/%s' % (self.path, anim)
        for i in range(self.numIdles):
            baseAnim = self.ZoneToIdles[self.hoodId][i]
            if isinstance(baseAnim, tuple):
                baseAnim = baseAnim[0]
            animStr = self.path + '/' + baseAnim
            animKey = 'idle%d' % i
            animDict[animKey] = animStr
            settleName = self.getSettleName(i)
            if settleName:
                settleStr = self.path + '/' + settleName
                settleKey = 'settle%d' % i
                animDict[settleKey] = settleStr

        for i in range(self.numFightAnims):
            animStr = self.path + '/' + self.ZoneToFightAnims[self.hoodId][i]
            animKey = 'fight%d' % i
            animDict[animKey] = animStr

        if self.hoodId in self.ZoneToIdleIntoFightAnims:
            animStr = self.path + '/' + self.ZoneToIdleIntoFightAnims[
                self.hoodId]
            animKey = 'idleIntoFight'
            animDict[animKey] = animStr
        if self.hoodId in self.ZoneToIdleIntoFightAnims:
            animStr = self.path + '/' + self.ZoneToVictoryAnims[self.hoodId]
            animKey = 'victory'
            animDict[animKey] = animStr
        if self.hoodId in self.ZoneToSadAnims:
            animStr = self.path + '/' + self.ZoneToSadAnims[self.hoodId]
            animKey = 'sad'
            animDict[animKey] = animStr

        self.trashcan.loadAnims(animDict)
        self.trashcan.pose('anim', 0)
        self.trashcan.setBlend(frameBlend=base.wantSmoothAnims)
        self.node = self.trashcan
        self.idleInterval = self.createIdleInterval()
        self.battleCheerInterval = self.createBattleCheerInterval()
        self.victoryInterval = self.createVictoryInterval()
        self.sadInterval = self.createSadInterval()
Esempio n. 18
0
 def getActor(self):
     prefix = 'phase_%s/models/char/' % self.getPhase()
     dict = FishGlobals.FishFileDict
     fileInfo = dict.get(self.genus, dict[(-1)])
     from direct.actor import Actor
     actor = Actor.Actor(prefix + fileInfo[1], {'intro': prefix + fileInfo[2], 'swim': prefix + fileInfo[3]})
     actor.setBlend(frameBlend=base.settings.getBool('game', 'smooth-animations', False))
     return actor
Esempio n. 19
0
 def __init__(self, node):
     AnimatedProp.AnimatedProp.__init__(self, node)
     parent = node.getParent()
     self.fish = Actor.Actor(node, copy=0)
     self.fish.reparentTo(parent)
     self.fish.loadAnims({'swim': 'phase_4/models/props/exteriorfish-swim'})
     self.fish.pose('swim', 0)
     self.node = self.fish
Esempio n. 20
0
 def setupActor(self, node):
     anim = node.getTag('DNAAnim')
     self.trashcan = Actor.Actor(node, copy=0)
     self.trashcan.reparentTo(node)
     self.trashcan.loadAnims({'anim': '%s/%s' % (self.path, anim)})
     self.trashcan.pose('anim', 0)
     self.trashcan.setBlend(frameBlend=base.wantSmoothAnims)
     self.node = self.trashcan
Esempio n. 21
0
 def __init__(self, node):
     GenericAnimatedProp.GenericAnimatedProp.__init__(self, node)
     parent = node.getParent()
     self.building = Actor.Actor(node, copy=0)
     self.building.reparentTo(parent)
     self.building.loadAnims({'dance': 'phase_5/models/char/tt_a_ara_ttc_B2_dance'})
     self.building.pose('dance', 0)
     self.node = self.building
 def getActor(self):
     prefix = 'phase_%s/models/char/' % self.getPhase()
     dict = FishGlobals.FishFileDict
     fileInfo = dict.get(self.genus, dict[-1])
     from direct.actor import Actor
     actor = Actor.Actor(prefix + fileInfo[1], {'intro': prefix + fileInfo[2],
      'swim': prefix + fileInfo[3]})
     return actor
    def makeNodePath(self):
        self.nodePath = Actor.Actor() #NodePath(self.uniqueName("gavelNodePath"))        

 

        

        self.gavel = self.nodePath.attachNewNode('myGavel')
Esempio n. 24
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'})
         if config.GetBool('want-retro-mode', False):
             self.teleportHole.setTexture(loader.loadTexture('phase_3/maps/avatar_palette_2tmla_1_retro.jpg', 'phase_3/maps/avatar_palette_2tmla_1_retro_a.rgb'), 1)
         self.teleportHole.setBlend(frameBlend=config.GetBool('interpolate-animations', True))
     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
Esempio n. 25
0
def copyProp(prop):
    from direct.actor import Actor
    if isinstance(prop, Actor.Actor):
        returnActor = Actor.Actor(other=prop)
        returnActor.setBlend(
            frameBlend=config.GetBool('interpolate-animations', True))
        return returnActor
    return prop.copyTo(hidden)
    def setupAnimActor(self):
        if not hasattr(self.parent, 'geom'):
            return
        pt = Actor.Actor()
        self.parent.geom.detachNode()
        pt.loadModel(self.parent.geom, copy=0)
        pt.loadModel(self.modelPrefix + 'none')
        pt.loadAnims({'idle': self.modelPrefix + 'idle'})
        pt.reparentTo(self.parent)
        pt.loop('idle')
        mesh = pt.findAllMatches('**/RockMeshGroup')
        if not mesh.isEmpty():
            mesh = mesh[0]
            mesh.flattenStrong()
            tc = mesh.findAllTextureStages()
            for k in range(0, tc.getNumTextureStages()):
                if tc[k].getTexcoordName().getName().find('Top') != -1:
                    joint = pt.findAllMatches('**/uvj_WaterTexture')[0]
                    ts = tc[k]
                    mesh.setTexProjector(ts, joint, self.parent)

        mesh = pt.findAllMatches('**/WaterfallMeshGroup')
        if not mesh.isEmpty():
            mesh = mesh[0]
            tc = mesh.findTextureStage('default')
            joints = pt.findAllMatches('**/uvj_WaterfallTexture')
            if tc:
                if not joints.isEmpty():
                    joint = joints[0]
                    ts = tc
                    mesh.setTexProjector(ts, joint, self.parent)
            mesh = pt.findAllMatches('**/LightMeshGroup')
            if not mesh.isEmpty():
                mesh = mesh[0]
                mesh.flattenStrong()
                tc = mesh.findTextureStage('default')
                joints = pt.findAllMatches('**/uvj_LightTexture')
                if tc and not joints.isEmpty():
                    joint = joints[0]
                    ts = tc
                    mesh.setTexProjector(ts, joint, self.parent)
            mesh = pt.findAllMatches('**/WaterMeshGroup')
            mesh = mesh.isEmpty() or mesh[0]
            mesh.flattenStrong()
            tc = mesh.findAllTextureStages()
            for k in range(0, tc.getNumTextureStages()):
                if tc[k].getName().find('dummy') != -1:
                    continue
                if tc[k].getTexcoordName().getName().find('Top') != -1:
                    joint = pt.findAllMatches('**/uvj_WaterTopTexture')[0]
                    ts = tc[k]
                    mesh.setTexProjector(ts, joint, render)
                if tc[k].getTexcoordName().getName().find('Bottom') != -1:
                    joint = pt.findAllMatches('**/uvj_WaterBottomTexture')[0]
                    ts = tc[k]
                    mesh.setTexProjector(ts, joint, self.parent)

        return pt
Esempio n. 27
0
    def loadAssets(self):
        """Load and setup the assets for the food belt."""
        # later on this will become a loadModel call
        self.beltModel = NodePath('beltModel')
        self.beltModel.reparentTo(self.boss.geom)
        self.startLocator = self.boss.geom.find('**/conveyer_belt_start_%d' %
                                                (self.index + 1))
        self.endLocator = self.boss.geom.find('**/conveyer_belt_end_%d' %
                                              (self.index + 1))
        center = (self.startLocator.getPos() + self.endLocator.getPos()) / 2.0
        self.beltHeight = center.getZ()
        self.beltHeight += 0.1
        center.setZ(0)
        self.beltLength = (self.endLocator.getPos() -
                           self.startLocator.getPos()).length()
        self.distBetweenFoodNodes = self.beltLength / self.NumFoodNodes
        self.notify.debug('setting beltModelPos to %s' % center)
        self.beltModel.setPos(center)
        self.setupFoodNodes()
        self.setupFoodIvals()
        self.setupToonupIvals()
        if self.index == 0:
            self.beltActorModel = loader.loadModel(
                "phase_12/models/bossbotHQ/food_belt1_model")
        else:
            self.beltActorModel = loader.loadModel(
                "phase_12/models/bossbotHQ/food_belt2_model")

        if (self.beltActorModel):
            self.beltActor = Actor.Actor(self.beltActorModel)
            if self.index == 0:
                self.beltActor.loadAnims(
                    {'idle': "phase_12/models/bossbotHQ/food_belt1"})
            else:
                self.beltActor.loadAnims(
                    {'idle': "phase_12/models/bossbotHQ/food_belt2"})
            self.beltActor.reparentTo(render)
            # adjust this number as necessary to match up with the food intervals
            self.beltActor.setPlayRate(self.BeltActorPlayRate, 'idle')
            #self.beltActor.loop('idle')

            # 1st uv animation

            mesh = self.beltActor.find('**/mesh_tide1')
            joint = self.beltActor.find('**/uvj_WakeWhiteTide1')
            mesh.setTexProjector(mesh.findTextureStage('default'), joint,
                                 self.beltActor)
            self.beltActor.setPos(self.startLocator.getPos())

        self.beltSound = base.loadSfx(
            "phase_12/audio/sfx/CHQ_FACT_conveyor_belt.wav")
        self.beltSound.setLoop(1)
        self.beltSoundInterval = SoundInterval(self.beltSound,
                                               node=self.beltModel,
                                               listenerNode=base.localAvatar,
                                               seamlessLoop=True,
                                               volume=0.25,
                                               cutOff=100)
Esempio n. 28
0
 def setupActor(self, node):
     anim = node.getTag('DNAAnim')
     self.trashcan = Actor.Actor(node, copy=0)
     self.trashcan.reparentTo(node)
     self.trashcan.loadAnims({'anim': '%s/%s' % (self.path, anim)})
     self.trashcan.pose('anim', 0)
     self.trashcan.setBlend(frameBlend=base.settings.getBool(
         'game', 'smooth-animations', False))
     self.node = self.trashcan
 def __init__(self, node):
     AnimatedProp.AnimatedProp.__init__(self, node)
     parent = node.getParent()
     self.periscope = Actor.Actor(node, copy=0)
     self.periscope.reparentTo(parent)
     self.periscope.loadAnims({'anim': 'phase_3.5/models/props/HQ_periscope-chan'})
     self.periscope.pose('anim', 0)
     self.node = self.periscope
     self.track = Sequence(Wait(2.0), self.periscope.actorInterval('anim', startFrame=0, endFrame=40), Wait(0.7), self.periscope.actorInterval('anim', startFrame=40, endFrame=90), Wait(0.7), self.periscope.actorInterval('anim', startFrame=91, endFrame=121), Wait(0.7), self.periscope.actorInterval('anim', startFrame=121, endFrame=91), Wait(0.7), self.periscope.actorInterval('anim', startFrame=90, endFrame=40), Wait(0.7), self.periscope.actorInterval('anim', startFrame=40, endFrame=90), Wait(0.7), self.periscope.actorInterval('anim', startFrame=91, endFrame=121), Wait(0.5), self.periscope.actorInterval('anim', startFrame=121, endFrame=148), Wait(3.0), name=self.uniqueName('HQPeriscope'))
Esempio n. 30
0
 def setupActor(self, node):
     self.pieActor = Actor.Actor(
         'phase_5/models/char/tt_r_prp_ext_piePackage', {
             'fightBoost':
             'phase_5/models/char/tt_a_prp_ext_piePackage_fightBoost'
         })
     self.pieActor.reparentTo(self.node)
     self.pieActor.hide()
     InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node)