def load(self):
        DistributedPartyFireworksActivity.notify.debug('load')
        DistributedPartyActivity.load(self)
        self.eventId = PartyGlobals.FireworkShows.Summer
        self.launchPadModel = loader.loadModel('phase_13/models/parties/launchPad')
        self.launchPadModel.setH(90.0)
        self.launchPadModel.setPos(0.0, -18.0, 0.0)
        self.launchPadModel.reparentTo(self.root)
        railingsCollection = self.launchPadModel.findAllMatches('**/launchPad_mesh/*railing*')
        for i in xrange(railingsCollection.getNumPaths()):
            railingsCollection[i].setAttrib(AlphaTestAttrib.make(RenderAttrib.MGreater, 0.75))

        leverLocator = self.launchPadModel.find('**/RocketLever_locator')
        self.lever.setPosHpr(Vec3.zero(), Vec3.zero())
        self.lever.reparentTo(leverLocator)
        self.toonPullingLeverInterval = None
        self.sign.reparentTo(self.launchPadModel.find('**/launchPad_sign_locator'))
        self.rocketActor = Actor('phase_13/models/parties/rocket_model', {'launch': 'phase_13/models/parties/rocket_launch'})
        rocketLocator = self.launchPadModel.find('**/rocket_locator')
        self.rocketActor.reparentTo(rocketLocator)
        self.rocketActor.node().setBound(OmniBoundingVolume())
        self.rocketActor.node().setFinal(True)
        effectsLocator = self.rocketActor.find('**/joint1')
        self.rocketExplosionEffect = RocketExplosion(effectsLocator, rocketLocator)
        self.rocketParticleSeq = None
        self.launchSound = base.loadSfx('phase_13/audio/sfx/rocket_launch.ogg')
        self.activityFSM = FireworksActivityFSM(self)
        self.activityFSM.request('Idle')
        return
Beispiel #2
0
    def update(self, task=None):
        """
        Updates position of sounds in the 3D audio system. Will be called automatically
        in a task.
        """
        # Update the positions of all sounds based on the objects
        # to which they are attached
        
        # The audio manager is not active so do nothing
        if hasattr(self.audio_manager, "getActive"):
            if self.audio_manager.getActive()==0:
                return Task.cont
        
        for known_object in self.sound_dict.keys():
            tracked_sound = 0
            while tracked_sound < len(self.sound_dict[known_object]):
                sound = self.sound_dict[known_object][tracked_sound]
                pos = known_object.getPos(self.root)
                vel = self.getSoundVelocity(sound)
                sound.set3dAttributes(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2])
                tracked_sound += 1

        # Update the position of the listener based on the object
        # to which it is attached
        if self.listener_target:
            pos = self.listener_target.getPos(self.root)
            forward = self.listener_target.getRelativeVector(self.root, Vec3.forward())
            up = self.listener_target.getRelativeVector(self.root, Vec3.up())
            vel = self.getListenerVelocity()
            self.audio_manager.audio3dSetListenerAttributes(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2], forward[0], forward[1], forward[2], up[0], up[1], up[2]) 
        else:
            self.audio_manager.audio3dSetListenerAttributes(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1)
        return Task.cont
 def onCenterTrackball(self, evt = None):
   """Center the trackball, like 'c' does in pview."""
   gbv = render.getBounds();
   # Determine the bounding sphere around the object.
   if gbv.isInfinite(): return
   if gbv.isEmpty(): return
   
   # The BoundingVolume might be a sphere (it's likely), but since it
   # might not, we'll take no chances and make our own sphere.
   sphere = BoundingSphere(gbv.getApproxCenter(), 0.0)
   if (not sphere.extendBy(gbv)): return
   
   radius = 50.0
   
   # Loop through the windows/viewports
   for w in WindowManager.windows:
     # Choose a suitable distance to view the whole volume in our frame.
     # This is based on the camera lens in use.
     fov = w.camLens.getFov();
     distance = radius / tan(deg2Rad(min(fov[0], fov[1]) / 2.0));
     
     # Ensure the far plane is far enough back to see the entire object.
     idealFarPlane = distance + radius * 1.5;
     w.camLens.setFar(max(w.camLens.getDefaultFar(), idealFarPlane));
     
     # And that the near plane is far enough forward.
     w.camLens.setNear(min(w.camLens.getDefaultNear(), radius - sphere.getRadius()))
     
     w.trackball.node().setOrigin(sphere.getCenter())
     w.trackball.node().setPos(Vec3.forward() * distance)
     
     # Also set the movement scale on the trackball to be consistent
     # with the size of the model and the lens field-of-view.
     w.trackball.node().setForwardScale(distance * 0.006)
  def __init__(self):
    
    # Make a way out of here!
    base.accept("escape", exit)

    # Initiate the shadows
    self.sMgr = ShadowManager(render)
    self.sMgr.setAmbient(0.2)     # Most of these five are the default
    self.sMgr.setHardness(20)     # values so it was kinda unnecessary to
    self.sMgr.setFov(40)          # set them explicitly but I wanted to
    self.sMgr.setNearFar(10, 100) # show how to set them anyway.

    # Create the 'table'
    self.table = loader.loadModel("tableplane.egg")
    self.table.reparentTo(render)
    tableTex = loader.loadTexture("tree-bark-89a.jpg")
    tableTex.setMinfilter(Texture.FTLinearMipmapLinear) # Enable texture mipmapping
    self.table.setTexture(tableTex)

    # Load the teapot
    self.teapot = loader.loadModel("teapot")
    self.teapot.setTwoSided(True)
    self.teapot.reparentTo(render)
    # The teapot has no texture, so you have to tell it to the ShadowManager
    # Otherwise the model will turn up black.
    self.sMgr.flagUntexturedObject(self.teapot)

    # Set intervals to move the teapot
    self.teapot.hprInterval(5.0, Vec3.zero(), Vec3(360, 0, 0)).loop()
    Sequence(self.teapot.posInterval(2.0, Point3.zero(), Point3(2, 0, 1)), self.teapot.posInterval(2.0, Point3(2, 0, 1), Point3.zero())).loop()

    # Setup the camera
    base.disableMouse()
    camPivot = render.attachNewNode("cameraPivotPoint")
    base.cam.reparentTo(camPivot)
    base.camLens.setNearFar(1,1000)
    base.camLens.setFov(75)
    base.cam.setPos(-10,-10,15)
    base.cam.lookAt(self.teapot)
    
    # Setup an interval to rotate the camera around camPivot
    camPivot.hprInterval(15.0, Vec3.zero(), Vec3(360, 0, 0)).loop()
    
    # Position the shadow camera
    self.sMgr.light.setPos(0,20,15)
    self.sMgr.light.lookAt(self.teapot)
    self.sMgr.light.node().showFrustum() # Show the frustrum
    def update(self, task = None):
        if hasattr(self.audio_manager, 'getActive'):
            if self.audio_manager.getActive() == 0:
                return Task.cont
        for known_object in self.sound_dict.keys():
            tracked_sound = 0
            while tracked_sound < len(self.sound_dict[known_object]):
                sound = self.sound_dict[known_object][tracked_sound]
                pos = known_object.getPos(self.root)
                vel = self.getSoundVelocity(sound)
                sound.set3dAttributes(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2])
                tracked_sound += 1

        if self.listener_target:
            pos = self.listener_target.getPos(self.root)
            forward = self.listener_target.getRelativeVector(self.root, Vec3.forward())
            up = self.listener_target.getRelativeVector(self.root, Vec3.up())
            vel = self.getListenerVelocity()
            self.audio_manager.audio3dSetListenerAttributes(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2], forward[0], forward[1], forward[2], up[0], up[1], up[2])
        else:
            self.audio_manager.audio3dSetListenerAttributes(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1)
        return Task.cont
