def walkToTruck(self): if self.mg.barrelsRemaining == 0: return index = DGG.WalkToTruckIndex pos = DGG.TruckSuitPointsByIndex[self.truckIndex] startPos = self.getPos(render) self.b_setSuitState(1, -1, index) numPlayers = self.mg.getNumPlayers() durationFactor = 0.2 if numPlayers == 2: durationFactor = 0.15 elif numPlayers == 3: durationFactor = 0.1 elif numPlayers == 4: durationFactor = 0.08 pathName = self.uniqueName('WalkToTruck') self.walkTrack = NPCWalkInterval(self, pos, startPos = startPos, name = pathName, durationFactor = durationFactor, fluid = 1 ) self.walkTrack.setDoneEvent(self.walkTrack.getName()) self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedToTruck) self.walkTrack.start() self.b_setAnimState(SuitGlobals.getAnimId(SuitGlobals.getAnimByName('walk')))
def enterStunned(self, animB4Stun, ts = 0): self.show() animB4Stun = SuitGlobals.getAnimById(animB4Stun).getName() self.stunnedSound = base.loadSfxOnNode("phase_4/audio/sfx/SZ_TC_bird1.ogg", self) self.stunnedSound.setLoop(True) self.stunnedSound.play() self.stunnedIval = Parallel(Sequence(ActorInterval(self, animB4Stun), Func(self.loop, 'stunned')), SuitGlobals.createStunInterval(self, 0, 100)) self.stunnedIval.start()
def monitorHealth(self, task): if self.health <= 0: self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitNoHealth', [self.tutPartIndex]) self.tutorial.suitsKilled += 1 if self.tutorial.suitsKilled == 3: self.battleZone.battleComplete() if self.walkTrack: self.ignore(self.walkTrack.getDoneEvent()) self.walkTrack.pause() self.walkTrack = None self.b_setSuitState(0, -1, -1) currentAnim = SuitGlobals.getAnimByName(self.anim) self.clearTrack() base.taskMgr.remove(self.uniqueName('scwaa')) self.stopAttacks() if currentAnim: self.track = Sequence(Wait(currentAnim.getDeathHoldTime()), Func(self.killSuit)) self.track.start() else: self.killSuit() return Task.done return Task.cont
def load(self): Entity.load(self) entnum = self.cEntity.getEntnum() suitId = base.bspLoader.getEntityValueInt(entnum, "suitPlan") self.level = base.bspLoader.getEntityValueInt(entnum, "level") suitPlan = SuitBank.getSuitById(suitId) Suit.generate(self, suitPlan, Variant.NORMAL, Voice.NORMAL, False) classAttrs = suitPlan.getCogClassAttrs() self.maxHealth = classAttrs.baseHp self.maxHealth += SuitGlobals.calculateHP(self.level) self.maxHealth *= classAttrs.hpMod self.health = self.maxHealth if self.level == 0: self.maxHealth = 1 self.health = self.maxHealth self.reparentTo(render) origin = self.cEntity.getOrigin() angles = self.cEntity.getAngles() self.setPos(origin) self.setHpr(angles) self.cleanupPropeller() self.animFSM.request('neutral')
def doActivity(self): stunDur = self.avatar.getDuration("stun") raiseDur = self.avatar.getDuration("raise") waitDur = 10.0 - stunDur - raiseDur return Parallel(Sequence(Func(self.avatar.loopSound, "chirp"), Func(self.avatar.playSound, "stun"), ActorInterval(self.avatar, "stun"), Func(self.avatar.loop, "downNeutral"), Wait(waitDur), Func(self.avatar.stopSound, "chirp"), Func(self.avatar.playSound, "raise"), ActorInterval(self.avatar, "raise")), SuitGlobals.createStunInterval(self.avatar, 0, stunDur + waitDur, pos = (2, 0, 0), hpr = (0, 0, 90), scale = 2.5))
def walkBackToSpawnPointWithBarrel(self): pos = DGG.SpawnPoints[self.spawnPoint] startPos = self.getPos(render) self.b_setSuitState(1, -1, self.spawnPoint) numPlayers = self.mg.getNumPlayers() durationFactor = 0.2 if numPlayers == 2: durationFactor = 0.15 elif numPlayers == 3: durationFactor = 0.1 elif numPlayers == 4: durationFactor = 0.08 pathName = self.uniqueName('WalkBackToSpawn') self.walkTrack = NPCWalkInterval(self, pos, startPos = startPos, name = pathName, durationFactor = durationFactor, fluid = 1 ) self.walkTrack.setDoneEvent(self.walkTrack.getName()) self.acceptOnce(self.walkTrack.getDoneEvent(), self.__walkedBack2Spawn) self.walkTrack.start() self.b_setAnimState(SuitGlobals.getAnimId(SuitGlobals.getAnimByName('tray-walk')))
def getCogClassName(self): return SuitGlobals.getClassName(self.cls)
def getCogClassAttrs(self): return SuitGlobals.getClassAttrs(self.cls)
def doStunEffect(self): self.clearStunnedIval() self.stunnedIval = SuitGlobals.createStunInterval(self, 0, 2) self.stunnedIval.start()