Exemplo n.º 1
0
 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 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 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.º 4
0
 def __init__(self, name, model, damage, hitSfx, idleSfx = None, particlesFx = None, anim = None, wantParticles = True):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim)
     self.wantParticles = wantParticles
     self.particles = None
     self.particlesFx = particlesFx
     self.idleSfx = None
     if game.process == 'client':
         if idleSfx:
             self.idleSfx = base.audio3d.loadSfx(idleSfx)
     return
Exemplo n.º 5
0
 def start(self):
     TrapGag.startTrap(self)
     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 onCollision(self, entry):
     TrapGag.onCollision(self, entry)
     gag = self.gag
     if not gag:
         gag = self.entity
     x, y, z = gag.getPos(render)
     self.avatar.sendUpdate('setGagPos', [self.getID(),
      x,
      y,
      z])
Exemplo n.º 7
0
 def start(self):
     TrapGag.startTrap(self)
     if self.trapMode == 0:
         LocationGag.start(self, self.avatar)
     else:
         if self.trapMode == 1:
             if not self.gag:
                 self.build()
                 self.setHandJoint()
             self.gag.reparentTo(self.handJoint)
             self.avatar.play('toss', fromFrame=22)
Exemplo n.º 8
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.º 9
0
 def __init__(self, name, model, damage, hitSfx, collRadius, mode = 0, anim = None, autoRelease = True, activateSfx = None):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim, doesAutoRelease=autoRelease)
     LocationGag.__init__(self, 10, 50, shadowScale=0.25)
     self.trapMode = mode
     self.entities = []
     self.lifeTime = 120
     self.minSafeDistance = 5
     self.collRadius = collRadius
     self.activateSfx = None
     if game.process == 'client':
         if activateSfx:
             self.activateSfx = base.audio3d.loadSfx(activateSfx)
     return
Exemplo n.º 10
0
 def __init__(self, name, model, damage, hitSfx, collRadius, mode=0, anim=None, autoRelease=True, activateSfx=None):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim, doesAutoRelease=autoRelease)
     LocationGag.__init__(self, 10, 50, shadowScale=0.25)
     self.trapMode = mode
     self.entities = []
     self.lifeTime = 120
     self.minSafeDistance = 5
     self.collRadius = collRadius
     self.activateSfx = None
     self.entityTrack = None
     if game.process == 'client':
         if activateSfx:
             self.activateSfx = base.audio3d.loadSfx(activateSfx)
     return
Exemplo n.º 11
0
 def release(self):
     TrapGag.release(self)
     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()
Exemplo n.º 12
0
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, 1)
     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.FloorBitmask)
     event = CollisionHandlerEvent()
     event.setInPattern('%fn-into')
     event.setOutPattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
Exemplo n.º 13
0
 def release(self):
     TrapGag.release(self)
     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()
     else:
         if self.trapMode == 1:
             self.startEntity()
Exemplo n.º 14
0
 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.º 15
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()
Exemplo n.º 16
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.º 17
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.º 18
0
 def release(self):
     TrapGag.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.gag.wrtReparentTo(render)
     self.gag.setHpr(throwPath.getHpr(render))
     self.setHandJoint()
     self.track = ProjectileInterval(self.gag, startPos=self.handJoint.getPos(render), endPos=throwPath.getPos(render), gravityMult=0.9, duration=3)
     self.track.start()
     if base.localAvatar == self.avatar:
         self.buildCollisions()
         self.avatar.acceptOnce('gagSensor-into', self.onCollision)
     self.reset()
    def __init__(self,
                 name,
                 model,
                 damage,
                 hitSfx,
                 idleSfx=None,
                 particlesFx=None,
                 anim=None,
                 wantParticles=True):
        TrapGag.__init__(self, name, model, damage, hitSfx, anim)
        self.wantParticles = wantParticles
        self.particles = None
        self.particlesFx = particlesFx
        self.idleSfx = None
        self.timeout = 5.0

        if game.process == 'client':
            if idleSfx:
                self.idleSfx = base.audio3d.loadSfx(idleSfx)
Exemplo n.º 20
0
    def __init__(self,
                 name,
                 model,
                 damage,
                 hitSfx,
                 collRadius,
                 mode=0,
                 anim=None,
                 autoRelease=True,
                 activateSfx=None):
        TrapGag.__init__(self,
                         name,
                         model,
                         damage,
                         hitSfx,
                         anim,
                         doesAutoRelease=autoRelease)
        LocationGag.__init__(self, 10, 50, shadowScale=0.25)

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

        # 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

        # This is the radius of the CollisionSphere that detects suits.
        self.collRadius = collRadius

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

        self.entityTrack = None

        if game.process == 'client':
            if activateSfx:
                self.activateSfx = base.audio3d.loadSfx(activateSfx)
Exemplo n.º 21
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):
     TrapGag.build(self)
     self.buildParticles()
     self.setHandJoint()
Exemplo n.º 24
0
 def unEquip(self):
     TrapGag.unEquip(self)
     self.cleanupParticles()
 def unEquip(self):
     TrapGag.unEquip(self)
     self.cleanupParticles()
 def delete(self):
     TrapGag.delete(self)
     self.cleanupParticles()
Exemplo n.º 27
0
 def unEquip(self):
     TrapGag.unEquip(self)
     LocationGag.cleanupLocationSeeker(self)
Exemplo n.º 28
0
 def build(self):
     TrapGag.build(self)
     self.buildParticles()
     self.setHandJoint()
Exemplo n.º 29
0
 def unEquip(self):
     TrapGag.unEquip(self)
     LocationGag.cleanupLocationSeeker(self)
Exemplo n.º 30
0
 def equip(self):
     TrapGag.equip(self)
Exemplo n.º 31
0
 def delete(self):
     TrapGag.delete(self)
     self.cleanupParticles()