Beispiel #6
0
  def keybControl(self,dt):
    move=self.spd_forward*dt
    vel=Vec3(0,0,0)

    if self.keys['up']: vel+=self.up(move)
    if self.keys['down']: vel+=self.down(move)
    if self.keys['right']: vel+=self.right(move)
    if self.keys['left']: vel+=self.left(move)

    ###self.avatar.setPos(self.avatar.getPos()+vel)
    self.avatar.setFluidPos(self.avatar.getPos()+vel)
    if self.lockY != None: self.avatar.setY(self.lockY)
    if (vel <> Vec3.zero()): self.walk(dt, vel)
    if self.keys['jump']: self.jump(dt)
 def update( self ):
     self.realizer.skeletonRequested()
     self.updatePandaSkeleton(self.agentControlJoints, self.agentSMRSkel)
     
     for key in self.targets.keys():
         #print(key, "\n")
         weight = self.realizer.getMorphTargetWeight( self.name, key )
         morphTargets = self.targets[key]
         for morphTarget in morphTargets :
             #print(weight, "\n")
             morphTarget.setX(weight)
             
     #blushingValue = self.realizer.getShaderParameterValue( self.name, 'blushing' )
     #self.shaders.headShader.blushing.set( blushingValue )
     
     self.lighting.update()
     if self.createShadowMap == 1:
         self.shadowMap.setLighting( self.lighting, Vec3( self.positionX, self.positionY, self.positionZ ), self.shadowMapDistance )
         self.shaders.updateWithShadows( self.shadowMap )
     else:
         self.shaders.update()
Beispiel #8
0
 def _initCollisions(self):
     self._camCollRay = CollisionRay()
     camCollNode = CollisionNode('CameraToonRay')
     camCollNode.addSolid(self._camCollRay)
     camCollNode.setFromCollideMask(OTPGlobals.WallBitmask
                                    | OTPGlobals.CameraBitmask
                                    | ToontownGlobals.FloorEventBitmask
                                    | ToontownGlobals.CeilingBitmask)
     camCollNode.setIntoCollideMask(0)
     self._camCollNP = self._camera.attachNewNode(camCollNode)
     self._camCollNP.show()
     self._collOffset = Vec3(0, 0, 0.5)
     self._collHandler = CollisionHandlerQueue()
     self._collTrav = CollisionTraverser()
     self._collTrav.addCollider(self._camCollNP, self._collHandler)
     self._betweenCamAndToon = {}
     self._transNP = NodePath('trans')
     self._transNP.reparentTo(render)
     self._transNP.setTransparency(True)
     self._transNP.setAlphaScale(Globals.Camera.AlphaBetweenToon)
     self._transNP.setBin('fixed', 10000)
    def wander(self, elapsed):
        pos = Vec2(self.getPos().xy)
        r = elapsed * self.maxSpeed * 3
        if (pos - self.startPosition).length() > self.wanderRadius:
            change = self.startPosition - pos
            change.normalize()
            change *= r
        else:
            change = Vec2(random.uniform(-r, r), random.uniform(-r, r))

        desiredVelocity = self.wanderVelocity + change

        desiredVelocity.normalize()
        desiredVelocity *= self.maxSpeed
        self.wanderVelocity = desiredVelocity

        desiredHeading = math.degrees(
            math.atan2(desiredVelocity.y, desiredVelocity.x)) + 90
        desiredVelocity = Vec3(desiredVelocity.x, desiredVelocity.y, 0)
        #logging.info( desiredVelocity)
        self.move(desiredVelocity, desiredHeading, elapsed)
Beispiel #10
0
 def addItem(self, text, action):
     self.__menuItems.append(
         DirectButton(
             text=text,
             command=self.pressEnter,
             extraArgs=[len(self.__menuItems)],
             text_align=TextNode.ALeft,
             scale=0.1,
             #left/right, forward/back, up/down
             pos=Vec3(-0.38, 0, 0.5 - (len(self.__menuItems) * 0.15)),
             text_fg=(1, 1, 1, 1),
             rolloverSound=None,
             clickSound=None,
             pressEffect=0,
             relief=None,
             textMayChange=True
             #text_font=base.fontLoader.load('Arial Bold.ttf')
         ))
     self.__menuItems[-1].reparentTo(self.__menuContainer)
     self.__menuItems[-1].setPythonTag('action', action)
     self.__menuItems[-1].setPythonTag('text', text)
