def __init__(self):
     Gag.__init__(self)
     self.lHandJoint = None
     self.hips = None
     self.PNTNEARZERO = Point3(0.01, 0.01, 0.01)
     self.PNTNORMAL = Point3(1, 1, 1)
     self.healAmount = None
Ejemplo n.º 2
0
 def unEquip(self):
     if self.isLocal():
         self.resetCrashEffect()
     LocationGag.cleanup(self)
     if self.state != GagState.LOADED:
         self.completeDrop()
     Gag.unEquip(self)
 def build(self):
     if not self.gag:
         Gag.build(self)
         self.equip()
         if self.anim and self.gag:
             self.gag.loop('chan')
     return self.gag
    def start(self):
        Gag.start(self)
        if not self.gag:
            self.build()

        if self.isLocal():
            self.powerBar.start()
Ejemplo n.º 5
0
    def __init__(self):
        Gag.__init__(self)
        LocationGag.__init__(self, 3, 50)
        self.crosshair.wantCrosshair = False
        self.holdGag = False
        self.missSfx = None
        self.fallSfx = None
        self.chooseLocFrame = 34
        self.completeFrame = 77
        self.collHandlerF = CollisionHandlerFloor()
        self.fallDuration = 0.75
        self.isDropping = False
        self.timeout = 3.0
        if metadata.PROCESS == 'client':
            self.missSfx = base.audio3d.loadSfx(self.missSfxPath)
            self.fallSfx = base.audio3d.loadSfx(self.fallSoundPath)

        self.dropCollider = None
        self.colliderRadius = 0.75
        self.colliderOfs = Point3(0)

        self.dropMdl = None

        # Variables to handle the drop preview with large drops.
        self.crashSite = None
        self.crashSiteGag = None
        self.crashSiteShadow = None
        self.crashSiteIval = None
        self.crashStartPos = None
        self.crashEndPos = None
        self.crashBegun = False
        self.shadowIdleTaskName = 'Handle-IdleShadow'

        self.lastShadowMoveTime = 0.0
Ejemplo n.º 6
0
    def equip(self):
        Gag.equip(self)
        LocationGag.equip(self)

        if self.isLocal() and self.getName() == GagGlobals.GrandPiano:
            base.taskMgr.add(self.tickShadowIdleTask, self.shadowIdleTaskName)
            self.accept(self.getLocationSeeker().getShadowMovedName(),
                        self.__shadowMoved)
Ejemplo n.º 7
0
 def cleanupGag(self):
     print "cleanupGag"
     if self.state == GagState.LOADED or self.state == GagState.RECHARGING:
         Gag.cleanupGag(self)
         if CIGlobals.isNodePathOk(self.megaphone):
             if CIGlobals.isNodePathOk(self.avatar):
                 copies = self.avatar.findAllMatches('**/%s' % self.megaphone.getName())
                 for copy in copies:
                     copy.removeNode()
         self.megaphone = None
Ejemplo n.º 8
0
    def throw(self):
        Gag.throw(self)

        # Fade out and stop the spray sound
        self.doSpraySoundIval(1)

        if self.avatar.isEmpty():
            return

        self.stopParticle()
Ejemplo n.º 9
0
    def __init__(self):
        Gag.__init__(self)
        self.appearSfx = None
        self.soundSfx = None
        self.megaphone = None
        self.tracks = None
        self.timeout = 5.0
        self.holdGag = False

        if metadata.PROCESS == 'client':
            self.appearSfx = base.audio3d.loadSfx(self.appearSfxPath)
            self.soundSfx = base.audio3d.loadSfx(self.soundSfxPath)
Ejemplo n.º 10
0
 def reset(self):
     self.stopParticle()
     self.stopSpraySoundIval()
     if self.spraySound:
         self.spraySound.stop()
     if self.spRootUpdateTask:
         taskMgr.remove(self.spRootUpdateTask)
         self.spRootUpdateTask = None
     if self.sprayParticleRoot:
         self.sprayParticleRoot.removeNode()
         self.sprayParticleRoot = None
     Gag.reset(self)
Ejemplo n.º 11
0
    def equip(self):
        Gag.equip(self)
        self.sprayParticleRoot = render.attachNewNode('sprayParticleRoot')
        self.sprayParticleRoot.setLightOff(1)
        self.sprayParticleRoot.hide(CIGlobals.ShadowCameraBitmask)

        if self.isLocal():
            self.waterBar = WaterBar()
            self.__updateWaterBar()
            self.waterBar.reparentTo(base.a2dLeftCenter)
            self.waterBar.setScale(0.6)
            self.waterBar.setX(0.166)
            self.barTask = taskMgr.add(self.__barUpdate, "SquirtGag.barUpdate")
Ejemplo n.º 12
0
    def __init__(self):
        Gag.__init__(self)
        self.splatDist = None
        self.sprayParticleRoot = None
        self.waterStreamParent = None
        self.spRootUpdateTask = None
        self.sprayParticle = None
        self.spraySound = base.audio3d.loadSfx(self.spraySoundPath)
        self.spraySound.setVolume(0.0)
        self.lastDmgTime = 0.0
        self.lastSprayTime = 0.0
        self.spraySoundIval = None

        self.waterBar = None
        self.barTask = None
    def equip(self):
        Gag.equip(self)

        if self.isLocal():
            vmGag = base.localAvatar.getFPSCam().vmGag
            if vmGag:
                vmGag.setPosHpr(0.07, 0.17, -0.01, 0, -100, -10)
                vmGag.setScale(self.gag.getScale() * 0.567)
            vm = base.localAvatar.getViewModel()
            fpsCam = base.localAvatar.getFPSCam()
            fpsCam.setVMAnimTrack(
                Sequence(ActorInterval(vm, "pie_draw"),
                         Func(vm.loop, "pie_idle")))

        self.__doDraw()
