def release(self):
        throwPath = NodePath('ThrowPath')
        throwPath.reparentTo(self.avatar)
        throwPath.setScale(render, 1)
        throwPath.setPos(0, 160, -120)
        throwPath.setHpr(0, 90, 0)

        if not self.gag:
            self.build()
            
        self.entity = self.gag
        self.gag = None
        self.entity.wrtReparentTo(render)
        self.entity.setHpr(throwPath.getHpr(render))

        self.setHandJoint()
        self.track = ProjectileInterval(self.entity, startPos = self.handJoint.getPos(render), endPos = throwPath.getPos(render), gravityMult = 0.9, duration = 3)
        self.track.start()
        
        if self.isLocal():
            self.startTimeout()
            self.buildCollisions()
            self.avatar.acceptOnce('gagSensor-into', self.onCollision)
        
        self.reset()
        TrapGag.release(self)
Exemplo n.º 2
0
    def __init__(self):
        TrapGag.__init__(self)
        LocationGag.__init__(self, 10, 50, shadowScale=0.25)

        # trapMode is the mode the trap gag is on. 0) Trapdoor/Quicksand and 1) Banana Peel, marbles, etc.

        # This keeps track of the entities we drop.
        self.entities = []

        # This is the length (in seconds) of how long an entity exists.
        self.lifeTime = 120

        # This is the minimum distance an entity has to be from another.
        self.minSafeDistance = 5

        # collRadius is the radius of the CollisionSphere that detects suits.

        # This is the sound effect called when a trap is tripped.
        self.activateSfx = None

        self.entityTrack = None

        if metadata.PROCESS == 'client':
            if self.activateSfxPath:
                self.activateSfx = base.audio3d.loadSfx(self.activateSfxPath)
 def startTrap(self):
     TrapGag.startTrap(self)
     if not self.gag:
         self.build()
         self.setHandJoint()
     self.gag.reparentTo(self.handJoint)
     self.avatar.play('toss', fromFrame = 22)
    def __init__(self):
        TrapGag.__init__(self)
        self.particles = None
        self.idleSfx = None
        self.timeout = 5.0

        if metadata.PROCESS == 'client':
            if self.idleSfxPath:
                self.idleSfx = base.audio3d.loadSfx(self.idleSfxPath)
Exemplo n.º 5
0
    def start(self):
        TrapGag.startTrap(self)

        # Let's start the location seeker if we're using a trapdoor or quicksand gag.
        if self.trapMode == 0:
            LocationGag.start(self, self.avatar)
        elif self.trapMode == 1:
            if not self.gag:
                self.build()
                self.setHandJoint()
            self.gag.reparentTo(self.handJoint)
            self.avatar.play('toss', fromFrame=22)
Exemplo n.º 6
0
    def release(self):
        TrapGag.release(self)

        # Let's release the location seeker if we're using a trapdoor or quicksand.
        if self.trapMode == 0:
            LocationGag.release(self)
            self.build()
            self.buildCollisions()
            actorTrack = LocationGag.getActorTrack(self)
            if actorTrack:
                LocationGag.getSoundTrack(self).start()
                if self.isLocal():
                    actorTrack.append(
                        Func(self.avatar.b_gagThrow, self.getID()))
                actorTrack.start()
        elif self.trapMode == 1:
            self.startEntity()
    def buildCollisions(self):
        TrapGag.buildCollisions(self)
        gagSph = CollisionSphere(0, 0, 0, 1)
        gagSph.setTangible(0)
        gagNode = CollisionNode('gagSensor')
        gagNode.addSolid(gagSph)
        gagNP = self.entity.attachNewNode(gagNode)
        gagNP.setScale(0.75, 0.8, 0.75)
        gagNP.setPos(0.0, 0.1, 0.5)
        gagNP.setCollideMask(BitMask32.bit(0))
        gagNP.node().setFromCollideMask(CIGlobals.FloorBitmask)

        event = CollisionHandlerEvent()
        event.setInPattern("%fn-into")
        event.setOutPattern("%fn-out")
        base.cTrav.addCollider(gagNP, event)
        self.avatar.acceptOnce('gagSensor-into', self.onCollision)
Exemplo n.º 8
0
    def buildCollisions(self):
        TrapGag.buildCollisions(self)
        gagSph = CollisionSphere(0, 0, 0, self.collRadius)
        gagSph.setTangible(0)
        gagNode = CollisionNode('gagSensor')
        gagNode.addSolid(gagSph)
        gagNP = self.gag.attachNewNode(gagNode)
        gagNP.setScale(0.75, 0.8, 0.75)
        gagNP.setPos(0.0, 0.1, 0.5)
        gagNP.setCollideMask(BitMask32.bit(0))
        gagNP.node().setFromCollideMask(CIGlobals.WallBitmask
                                        | CIGlobals.FloorBitmask)

        event = CollisionHandlerEvent()
        event.set_in_pattern("%fn-into")
        event.set_out_pattern("%fn-out")
        base.cTrav.addCollider(gagNP, event)
        if self.isLocal():
            self.avatar.accept('gagSensor-into', self.onCollision)
Exemplo n.º 9
0
 def unEquip(self):
     TrapGag.unEquip(self)
     LocationGag.cleanupLocationSeeker(self)
Exemplo n.º 10
0
 def equip(self):
     TrapGag.equip(self)
 def onCollision(self, entry):
     TrapGag.onCollision(self, entry)
     x, y, z = self.entity.getPos(render)
     base.localAvatar.sendUpdate('setGagPos', [self.getID(), x, y, z])
 def build(self):
     self.buildParticles()
     self.setHandJoint()
     return TrapGag.build(self)
 def unEquip(self):
     TrapGag.unEquip(self)
     self.cleanupParticles()
 def delete(self):
     TrapGag.delete(self)
     self.cleanupParticles()