Beispiel #11
0
 def getMouse3D(self):
     # make sure process has the mouse to not cause error
     if self.showbase.mouseWatcherNode.hasMouse():
         # get screen coordinates of mouse
         mpos = self.showbase.mouseWatcherNode.getMouse()
         pos3d = Point3()
         nearPoint = Point3()
         farPoint = Point3()
         # find vector of cameras facing from mouse screen coordinates and get near and far points on frustrum
         self.showbase.camLens.extrude(mpos, nearPoint, farPoint)
         # check for intersection with z = 0 plane
         if self.plane.intersectsLine(
                 pos3d,
                 self.showbase.render.getRelativePoint(
                     self.showbase.camera, nearPoint),
                 self.showbase.render.getRelativePoint(
                     self.showbase.camera, farPoint)):
             # return this position if exists
             return pos3d
     # or return (-1, -1, -1)
     return Vec3(-1, -1, -1)
    def updateLights(self):
        theta = self.sliderTheta['value']
        phi = self.sliderPhi['value']
        intensity = self.sliderIntensity['value']
        hue = self.sliderHue['value']
        saturation = self.sliderSaturation['value']

        self.thetas[self.lightIndex] = theta
        self.phis[self.lightIndex] = phi
        self.intensities[self.lightIndex] = intensity
        self.hues[self.lightIndex] = hue
        self.saturations[self.lightIndex] = saturation

        light = self.lighting.directionalLights[self.lightIndex]
        light.direction = Vec3(
            math.sin(theta) * math.cos(phi),
            math.cos(theta) * math.cos(phi), math.sin(phi))
        light.intensity = intensity
        light.color = hsvToRGB(hue, saturation, 1)

        self.updateLamps()
    def seekVec(self, target, elapsed):
        desiredVelocity = target - self.getPos()
        desiredVelocity.z = 0

        desiredHeading = math.degrees(
            math.atan2(desiredVelocity.y, desiredVelocity.x)) + 90

        speed = desiredVelocity.length()
        if speed < self.maxStoppingDistance:
            desiredVelocity.normalize()
            speed = self.getMaxArrivalSpeed(speed)
            desiredVelocity *= speed

        if speed > self.maxSpeed:
            desiredVelocity.normalize()
            desiredVelocity *= self.maxSpeed

        if speed < 1:
            desiredVelocity = Vec3(0, 0, 0)

        self.move(desiredVelocity, desiredHeading, elapsed)
    def setupHpMeter(self):
        if self.hpMeter:
            return None

        zAdj = 50
        self.smokeZAdj = zAdj
        self.fortPart = self.fortNode.find('**/top_interior_wall_collision')
        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find('**/col_TopFloor1')

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find('**/pPlane4')
            zAdj = 150
            self.smokeZAdj = 100

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find('**/*tower*')

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find('**/*buttress*')

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find('**/*floor*')

        fortPartBounds = self.fortPart.getBounds()
        self.hpAnchor = NodePath('hpAnchor')
        self.hpAnchor.setPos(fortPartBounds.getApproxCenter())
        self.hpAnchor.setZ(self.hpAnchor.getZ() + zAdj)
        self.hpAnchor.reparentTo(self.fortNode)
        self.hpMeter = HpMeter.HpMeter(fadeOut=0,
                                       parent=self.hpAnchor,
                                       originAtMidPt=True)
        self.hpMeter.setScale(200)
        self.hpMeter.setBin('fixed', 130)
        self.hpMeter.setDepthWrite(False)
        myEffect = BillboardEffect.make(Vec3(0, 0, 1), True, False, 150,
                                        NodePath(), Point3(0, 0, 0))
        self.hpMeter.node().setEffect(myEffect)
        self.hpMeter.update(self.hp, self.maxHp)
        self.hideFortHpMeter()
	def createGuiObjects(self):
		self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None)
		self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
		self.attachMarker(self.numberLocator)
		self.listXorigin = 0
		self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
		self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
		self.listZorigin = self.scrollBottomRightLocator.getZ()
		self.listFrameSizeZ = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
		self.arrowButtonXScale = 1
		self.arrowButtonZScale = 1
		self.itemFrameXorigin = 0
		self.itemFrameZorigin = 0
		self.buttonXstart = self.itemFrameXorigin + 0.21
		self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
		buttonOffSet = -0.01
		incButtonPos = (0.0, 0, 0)
		decButtonPos = (0.0, 0, 0)
		itemFrameMinZ = self.listZorigin
		itemFrameMaxZ = self.listZorigin + self.listFrameSizeZ
		arrowUp = self.find('**/downScroll_up')
		arrowDown = self.find('**/downScroll_down')
		arrowHover = self.find('**/downScroll_hover')
		self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
		 arrowDown,
		 arrowHover,
		 arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(arrowUp,
		 arrowDown,
		 arrowHover,
		 arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
		itemFrameParent = self.scrollList.itemFrame.getParent()
		self.scrollList.incButton.reparentTo(self.scrollDownLocator)
		self.scrollList.decButton.reparentTo(self.scrollUpLocator)
		arrowUp.removeNode()
		arrowDown.removeNode()
		arrowHover.removeNode()
		clipper = PlaneNode('clipper')
		clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0)))
		clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
		self.scrollList.component('itemFrame').setClipPlane(clipNP)
 def createLandedGrapple(self, otherShip, targetId):
     self.accept(otherShip.getDisableEvent(), self.removeLandedGrapples)
     otherShipRelX = otherShip.model.modelRoot.getX(self.modelRoot)
     grappleStr = '**/grapple_right*'
     anchorOffset = Vec3(0, 0, -1)
     if otherShipRelX < 0:
         grappleStr = '**/grapple_left*'
     
     anchorNode = random.choice(self.locators.findAllMatches(grappleStr))
     anchorPos = anchorNode.getPos(self.modelRoot) + anchorOffset
     side = 'right'
     if self.modelRoot.getX(otherShip.model.modelRoot) < 0:
         side = 'left'
     
     targetStr = '**/grapple_%s_%s' % (side, targetId)
     if targetId >= 0:
         grappleLocator = otherShip.findLocator(targetStr)
     else:
         grappleLocator = random.choice(otherShip.findLocators('**/grapple_%s_*' % (side,)))
     rope = self.getRope(thickness = 0.5)
     grapplePos = grappleLocator.getPos(self.modelRoot)
     sagNode = self.modelRoot.attachNewNode('sagNode')
     sagNode.setPos((grapplePos + anchorPos) * 0.5)
     grapple = loader.loadModel('models/ammunition/GrapplingHook')
     grapple.reparentTo(otherShip.model.modelRoot)
     posHpr = (grappleLocator, 2, 0, -2.5, -270, -350, 80)
     if targetStr.find('right') > 0:
         posHpr = (grappleLocator, 1, 0, -1.5, 90, -40, -180)
     
     grapple.setPosHpr(*posHpr)
     rope.reparentTo(grapple)
     rope.setup(3, ((None, Point3(0)), (sagNode, Point3(0)), (self.modelRoot, anchorPos)))
     self.landedGrappleNodes.append([
         otherShip,
         grapple,
         anchorNode,
         sagNode,
         grappleLocator,
         rope])
