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 __init__(self): SquirtGag.__init__(self) LocationGag.__init__(self, 10, 50) LocationGag.setShadowData(self, isCircle=True, shadowScale=0.75) self.setImage('phase_3.5/maps/storm-cloud.png') self.entities = [] self.searchRadius = 6 self.timeout = 3.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)
def release(self): LocationGag.release(self) if self.isLocal(): self.startTimeout() actorTrack = LocationGag.getActorTrack(self) LocationGag.getSoundTrack(self).start() if actorTrack: if self.isLocal(): actorTrack.append(Func(self.considerSquirt)) actorTrack.start() if self.isLocal(): base.localAvatar.sendUpdate('usedGag', [self.id])
def precacheStuff(self): from src.coginvasion.toon import ToonGlobals ToonGlobals.precacheToons() self.cl_attackMgr.precache() from src.coginvasion.gags.LocationSeeker import LocationSeeker LocationSeeker.precache() from src.coginvasion.gags.LocationGag import LocationGag LocationGag.precache() from src.coginvasion.hood.DistributedBuilding import DistributedBuilding DistributedBuilding.precache() from src.coginvasion.cog import SuitBank SuitBank.precacheSuits()
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 getClosestCog(self, radius=6): loc = LocationGag.getLocation(self) for cog in base.cr.doId2do.values(): if cog.__class__.__name__ in CIGlobals.SuitClasses: if cog.getPlace() == base.localAvatar.zoneId: distance = (cog.getPos(render) - loc).length() if distance <= radius: return cog
def unEquip(self): TrapGag.unEquip(self) LocationGag.cleanupLocationSeeker(self)
def setEndPos(self, x, y, z): LocationGag.setDropLoc(self, x, y, z + 0.25)
def completeTrap(self): LocationGag.complete(self) self.reset()
def unEquip(self): LocationGag.cleanupLocationSeeker(self) SquirtGag.unEquip(self) self.completeSquirt()
def completeSquirt(self): if metadata.PROCESS == 'client': LocationGag.complete(self) self.reset()
def start(self): SquirtGag.start(self) LocationGag.start(self, self.avatar)