Ejemplo n.º 14
0
    def start(self):
        Gag.start(self)

        base.audio3d.attachSoundToObject(self.spraySound, self.avatar)
        self.spraySound.setLoop(True)

        # Start and fade in the spray sound.
        self.doSpraySoundIval(0)

        self.loadParticle()
        self.sprayParticle.start(self.waterStreamParent,
                                 self.sprayParticleRoot)

        self.spRootUpdateTask = taskMgr.add(self.__updateParticleParent,
                                            "FH.uPP",
                                            sort=-10)
Ejemplo n.º 15
0
 def start(self):
     Gag.start(self)
     if self.isLocal():
         self.startTimeout()
     if self.tracks:
         self.tracks.pause()
         self.tracks = None
     self.build()
     base.audio3d.attachSoundToObject(self.soundSfx, self.avatar)
     base.audio3d.attachSoundToObject(self.appearSfx, self.avatar)
     if self.isLocal():
         if base.localAvatar.isFirstPerson():
             vm = base.localAvatar.getViewModel()
             fpsCam = base.localAvatar.getFPSCam()
             fpsCam.setVMAnimTrack(Sequence(Func(fpsCam.vmRoot2.setY, 0.5), Wait(0.75), Func(vm.show), ActorInterval(vm, "sound"), Func(fpsCam.vmRoot2.setY, 0.0), Func(vm.hide)))
             self.gag.instanceTo(fpsCam.vmGag)
         base.localAvatar.sendUpdate('usedGag', [self.id])
 def unEquip(self):
     if self.powerBar:
         self.powerBar.hide()
     Gag.unEquip(self)
Ejemplo n.º 17
0
 def unEquip(self):
     if self.isLocal():
         self.cleanupWaterBar()
     Gag.unEquip(self)
Ejemplo n.º 18
0
 def unEquip(self):
     Gag.unEquip(self)
     self.finish()
 def setAvatar(self, avatar):
     Gag.setAvatar(self, avatar)
     if self.isLocal():
         self.powerBar = PowerBar()
 def start(self):
     Gag.start(self)
     if self.isLocal():
         self.startTimeout()
         base.localAvatar.sendUpdate('usedGag', [self.id])
 def __init__(self):
     Gag.__init__(self)
     self.entity = None
     self.timeout = 3.0
     if metadata.PROCESS == 'client':
         self.hitSfx = base.audio3d.loadSfx(self.hitSfxPath)
    def release(self):
        Gag.release(self)
        base.audio3d.attachSoundToObject(self.woosh, self.gag)
        base.playSfx(self.woosh, node=self.gag)

        if self.isLocal() and base.localAvatar.battleControls:
            if base.localAvatar.isFirstPerson():
                # Add a small kick to the camera to give more feedback
                self.getFPSCam().addViewPunch(
                    Vec3(random.uniform(.5, 1), random.uniform(-.5, -1), 0))

                startPos = camera.getPos(render) + camera.getQuat(
                    render).xform(Vec3.right())
                push = 0.0
            else:
                startPos = self.handJoint.getPos(render)
                push = (startPos - camera.getPos(render)).length()
            hitPos = PhysicsUtils.getHitPosFromCamera()
        else:
            startPos = self.handJoint.getPos(render)
            quat = Quat()
            quat.setHpr(
                self.avatar.getHpr(render) + (0, self.avatar.lookPitch, 0))
            hitPos = quat.xform(Vec3.forward() * self.power)
            hit = PhysicsUtils.rayTestClosestNotMe(
                self.avatar, startPos, hitPos,
                CIGlobals.WorldGroup | CIGlobals.LocalAvGroup)
            if hit is not None:
                hitPos = hit.getHitPos()

        throwDir = (hitPos - startPos).normalized()
        endPos = startPos + (throwDir * self.power) - (0, 0, 90)

        entity = self.gag

        if not entity:
            entity = self.build()

        gagRoot = render.attachNewNode('gagRoot')
        gagRoot.setPos(startPos)

        entity.reparentTo(render)
        entity.setPos(0, 0, 0)
        entity.headsUp(throwDir)
        rot = entity.getHpr(render)
        entity.reparentTo(gagRoot)
        entity.setHpr(rot[0], -90, 0)
        self.gag = None

        if not self.handJoint:
            self.handJoint = self.avatar.find('**/def_joint_right_hold')

        track = FlightProjectileInterval(gagRoot,
                                         startPos=startPos,
                                         endPos=endPos,
                                         gravityMult=1.07,
                                         duration=2.5)
        event = self.avatar.uniqueName('throwIvalDone') + '-' + str(
            hash(entity))
        track.setDoneEvent(event)
        base.acceptOnce(event, self.__handlePieIvalDone, [entity])
        track.start()

        if self.isLocal():
            collider = self.buildCollisions(entity)
            self.entities.append([gagRoot, track, collider])
            base.localAvatar.sendUpdate('usedGag', [self.id])
        else:
            self.entities.append([gagRoot, track, NodePath()])
        self.reset()
 def delete(self):
     if self.powerBar:
         self.powerBar.destroy()
         self.powerBar = None
     self.clearAnimTrack()
     Gag.delete(self)
 def __init__(self):
     Gag.__init__(self)
     self.splatScale = GagGlobals.splatSizes[self.name]
     self.entities = []
     self.timeout = 1.0
     self.powerBar = None
 def getGag(self):
     if not self.gag:
         return self.entity
     return Gag.getGag(self)
Ejemplo n.º 26
0
 def build(self):
     self.megaphone = loader.loadModel(self.megaphonePath)
     return Gag.build(self)