Beispiel #17
0
    def __init__(self, game_data, gfx_manager):
        self.game_data = game_data
        self.gui_traverser = CollisionTraverser()
        self.handler = CollisionHandlerQueue()
        self.selectable_objects = {}
        for cid, model in gfx_manager.character_models.items():
            new_collision_node = CollisionNode('person_' + str(cid))
            new_collision_node.addSolid(
                CollisionTube(0, 0, 0.5, 0, 0, 1.5, 0.5))
            new_collision_nodepath = model.attachNewNode(new_collision_node)
            new_collision_nodepath.setTag("type", "character")
            new_collision_nodepath.setTag("id", str(cid))

        picker_node = CollisionNode('mouseRay')
        picker_np = camera.attachNewNode(picker_node)
        self.picker_ray = CollisionRay()
        picker_node.addSolid(self.picker_ray)
        self.gui_traverser.addCollider(picker_np, self.handler)
        self.floor = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, 0)))
        self.floor_np = render.attachNewNode(CollisionNode('floor'))
        self.floor_np.setTag("type", "ground")
        self.floor_np.node().addSolid(self.floor)
Beispiel #18
0
    def shoot(self):
        # TODO: add proper unit tests!
        angle = self.heading * math.pi / 180.0
        headingX = math.cos(angle)
        headingY = math.sin(angle)
        offset = Vec3(headingX, headingY, 0) * Ship.BULLET_OFFSET
        shipPos = self.getPos()
        bulletPos = (offset[0] + shipPos[0], offset[1] + shipPos[1], offset[2])

        bulletVisual = loader.loadModel("bullet.bam")
        bulletVisual.setPos(tupleToVec3(bulletPos))
        bulletVisual.setHpr(tupleToVec3((self.heading + 90, 180)))
        bulletVisual.setScale(1.5)
        bulletVisual.reparentTo(self.bulletParent)

        # Create physics for bullet
        collisionSphere = OdeSphereGeom(1.5)
        collisionSphere.setCategoryBits(BitMask32(0xffffffff))
        collisionSphere.setCollideBits(BitMask32(0xffffffff))
        collisionSphere.setPosition(bulletPos[0], bulletPos[1], bulletPos[2])

        shipVel = self.getVel()

        bullet = {
            'vel': (headingX * Ship.BULLET_SPEED +
                    shipVel[0] / Ship.BULLET_SHIP_SPEED_CORRELATION,
                    headingY * Ship.BULLET_SPEED +
                    shipVel[1] / Ship.BULLET_SHIP_SPEED_CORRELATION),
            'visual':
            bulletVisual,
            'physical':
            collisionSphere,
            'isAlive':
            True,
            'timeToLive':
            Ship.BULLET_MAX_LIFE_TIME
        }
        self.bullets.append(bullet)
        self.shootingSound.play()
Beispiel #19
0
class SlowEntityFollower(EntityFollowerBase):

    distance = 50
    height = 50
    offset = Vec3(0, 0, 20)

    def handle_connect(self, entity):
        super(SlowEntityFollower, self).handle_connect(entity)

        if isinstance(entity, SpatialEntity):
            targetpos = entity.position
            targethpr = entity.hpr

            angle = (-targethpr.getX() / 180. + 1) * math.pi

            direction = Vec3(math.sin(angle), math.cos(angle), 0)
            position = targetpos + Vec3(0, 0, self.height)

            self.camera.setPos(position + direction * (-self.distance))
            self.camera.lookAt(*targetpos)

    def on_entity_set_position(self, ent, pos):
        camvec = ent.position + Vec3(0, 0, self.height) - self.camera.getPos()
        camdist = camvec.length()
        camvec.normalize()

        maxdist = 200.0
        mindist = 50
        if (camdist > maxdist):
            self.camera.setPos(self.camera.getPos() + camvec *
                               (camdist - maxdist))
            camdist = maxdist
        if (camdist < mindist):
            self.camera.setPos(self.camera.getPos() - camvec *
                               (mindist - camdist))
            camdist = mindist

        self.camera.lookAt(*(pos + self.offset))
    def __init__(self, heightFunction, x=0, y=0):

        NodePath.__init__(self, "Creature")
        self.reparentTo(render)
        self.startPosition = Vec2(x, y)
        z = heightFunction(x, y)
        self.setPos(x, y, z)
        #  movement
        self.acceleration = 25
        self.velocity = Vec3(0, 0, 0)
        self.maxSpeed = 10
        self.speed = 0
        self.maxAngularVelocity = 360
        self.turbo = 1
        self.maxStoppingDistance = self.maxSpeed / self.acceleration * 0.5

        self.body = Actor("models/ralph", {
            "run": "models/ralph-run",
            "walk": "models/ralph-walk"
        })
        self.body.setScale(0.25)
        self.body.reparentTo(self)
        self.heightFunction = heightFunction
    def _updateCollisions(self):
        pos = self._toon.getPos(self._camera) + self._collOffset
        self._camCollRay.setOrigin(pos)
        direction = -Vec3(pos)
        direction.normalize()
        self._camCollRay.setDirection(direction)
        self._collTrav.traverse(render)
        nodesInBetween = {}
        if self._collHandler.getNumEntries() > 0:
            self._collHandler.sortEntries()
            for entry in self._collHandler.getEntries():
                name = entry.getIntoNode().getName()
                if name.find('col_') >= 0:
                    np = entry.getIntoNodePath().getParent()
                    if np not in nodesInBetween:
                        nodesInBetween[np] = np.getParent()

        for np in nodesInBetween.keys():
            if np in self._betweenCamAndToon:
                del self._betweenCamAndToon[np]
            else:
                np.setTransparency(True)
                np.wrtReparentTo(self._transNP)
                if np.getName().find('lightFixture') >= 0:
                    np.find('**/*floor_mesh').hide()
                elif np.getName().find('platform') >= 0:
                    np.find('**/*Floor').hide()

        for np, parent in self._betweenCamAndToon.items():
            np.wrtReparentTo(parent)
            np.setTransparency(False)
            if np.getName().find('lightFixture') >= 0:
                np.find('**/*floor_mesh').show()
            elif np.getName().find('platform') >= 0:
                np.find('**/*Floor').show()

        self._betweenCamAndToon = nodesInBetween
