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)
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
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)
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])
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)
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)
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
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
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()
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)
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()
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)
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, 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)
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)
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)
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()
def unEquip(self): TrapGag.unEquip(self) self.cleanupParticles()
def delete(self): TrapGag.delete(self) self.cleanupParticles()
def unEquip(self): TrapGag.unEquip(self) LocationGag.cleanupLocationSeeker(self)