Beispiel #22
0
 def fillActivityList(self, activityIds):
     self.activityList.removeAndDestroyAllItems()
     sortedList = activityIds[:]
     sortedList.sort()
     lastActivityId = -1
     for activityId in sortedList:
         if activityId == lastActivityId:
             continue
         lastActivityId = activityId
         number = sortedList.count(activityId)
         text = TTLocalizer.PartyActivityNameDict[activityId]["generic"]
         if number > 1:
             text += " X %d" % number
         item = DirectLabel(
             relief = None,
             text = text,
             text_align = TextNode.ACenter,
             text_scale = 0.05,
             text_pos = (0.0, -0.15),
             geom_scale = 0.3,
             geom_pos = Vec3(0.0, 0.0, 0.07),
             geom = PartyUtils.getPartyActivityIcon(self.activityIconsModel, PartyGlobals.ActivityIds.getString(activityId))
         )
         self.activityList.addItem(item)
Beispiel #23
0
 def startActive(self, showStartTimestamp):
     DistributedPartyFireworksActivity.notify.debug('startActive')
     messenger.send(FireworksStartedEvent)
     timeSinceStart = globalClockDelta.localElapsedTime(showStartTimestamp)
     if timeSinceStart > self.rocketActor.getDuration('launch'):
         self.rocketActor.hide()
         self.startShow(self.eventId, self.showStyle, showStartTimestamp)
     else:
         self.rocketActor.play('launch')
         self.rocketParticleSeq = Sequence(
             Wait(RocketSoundDelay), Func(base.playSfx, self.launchSound),
             Func(self.rocketExplosionEffect.start),
             Wait(RocketDirectionDelay),
             LerpHprInterval(self.rocketActor, 4.0, Vec3(0, 0, -60)),
             Func(self.rocketExplosionEffect.end),
             Func(self.rocketActor.hide))
         self.rocketParticleSeq.start()
         taskMgr.doMethodLater(FireworksPostLaunchDelay,
                               self.startShow,
                               self.taskName('delayedStartShow'),
                               extraArgs=[
                                   self.eventId, self.showStyle,
                                   showStartTimestamp, self.root
                               ])
Beispiel #24
0
    def createBattleCheerInterval(self):
        result = Sequence()
        for i in range(self.numFightAnims):
            animKey = 'fight%d' % i
            animAndSoundIval = self.createAnimAndSoundIval(animKey)
            origAnimName = self.node.getAnimFilename(animKey).split('/')[-1]
            if self.hasOverrideIval(origAnimName):
                result.append(self.getOverrideIval(origAnimName))
            elif self.hasSpecialIval(origAnimName):
                result.append(
                    Parallel(animAndSoundIval,
                             self.getSpecialIval(origAnimName)))
            else:
                result.append(animAndSoundIval)

        self.createBattleCheerText()
        battleCheerTextIval = Sequence(
            Func(self.hpText.show),
            self.hpText.posInterval(duration=4.0,
                                    pos=Vec3(0, 0, 7),
                                    startPos=(0, 0, 3)),
            Func(self.hpText.hide))
        ivalWithText = Parallel(battleCheerTextIval, result)
        return ivalWithText
Beispiel #25
0
    def raycastHotspots(self, x, y):
        '''
        Returns the hotspot(s) under the given window coordinates.
        @param x: The x window coordinate of the mouse in render space.
        @param y: The y window coordinate of the mouse in render space.
        @return: A list of Hotspot instances or None. 
        '''
        screenPoint = sprite2d.getRelativePoint(render, Vec3(x, 1.0, y))
        hotspots = []
        sx = int(screenPoint.getX())
        sy = int(screenPoint.getZ())

        # use the node's hotspots map if exists, otherwise check if the click point
        # lies inside a hotspot's bounds
        if self.node.hotspotsMapFilename:
            # convert the coordinates from -1..1 to 0..1 range
            x = (x + 1) / 2.0
            y = (y + 1) / 2.0
            hpName = self.hotspotsMap.getHotspot(x, 1.0 - y)
            hp = self.node.getHotspot(hpName)
            if hp:
                hotspots.append(hp)
        else:
            # check through bounds
            for hp in self.node.getHotspots():
                if sx >= hp.xo and sx <= hp.xe and sy >= hp.yo and sy <= hp.ye:
                    maskImg = self.hotspotsImageMasks.get(hp.name)
                    if maskImg is not None:
                        imgX = int(maskImg.getXSize() * sx / (hp.xe - hp.xo))
                        imgY = int(maskImg.getYSize() * sy / (hp.ye - hp.yo))
                        col = maskImg.getXel(imgX, imgY)
                        if col[0] == 0.0 and col[1] == 0.0 and col[2] == 0.0:
                            continue

                    hotspots.append(hp)
        return hotspots
 def checkTargets(self, task=None):
     """
     Do a distance check against all the targets in the pond.
     If we hit one of the targets, send an update to the AI and return 1
     Otherwise just return 0
     """
     self.notify.debug("checkTargets")
     if self.localToonSpot != None:
         for target in self.targets.values():
             targetPos = target.getPos(render)
             distVec = Vec3(targetPos - self.localToonBobPos)
             dist = distVec.length()
             if dist < target.getRadius():
                 self.notify.debug("checkTargets: hit target: %s" % (target.getDoId()))
                 self.d_hitTarget(target)
                 return Task.done
         # Check again later
         taskMgr.doMethodLater(self.pollInterval,
                               self.checkTargets,
                               self.taskName("checkTargets"))
     else:
         # Not sure why this is happening.
         self.notify.warning('localToonSpot became None while checking targets')
     return Task.done
Beispiel #27
0
 def GetAxis( self, collEntry ):
     axis = Base.GetAxis( self, collEntry )
     
     # Return None if the axis is None
     if axis is None:
         return None
     
     if axis.vector != CAMERA_VECTOR:
         
         # Return the axis from the specified normal within a tolerance of 
         # degrees
         normal = collEntry.getSurfaceNormal( self )
         normal.normalize()
         for axis in self.axes:
             if math.fabs( normal.angleDeg( axis.vector ) - 90 ) < ( 2.5 / self.size ):
                 return axis
     else:
         
         # Get the collision point on the poly, return the axis if the
         # mouse is within tolerance of the circle
         point = collEntry.getSurfacePoint( collEntry.getIntoNodePath() )
         length = Vec3( point / 1.25 ).length()
         if length > 0.9 and length < 1:
             return axis
 def announceGenerate(self):
     DistributedElevatorExt.DistributedElevatorExt.announceGenerate(self)
     angle = self.startingHpr[0]
     angle -= 90
     radAngle = deg2Rad(angle)
     unitVec = Vec3(math.cos(radAngle), math.sin(radAngle), 0)
     unitVec *= 45.0
     self.endPos = self.startingPos + unitVec
     self.endPos.setZ(0.5)
     dist = Vec3(self.endPos - self.enteringPos).length()
     wheelAngle = (dist / 4.7999999999999998 * 1.3999999999999999 *
                   math.pi) * 360
     self.kartEnterAnimateInterval = Parallel(
         LerpHprInterval(
             self.wheels[0], 5.0,
             Vec3(self.wheels[0].getH(), wheelAngle,
                  self.wheels[0].getR())),
         LerpHprInterval(
             self.wheels[1], 5.0,
             Vec3(self.wheels[1].getH(), wheelAngle,
                  self.wheels[1].getR())),
         LerpHprInterval(
             self.wheels[2], 5.0,
             Vec3(self.wheels[2].getH(), wheelAngle,
                  self.wheels[2].getR())),
         LerpHprInterval(
             self.wheels[3], 5.0,
             Vec3(self.wheels[3].getH(), wheelAngle,
                  self.wheels[3].getR())),
         name='CogKartAnimate')
     trolleyExitTrack1 = Parallel(LerpPosInterval(self.golfKart, 5.0,
                                                  self.endPos),
                                  self.kartEnterAnimateInterval,
                                  name='CogKartExitTrack')
     self.trolleyExitTrack = Sequence(trolleyExitTrack1)
     self.trolleyEnterTrack = Sequence(
         LerpPosInterval(self.golfKart,
                         5.0,
                         self.startingPos,
                         startPos=self.enteringPos))
     self.closeDoors = Sequence(self.trolleyExitTrack,
                                Func(self.onDoorCloseFinish))
     self.openDoors = Sequence(self.trolleyEnterTrack)
Beispiel #29
0
 def __init__( self, *args, **kwargs ):
     Base.__init__( self, *args, **kwargs )
     
     # Create the 'ball' border
     self.border = self.CreateCircle( GREY, 1 )
     
     # Create the collision sphere - except for the camera normal, all axes
     # will use this single collision object
     self.collSphere = CollisionSphere( 0, 1 )
     
     # Create x, y, z and camera normal axes
     self.axes.append( self.CreateRing( Vec3(1, 0, 0), RED, 
                                        Vec3(0, 0, 90) ) )
     self.axes.append( self.CreateRing( Vec3(0, 1, 0), GREEN, 
                                        Vec3(0, 90, 0) ) )
     self.axes.append( self.CreateRing( Vec3(0, 0, 1), BLUE, 
                                        Vec3(0, 0, 0) ) )
     
     # DEBUG
     self.foobar = self.CreateCamCircle( TEAL, 1.2 )
     self.axes.append( self.foobar )
Beispiel #30
0
def avatardown(move):
    global godmode
    if not godmode: move = 0
    return Vec3(0, 0, -move)
Beispiel #31
0
def avatarup(move):
    global godmode
    if not godmode: move = 0
    return Vec3(0, 0, move)
 def __defineConstants(self):
     self.TOON_SPEED = 8.0
     self.TOON_Z = 0
     self.MinSuitSpeedRange = [0.8 * self.TOON_SPEED, 0.6 * self.TOON_SPEED]
     self.MaxSuitSpeedRange = [1.1 * self.TOON_SPEED, 2.0 * self.TOON_SPEED]
     self.FASTER_SUIT_CURVE = 1
     self.SLOWER_SUIT_CURVE = self.getDifficulty() < 0.5
     self.slowerSuitPeriods = {
         2000: {
             4: [128, 76],
             8: [128, 99, 81, 68],
             12: [128, 108, 93, 82, 74, 67],
             16: [128, 112, 101, 91, 83, 76, 71, 66]
         },
         1000: {
             4: [110, 69],
             8: [110, 88, 73, 62],
             12: [110, 95, 83, 74, 67, 61],
             16: [110, 98, 89, 81, 75, 69, 64, 60]
         },
         5000: {
             4: [96, 63],
             8: [96, 79, 66, 57],
             12: [96, 84, 75, 67, 61, 56],
             16: [96, 87, 80, 73, 68, 63, 59, 55]
         },
         4000: {
             4: [86, 58],
             8: [86, 71, 61, 53],
             12: [86, 76, 68, 62, 56, 52],
             16: [86, 78, 72, 67, 62, 58, 54, 51]
         },
         3000: {
             4: [78, 54],
             8: [78, 65, 56, 49],
             12: [78, 69, 62, 57, 52, 48],
             16: [78, 71, 66, 61, 57, 54, 51, 48]
         },
         9000: {
             4: [71, 50],
             8: [71, 60, 52, 46],
             12: [71, 64, 58, 53, 49, 45],
             16: [71, 65, 61, 57, 53, 50, 47, 45]
         }
     }
     self.slowerSuitPeriodsCurve = {
         2000: {
             4: [128, 65],
             8: [128, 78, 66, 64],
             12: [128, 88, 73, 67, 64, 64],
             16: [128, 94, 79, 71, 67, 65, 64, 64]
         },
         1000: {
             4: [110, 59],
             8: [110, 70, 60, 58],
             12: [110, 78, 66, 61, 59, 58],
             16: [110, 84, 72, 65, 61, 59, 58, 58]
         },
         5000: {
             4: [96, 55],
             8: [96, 64, 56, 54],
             12: [96, 71, 61, 56, 54, 54],
             16: [96, 76, 65, 59, 56, 55, 54, 54]
         },
         4000: {
             4: [86, 51],
             8: [86, 59, 52, 50],
             12: [86, 65, 56, 52, 50, 50],
             16: [86, 69, 60, 55, 52, 51, 50, 50]
         },
         3000: {
             4: [78, 47],
             8: [78, 55, 48, 47],
             12: [78, 60, 52, 48, 47, 47],
             16: [78, 63, 55, 51, 49, 47, 47, 47]
         },
         9000: {
             4: [71, 44],
             8: [71, 51, 45, 44],
             12: [71, 55, 48, 45, 44, 44],
             16: [71, 58, 51, 48, 45, 44, 44, 44]
         }
     }
     self.fasterSuitPeriods = {
         2000: {
             4: [54, 42],
             8: [59, 52, 47, 42],
             12: [61, 56, 52, 48, 45, 42],
             16: [61, 58, 54, 51, 49, 46, 44, 42]
         },
         1000: {
             4: [50, 40],
             8: [55, 48, 44, 40],
             12: [56, 52, 48, 45, 42, 40],
             16: [56, 53, 50, 48, 45, 43, 41, 40]
         },
         5000: {
             4: [47, 37],
             8: [51, 45, 41, 37],
             12: [52, 48, 45, 42, 39, 37],
             16: [52, 49, 47, 44, 42, 40, 39, 37]
         },
         4000: {
             4: [44, 35],
             8: [47, 42, 38, 35],
             12: [48, 45, 42, 39, 37, 35],
             16: [49, 46, 44, 42, 40, 38, 37, 35]
         },
         3000: {
             4: [41, 33],
             8: [44, 40, 36, 33],
             12: [45, 42, 39, 37, 35, 33],
             16: [45, 43, 41, 39, 38, 36, 35, 33]
         },
         9000: {
             4: [39, 32],
             8: [41, 37, 34, 32],
             12: [42, 40, 37, 35, 33, 32],
             16: [43, 41, 39, 37, 35, 34, 33, 32]
         }
     }
     self.fasterSuitPeriodsCurve = {
         2000: {
             4: [62, 42],
             8: [63, 61, 54, 42],
             12: [63, 63, 61, 56, 50, 42],
             16: [63, 63, 62, 60, 57, 53, 48, 42]
         },
         1000: {
             4: [57, 40],
             8: [58, 56, 50, 40],
             12: [58, 58, 56, 52, 46, 40],
             16: [58, 58, 57, 56, 53, 49, 45, 40]
         },
         5000: {
             4: [53, 37],
             8: [54, 52, 46, 37],
             12: [54, 53, 52, 48, 43, 37],
             16: [54, 54, 53, 51, 49, 46, 42, 37]
         },
         4000: {
             4: [49, 35],
             8: [50, 48, 43, 35],
             12: [50, 49, 48, 45, 41, 35],
             16: [50, 50, 49, 48, 46, 43, 39, 35]
         },
         3000: {
             4: [46, 33],
             8: [47, 45, 41, 33],
             12: [47, 46, 45, 42, 38, 33],
             16: [47, 46, 46, 45, 43, 40, 37, 33]
         },
         9000: {
             4: [43, 32],
             8: [44, 42, 38, 32],
             12: [44, 43, 42, 40, 36, 32],
             16: [44, 44, 43, 42, 40, 38, 35, 32]
         }
     }
     self.CELL_WIDTH = MazeData.CELL_WIDTH
     self.MAX_FRAME_MOVE = self.CELL_WIDTH / 2
     startOffset = 3
     self.startPosHTable = [[Point3(0, startOffset, self.TOON_Z), 0],
                            [Point3(0, -startOffset, self.TOON_Z), 180],
                            [Point3(startOffset, 0, self.TOON_Z), 270],
                            [Point3(-startOffset, 0, self.TOON_Z), 90]]
     self.camOffset = Vec3(0, -19, 45)
Beispiel #33
0
    def commonMove(self):
        """Move the cog thief. Common for all 3 behaviors """
        if not self.lastThinkTime:
            self.lastThinkTime = globalClock.getFrameTime()
        dt = globalClock.getFrameTime() - self.lastThinkTime

        # Step 1:  Update our position.
        # Update our position based on the velocity
        # vector we computed last time around.

        self.oldpos = self.suit.getPos()
        # save off our previous position

        pos = self.suit.getPos()
        pos += self.velocity * dt
        # apply velocities.
        self.suit.setPos(pos)

        # Step 2:  SeeFriends.
        # Determine if we can see any of our flockmates.

        self.seeFriends()

        acc = Vec3(0, 0, 0)

        # well first off we want to move to our target
        self.accumulate(acc, self.getTargetVector())

        # Step 3:  Flocking behavior.
        # Do we see any of our flockmates?  If yes, it's time to implement
        # the first Three Rules (they don't matter if we can't see anybody)

        if self.numFlockmatesSeen > 0:
            #if hasattr(base,'doDebug') and base.doDebug:
            #    import pdb; pdb.set_trace()
            keepDistanceVector = self.keepDistance()
            oldAcc = Vec3(acc)
            self.accumulate(acc, keepDistanceVector)
            if self.cogIndex == 0:
                #self.notify.debug('oldAcc=%s, keepDist=%s newAcc=%s' %
                #                  (oldAcc,keepDistanceVector, acc))
                pass

        # Step 8:  Constrain acceleration
        # If our acceleration change is more than we allow, constrain it

        if (acc.length() > self.maxAcceleration):
            # definitely too much...constrain to maximum change
            acc.normalize()
            acc *= self.maxAcceleration

        # Step 9:  Implementation.
        # Here's where we apply our newly computed acceleration vector
        # to create a new velocity vector to use next update cycle.

        self.oldVelocity = self.velocity
        # save off our previous velocity

        # now add in the acceleration

        self.velocity += acc

        # Step 10:  constraint Y velocity changes.
        # Attempt to restrict flight straight up/down by damping out Y axis velocity.
        # This isn't strictly necessary, but does lead to more realistic looking flight.

        # Step 11:  Constrain our speed.
        # If we're moving faster than we're allowed to move, constrain our velocity.
        if self.velocity.length() > self.maxVelocity:
            self.velocity.normalize()
            self.velocity *= self.maxVelocity

        # Step 12:  Compute roll/pitch/yaw.
        # Compute our orientation after all this speed adjustment nonsense.
        # bah no need, we turn on a dime towards our velocity
        forwardVec = Vec3(1, 0, 0)
        heading = rad2Deg(math.atan2(self.velocity[1], self.velocity[0]))
        heading -= 90
        self.suit.setH(heading)
Beispiel #34
0
# uncompyle6 version 3.2.3
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: C:\Cygwin\home\piratepub\player_pirates_1_0_33QA\pirates\src\leveleditor\worldData\RavensCoveJailInterior.py
from pandac.PandaModules import Point3, VBase3, Vec4, Vec3

objectStruct = {
    'LevelEnvironment': {
        'BASE': {
            'AmbientColor': Vec4(1, 0.25, 0.25, 1),
            'Direction': Vec3(0.0, 0.0, 270.0),
            'FogColor': Vec4(0.27, 0.31, 0.32, 0),
            'FogLinearRange': (0.0, 80.0),
            'FogType': 2,
            'LightSwitch': [0, 0, 0],
            'SkyType': 10,
            'EnvEffect': 1
        }
    },
    'Objects': {
        '1271353470.51akelts0': {
            'Type': 'Building Interior',
            'Name': '',
            'Instanced': False,
            'Objects': {
                '1168049461.92akelts': {
                    'Type': 'Player Spawn Node',
                    'Hpr': VBase3(-68.11, 0.0, 0.0),
                    'Index': '2',
                    'Pos': Point3(-54.973, 5.818, -1.5),
                    'Scale': VBase3(1.0, 1.0, 1.0),
    def enterFinalResults(self):
        lerpTrack = Parallel()
        lerpDur = 0.5
        tY = 0.6
        bY = -.05
        lX = -.5
        cX = 0
        rX = 0.5
        scorePanelLocs = (((cX, bY),),
         ((lX, bY), (rX, bY)),
         ((cX, tY), (lX, bY), (rX, bY)),
         ((lX, tY),
          (rX, tY),
          (lX, bY),
          (rX, bY)))
        scorePanelLocs = scorePanelLocs[self.numPlayers - 1]
        for i in xrange(self.numPlayers):
            panel = self.scorePanels[i]
            pos = scorePanelLocs[i]
            lerpTrack.append(Parallel(LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut')))

        self.showScoreTrack = Parallel(lerpTrack, Sequence(Wait(IceGameGlobals.ShowScoresDuration), Func(self.gameOver)))
        self.showScoreTrack.start()
Beispiel #36
0
    def __init__(self, partyEditor, id, isDecoration=False, **kw):
        self.partyEditor = partyEditor
        self.id = id
        self.isDecoration = isDecoration
        self.unreleased = self.calcUnreleased(id)
        self.comingSoonTextScale = 1.0
        if self.isDecoration:
            self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor']
            colorList = ((1.0, 0.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0),
                         (0.0, 1.0, 1.0, 1.0), (0.5, 0.5, 0.5, 1.0))
            assetName = PartyGlobals.DecorationIds.getString(self.id)
            if assetName == 'Hydra':
                assetName = 'StageSummer'
            geom = self.partyEditor.decorationModels.find(
                '**/partyDecoration_%s' % assetName)
            if geom.isEmpty() or self.unreleased:
                helpGui = loader.loadModel(
                    'phase_3.5/models/gui/tt_m_gui_brd_help')
                helpImageList = (helpGui.find('**/tt_t_gui_brd_helpUp'),
                                 helpGui.find('**/tt_t_gui_brd_helpDown'),
                                 helpGui.find('**/tt_t_gui_brd_helpHover'),
                                 helpGui.find('**/tt_t_gui_brd_helpDown'))
                geom = helpImageList[2]
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(2.5, 2.5, 2.5)
                geom_pos = (0.0, 0.0, 0.0)
                self.comingSoonTextScale = 0.035
            else:
                geom_pos = (0.0, 0.0, -3.0)
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(0.06, 0.0001, 0.06)
                if self.id in [
                        PartyGlobals.DecorationIds.CogStatueVictory,
                        PartyGlobals.DecorationIds.TubeCogVictory,
                        PartyGlobals.DecorationIds.CogIceCreamVictory
                ]:
                    geom_pos = (0.0, 0.0, -3.9)
                    scale = Vec3(0.05, 0.0001, 0.05)
        else:
            self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor']
            colorList = ((0.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0),
                         (1.0, 1.0, 0.0, 1.0), (0.5, 0.5, 0.5, 1.0))
            iconString = PartyGlobals.ActivityIds.getString(self.id)
            if self.id == PartyGlobals.ActivityIds.PartyJukebox40:
                iconString = PartyGlobals.ActivityIds.getString(
                    PartyGlobals.ActivityIds.PartyJukebox)
            elif self.id == PartyGlobals.ActivityIds.PartyDance20:
                iconString = PartyGlobals.ActivityIds.getString(
                    PartyGlobals.ActivityIds.PartyDance)
            geom = getPartyActivityIcon(self.partyEditor.activityIconsModel,
                                        iconString)
            scale = 0.35
            geom3_color = (0.5, 0.5, 0.5, 1.0)
            geom_pos = (0.0, 0.0, 0.0)
            self.comingSoonTextScale = 0.25
        optiondefs = (('geom', geom, None), ('geom3_color', geom3_color, None),
                      ('geom_pos', geom_pos, None), ('relief', None, None))
        self.defineoptions(kw, optiondefs)
        DirectButton.__init__(self, self.partyEditor.elementList)
        self.initialiseoptions(PartyEditorListElement)
        self.setName('%sListElement' % self.name)
        self.setScale(scale)
        self.bind(DirectGuiGlobals.B1PRESS, self.clicked)
        self.bind(DirectGuiGlobals.B1RELEASE, self.released)
        self.partyEditorGridElements = []
        if self.isDecoration:
            for i in range(PartyGlobals.DecorationInformationDict[self.id]
                           ['limitPerParty']):
                self.partyEditorGridElements.append(
                    PartyEditorGridElement(
                        self.partyEditor, self.id, self.isDecoration,
                        self.checkSoldOutAndPaidStatusAndAffordability))

        else:
            for i in range(PartyGlobals.ActivityInformationDict[self.id]
                           ['limitPerParty']):
                self.partyEditorGridElements.append(
                    PartyEditorGridElement(
                        self.partyEditor, self.id, self.isDecoration,
                        self.checkSoldOutAndPaidStatusAndAffordability))

        self.activeGridElementIndex = -1
        self.adjustForUnreleased()
        return
 def exitNormal(self):
     self.setAnimState('off', 1.0)
     if self.isLocal:
         self.activity.orthoWalk.stop()
     self.toon.lerpLookAt(Vec3.forward(), time=0.2, blink=0)
 def enterNormal(self):
     self.notify.debug('enterNormal')
     self.setAnimState('Catching', 1.0)
     if self.isLocal:
         self.activity.orthoWalk.start()
     self.toon.lerpLookAt(Vec3.forward() + Vec3.up(), time=0.2, blink=0)