def __init__(self, avId, game): self.avId = avId self.game = game self.isLocal = (avId == base.localAvatar.doId) self.toon = self.game.getAvatar(self.avId) # prevent crash during cleanup if this client exits during the game self._delayDelete = DelayDelete(self.toon, 'CatchGameToonSD') self.unexpectedExit = False self.fsm = ClassicFSM.ClassicFSM( 'CatchGameAnimFSM-%s' % self.avId, [ State.State('init', self.enterInit, self.exitInit, ['normal']), State.State('normal', self.enterNormal, self.exitNormal, ['eatFruit', 'fallBack', 'fallForward']), # TODO: ClassicFSM does not allow transition from a state to the # same state. Separate eatFruit into 2 states or fix ClassicFSM. State.State('eatFruit', self.enterEatFruit, self.exitEatFruit, ['normal', 'fallBack', 'fallForward', 'eatFruit']), State.State('fallBack', self.enterFallBack, self.exitFallBack, ['normal']), State.State('fallForward', self.enterFallForward, self.exitFallForward, ['normal']), State.State('cleanup', self.enterCleanup, self.exitCleanup, []), ], 'init', 'cleanup', )
def __init__(self, avId, game): self.avId = avId self.game = game self.isLocal = avId == base.localAvatar.doId self.toon = self.game.getAvatar(self.avId) self._delayDelete = DelayDelete(self.toon, 'CatchGameToonSD') self.unexpectedExit = False self.fsm = ClassicFSM.ClassicFSM('CatchGameAnimFSM-%s' % self.avId, [State.State('init', self.enterInit, self.exitInit, ['normal']), State.State('normal', self.enterNormal, self.exitNormal, ['eatFruit', 'fallBack', 'fallForward']), State.State('eatFruit', self.enterEatFruit, self.exitEatFruit, ['normal', 'fallBack', 'fallForward', 'eatFruit']), State.State('fallBack', self.enterFallBack, self.exitFallBack, ['normal']), State.State('fallForward', self.enterFallForward, self.exitFallForward, ['normal']), State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'init', 'cleanup')
class CatchGameToonSD(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('CatchGameToonSD') FallBackAnim = 'slip-backward' FallFwdAnim = 'slip-forward' CatchNeutralAnim = 'catch-neutral' CatchRunAnim = 'catch-run' EatNeutralAnim = 'catch-eatneutral' EatNRunAnim = 'catch-eatnrun' animList = [ FallBackAnim, FallFwdAnim, CatchNeutralAnim, CatchRunAnim, EatNeutralAnim, EatNRunAnim ] def __init__(self, avId, game): self.avId = avId self.game = game self.isLocal = avId == base.localAvatar.doId self.toon = self.game.getAvatar(self.avId) self._delayDelete = DelayDelete(self.toon, 'CatchGameToonSD') self.unexpectedExit = False self.fsm = ClassicFSM.ClassicFSM('CatchGameAnimFSM-%s' % self.avId, [ State.State('init', self.enterInit, self.exitInit, ['normal']), State.State('normal', self.enterNormal, self.exitNormal, ['eatFruit', 'fallBack', 'fallForward']), State.State('eatFruit', self.enterEatFruit, self.exitEatFruit, ['normal', 'fallBack', 'fallForward', 'eatFruit']), State.State('fallBack', self.enterFallBack, self.exitFallBack, ['normal']), State.State('fallForward', self.enterFallForward, self.exitFallForward, ['normal']), State.State('cleanup', self.enterCleanup, self.exitCleanup, []) ], 'init', 'cleanup') def load(self): self.setAnimState('off', 1.0) for anim in self.animList: self.toon.pose(anim, 0) def unload(self): self._delayDelete.destroy() del self.fsm def enter(self): self.fsm.enterInitialState() self._exiting = False def exit(self, unexpectedExit=False): if self._exiting: return self._exiting = True self.unexpectedExit = unexpectedExit self.fsm.requestFinalState() del self._exiting def enterInit(self): self.notify.debug('enterInit') self.toon.startBlink() self.toon.stopLookAround() if self.isLocal: self.game.initOrthoWalk() self.toon.useLOD(1000) self.dropShadow = self.toon.dropShadow self.origDropShadowColor = self.dropShadow.getColor() c = self.origDropShadowColor alpha = 0.35 self.dropShadow.setColor(c[0], c[1], c[2], alpha) def exitInit(self): pass def enterNormal(self): self.notify.debug('enterNormal') self.setAnimState('Catching', 1.0) if self.isLocal: self.game.orthoWalk.start() self.toon.lerpLookAt(Vec3.forward() + Vec3.up(), time=0.2, blink=0) def exitNormal(self): self.setAnimState('off', 1.0) if self.isLocal: self.game.orthoWalk.stop() self.toon.lerpLookAt(Vec3.forward(), time=0.2, blink=0) def eatFruit(self, fruitModel, handNode): if self.fsm.getCurrentState().getName() == 'eatFruit': self.fsm.request('normal') self.fsm.request('eatFruit', [fruitModel, handNode]) def enterEatFruit(self, fruitModel, handNode): self.notify.debug('enterEatFruit') self.setAnimState('CatchEating', 1.0) if self.isLocal: self.game.orthoWalk.start() self.fruitModel = fruitModel renderScale = fruitModel.getScale(render) fruitModel.reparentTo(handNode) fruitModel.setScale(render, renderScale) def finishedEating(self=self, fruitModel=fruitModel): self.fsm.request('normal') return Task.done duration = self.toon.getDuration('catch-eatneutral') self.eatIval = Sequence(Parallel( WaitInterval(duration), Sequence( LerpScaleInterval(fruitModel, duration / 2.0, fruitModel.getScale() * 0.5, blendType='easeInOut'), Func(fruitModel.hide))), Func(finishedEating), name=self.toon.uniqueName('eatingIval')) self.eatIval.start() def exitEatFruit(self): self.eatIval.pause() del self.eatIval self.fruitModel.reparentTo(hidden) self.fruitModel.removeNode() del self.fruitModel self.setAnimState('off', 1.0) if self.isLocal: self.game.orthoWalk.stop() def enterFallBack(self): self.notify.debug('enterFallBack') if self.isLocal: base.playSfx(self.game.sndOof) duration = 1.0 animName = self.FallBackAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = totalFrames - 1 - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self=self): self.fsm.request('normal') self.fallBackIval = Sequence( ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume)) self.fallBackIval.start() def exitFallBack(self): self.fallBackIval.pause() del self.fallBackIval def enterFallForward(self): self.notify.debug('enterFallForward') if self.isLocal: base.playSfx(self.game.sndOof) duration = 1.0 animName = self.FallFwdAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = totalFrames - 1 - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self=self): self.fsm.request('normal') self.fallFwdIval = Sequence( ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume)) self.fallFwdIval.start() def exitFallForward(self): self.fallFwdIval.pause() del self.fallFwdIval def enterCleanup(self): self.notify.debug('enterCleanup') self.toon.stopBlink() self.toon.startLookAround() if self.isLocal: self.game.orthoWalk.stop() self.game.destroyOrthoWalk() self.toon.resetLOD() self.dropShadow.setColor(self.origDropShadowColor) def exitCleanup(self): pass def setAnimState(self, newState, playRate): if not self.unexpectedExit: self.toon.setAnimState(newState, playRate)
class CatchGameToonSD(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('CatchGameToonSD') FallBackAnim = 'slip-backward' FallFwdAnim = 'slip-forward' CatchNeutralAnim = 'catch-neutral' CatchRunAnim = 'catch-run' EatNeutralAnim = 'catch-eatneutral' EatNRunAnim = 'catch-eatnrun' animList = [FallBackAnim, FallFwdAnim, CatchNeutralAnim, CatchRunAnim, EatNeutralAnim, EatNRunAnim] def __init__(self, avId, game): self.avId = avId self.game = game self.isLocal = avId == base.localAvatar.doId self.toon = self.game.getAvatar(self.avId) self._delayDelete = DelayDelete(self.toon, 'CatchGameToonSD') self.unexpectedExit = False self.fsm = ClassicFSM.ClassicFSM('CatchGameAnimFSM-%s' % self.avId, [State.State('init', self.enterInit, self.exitInit, ['normal']), State.State('normal', self.enterNormal, self.exitNormal, ['eatFruit', 'fallBack', 'fallForward']), State.State('eatFruit', self.enterEatFruit, self.exitEatFruit, ['normal', 'fallBack', 'fallForward', 'eatFruit']), State.State('fallBack', self.enterFallBack, self.exitFallBack, ['normal']), State.State('fallForward', self.enterFallForward, self.exitFallForward, ['normal']), State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'init', 'cleanup') def load(self): self.setAnimState('off', 1.0) for anim in self.animList: self.toon.pose(anim, 0) def unload(self): self._delayDelete.destroy() del self.fsm def enter(self): self.fsm.enterInitialState() self._exiting = False def exit(self, unexpectedExit = False): if self._exiting: return self._exiting = True self.unexpectedExit = unexpectedExit self.fsm.requestFinalState() del self._exiting def enterInit(self): self.notify.debug('enterInit') self.toon.startBlink() self.toon.stopLookAround() if self.isLocal: self.game.initOrthoWalk() self.toon.useLOD(1000) self.dropShadow = self.toon.dropShadow self.origDropShadowColor = self.dropShadow.getColor() c = self.origDropShadowColor alpha = 0.35 self.dropShadow.setColor(c[0], c[1], c[2], alpha) def exitInit(self): pass def enterNormal(self): self.notify.debug('enterNormal') self.setAnimState('Catching', 1.0) if self.isLocal: self.game.orthoWalk.start() self.toon.lerpLookAt(Vec3.forward() + Vec3.up(), time=0.2, blink=0) def exitNormal(self): self.setAnimState('off', 1.0) if self.isLocal: self.game.orthoWalk.stop() self.toon.lerpLookAt(Vec3.forward(), time=0.2, blink=0) def eatFruit(self, fruitModel, handNode): if self.fsm.getCurrentState().getName() == 'eatFruit': self.fsm.request('normal') self.fsm.request('eatFruit', [fruitModel, handNode]) def enterEatFruit(self, fruitModel, handNode): self.notify.debug('enterEatFruit') self.setAnimState('CatchEating', 1.0) if self.isLocal: self.game.orthoWalk.start() self.fruitModel = fruitModel renderScale = fruitModel.getScale(render) fruitModel.reparentTo(handNode) fruitModel.setScale(render, renderScale) def finishedEating(self = self, fruitModel = fruitModel): self.fsm.request('normal') return Task.done duration = self.toon.getDuration('catch-eatneutral') self.eatIval = Sequence(Parallel(WaitInterval(duration), Sequence(LerpScaleInterval(fruitModel, duration / 2.0, fruitModel.getScale() * 0.5, blendType='easeInOut'), Func(fruitModel.hide))), Func(finishedEating), name=self.toon.uniqueName('eatingIval')) self.eatIval.start() def exitEatFruit(self): self.eatIval.pause() del self.eatIval self.fruitModel.reparentTo(hidden) self.fruitModel.removeNode() del self.fruitModel self.setAnimState('off', 1.0) if self.isLocal: self.game.orthoWalk.stop() def enterFallBack(self): self.notify.debug('enterFallBack') if self.isLocal: base.playSfx(self.game.sndOof) duration = 1.0 animName = self.FallBackAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = totalFrames - 1 - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self = self): self.fsm.request('normal') self.fallBackIval = Sequence(ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume)) self.fallBackIval.start() def exitFallBack(self): self.fallBackIval.pause() del self.fallBackIval def enterFallForward(self): self.notify.debug('enterFallForward') if self.isLocal: base.playSfx(self.game.sndOof) duration = 1.0 animName = self.FallFwdAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = totalFrames - 1 - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self = self): self.fsm.request('normal') self.fallFwdIval = Sequence(ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume)) self.fallFwdIval.start() def exitFallForward(self): self.fallFwdIval.pause() del self.fallFwdIval def enterCleanup(self): self.notify.debug('enterCleanup') self.toon.stopBlink() self.toon.startLookAround() if self.isLocal: self.game.orthoWalk.stop() self.game.destroyOrthoWalk() self.toon.resetLOD() self.dropShadow.setColor(self.origDropShadowColor) def exitCleanup(self): pass def setAnimState(self, newState, playRate): if not self.unexpectedExit: self.toon.setAnimState(newState, playRate)
class CatchGameToonSD(StateData.StateData): """ CatchGameToonSD catching game char anim statedata """ notify = DirectNotifyGlobal.directNotify.newCategory("CatchGameToonSD") FallBackAnim = 'slip-backward' FallFwdAnim = 'slip-forward' CatchNeutralAnim = 'catch-neutral' CatchRunAnim = 'catch-run' EatNeutralAnim = 'catch-eatneutral' EatNRunAnim = 'catch-eatnrun' animList = [ FallBackAnim, FallFwdAnim, CatchNeutralAnim, CatchRunAnim, EatNeutralAnim, EatNRunAnim, ] def __init__(self, avId, game): self.avId = avId self.game = game self.isLocal = (avId == base.localAvatar.doId) self.toon = self.game.getAvatar(self.avId) # prevent crash during cleanup if this client exits during the game self._delayDelete = DelayDelete(self.toon, 'CatchGameToonSD') self.unexpectedExit = False self.fsm = ClassicFSM.ClassicFSM( 'CatchGameAnimFSM-%s' % self.avId, [ State.State('init', self.enterInit, self.exitInit, ['normal']), State.State('normal', self.enterNormal, self.exitNormal, ['eatFruit', 'fallBack', 'fallForward']), # TODO: ClassicFSM does not allow transition from a state to the # same state. Separate eatFruit into 2 states or fix ClassicFSM. State.State('eatFruit', self.enterEatFruit, self.exitEatFruit, ['normal', 'fallBack', 'fallForward', 'eatFruit']), State.State('fallBack', self.enterFallBack, self.exitFallBack, ['normal']), State.State('fallForward', self.enterFallForward, self.exitFallForward, ['normal']), State.State('cleanup', self.enterCleanup, self.exitCleanup, []), ], 'init', 'cleanup', ) def load(self): self.setAnimState('off', 1.) # cache the animations for anim in self.animList: self.toon.pose(anim, 0) def unload(self): self._delayDelete.destroy() del self.fsm def enter(self): self.fsm.enterInitialState() self._exiting = False def exit(self, unexpectedExit=False): # prevent re-entry if self._exiting: return self._exiting = True self.unexpectedExit = unexpectedExit self.fsm.requestFinalState() del self._exiting def enterInit(self): self.notify.debug('enterInit') self.toon.startBlink() self.toon.stopLookAround() if self.isLocal: self.game.initOrthoWalk() # force use of highest LOD self.toon.useLOD(1000) self.dropShadow = self.toon.dropShadow # fade out the drop shadow a bit self.origDropShadowColor = self.dropShadow.getColor() c = self.origDropShadowColor alpha = .35 self.dropShadow.setColor(c[0], c[1], c[2], alpha) def exitInit(self): pass def enterNormal(self): self.notify.debug('enterNormal') self.setAnimState('Catching', 1.) if self.isLocal: self.game.orthoWalk.start() self.toon.lerpLookAt(Vec3.forward() + Vec3.up(), time=.2, blink=0) def exitNormal(self): self.setAnimState('off', 1.) if self.isLocal: self.game.orthoWalk.stop() self.toon.lerpLookAt(Vec3.forward(), time=.2, blink=0) def eatFruit(self, fruitModel, handNode): """ this is a nasty little hack to work around the fact that FSMs will not exit/re-enter a state if you try to transition to the current state. """ if self.fsm.getCurrentState().getName() == 'eatFruit': self.fsm.request('normal') self.fsm.request('eatFruit', [fruitModel, handNode]) def enterEatFruit(self, fruitModel, handNode): """ fruit model is placed under handNode in this state; this function takes ownership of the fruit model """ self.notify.debug('enterEatFruit') self.setAnimState('CatchEating', 1.) if self.isLocal: self.game.orthoWalk.start() self.fruitModel = fruitModel # make sure the scale stays the same wrt render renderScale = fruitModel.getScale(render) fruitModel.reparentTo(handNode) fruitModel.setScale(render, renderScale) # transition to 'normal' after one anim cycle def finishedEating(self=self, fruitModel=fruitModel): self.fsm.request('normal') return Task.done duration = self.toon.getDuration('catch-eatneutral') self.eatIval = Sequence( Parallel( WaitInterval(duration), # toon eats the fruit halfway through animation Sequence( LerpScaleInterval(fruitModel, duration / 2., fruitModel.getScale() * .5, blendType='easeInOut'), Func(fruitModel.hide), ), ), Func(finishedEating), name=self.toon.uniqueName('eatingIval')) self.eatIval.start() def exitEatFruit(self): # if we were to 'finish' the ival, we could run into trouble with # nested 'request' calls self.eatIval.pause() del self.eatIval self.fruitModel.reparentTo(hidden) self.fruitModel.removeNode() del self.fruitModel self.setAnimState('off', 1.) if self.isLocal: self.game.orthoWalk.stop() def enterFallBack(self): self.notify.debug('enterFallBack') if self.isLocal: # play 'oof' base.playSfx(self.game.sndOof) duration = 1. animName = self.FallBackAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = (totalFrames - 1) - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self=self): self.fsm.request('normal') self.fallBackIval = Sequence( ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume), ) self.fallBackIval.start() def exitFallBack(self): # don't 'stop/finish' the stunnedIval; it will attempt to # transition to 'normal', when we're already in the process # of transitioning somewhere self.fallBackIval.pause() del self.fallBackIval def enterFallForward(self): self.notify.debug('enterFallForward') if self.isLocal: # play 'oof' base.playSfx(self.game.sndOof) duration = 1. animName = self.FallFwdAnim startFrame = 12 totalFrames = self.toon.getNumFrames(animName) frames = (totalFrames - 1) - startFrame frameRate = self.toon.getFrameRate(animName) newRate = frames / duration playRate = newRate / frameRate def resume(self=self): self.fsm.request('normal') self.fallFwdIval = Sequence( ActorInterval(self.toon, animName, startTime=startFrame / newRate, endTime=totalFrames / newRate, playRate=playRate), FunctionInterval(resume), ) self.fallFwdIval.start() def exitFallForward(self): # don't 'stop/finish' the stunnedIval; it will attempt to # transition to 'normal', when we're already in the process # of transitioning somewhere self.fallFwdIval.pause() del self.fallFwdIval def enterCleanup(self): self.notify.debug('enterCleanup') self.toon.stopBlink() self.toon.startLookAround() if self.isLocal: self.game.orthoWalk.stop() self.game.destroyOrthoWalk() # restore the LODs self.toon.resetLOD() self.dropShadow.setColor(self.origDropShadowColor) def exitCleanup(self): pass def setAnimState(self, newState, playRate): """Safe change the anim state of the toon.""" if not self.unexpectedExit: # we do this to stop an animFSM state in flux error self.toon.setAnimState(newState, playRate)
def makePrepareBattleThreeMovie(self, delayDeletes): for toonId in self.involvedToons: toon = self.cr.doId2do.get(toonId) if toon: delayDeletes.append( DelayDelete(toon, 'CashbotBoss.makePrepareBattleThreeMovie')) startPos = Point3(ToontownGlobals.CashbotBossBattleOnePosHpr[0], ToontownGlobals.CashbotBossBattleOnePosHpr[1], ToontownGlobals.CashbotBossBattleOnePosHpr[2]) battlePos = Point3(ToontownGlobals.CashbotBossBattleThreePosHpr[0], ToontownGlobals.CashbotBossBattleThreePosHpr[1], ToontownGlobals.CashbotBossBattleThreePosHpr[2]) startHpr = Point3(ToontownGlobals.CashbotBossBattleOnePosHpr[3], ToontownGlobals.CashbotBossBattleOnePosHpr[4], ToontownGlobals.CashbotBossBattleOnePosHpr[5]) battleHpr = VBase3(ToontownGlobals.CashbotBossBattleThreePosHpr[3], ToontownGlobals.CashbotBossBattleThreePosHpr[4], ToontownGlobals.CashbotBossBattleThreePosHpr[5]) finalHpr = VBase3(135, 0, 0) bossTrack = Sequence() bossTrack.append(Func(self.reparentTo, render)) bossTrack.append(Func(self.getGeomNode().setH, 180)) bossTrack.append(Func(self.pelvis.setHpr, self.pelvisForwardHpr)) bossTrack.append(Func(self.loop, 'Ff_neutral')) track, hpr = self.rollBossToPoint(startPos, startHpr, startPos, battleHpr, 0) bossTrack.append(track) track, hpr = self.rollBossToPoint(startPos, None, battlePos, None, 0) bossTrack.append(track) track, hpr = self.rollBossToPoint(battlePos, battleHpr, battlePos, finalHpr, 0) bossTrack.append(track) rToon = self.resistanceToon rToon.setPosHpr(93.935, -341.065, 0, -45, 0, 0) goon = self.fakeGoons[0] crane = self.cranes[0] track = Sequence( Func(self._DistributedCashbotBoss__hideToons), Func(crane.request, 'Movie'), Func(crane.accomodateToon, rToon), Func(goon.request, 'Stunned'), Func(goon.setPosHpr, 104, -316, 0, 165, 0, 0), Parallel(self.door2.posInterval(4.5, VBase3(0, 0, 30)), self.door3.posInterval(4.5, VBase3(0, 0, 30)), bossTrack), Func(rToon.loop, 'leverNeutral'), Func(base.camera.reparentTo, self.geom), Func(base.camera.setPosHpr, 105, -326, 5, 136.3, 0, 0), Func(rToon.setChatAbsolute, TTLocalizer.BrutalResistanceToonWatchThis, ChatGlobals.CFSpeech), Wait(2), Func(rToon.clearChat), Func(base.camera.setPosHpr, 105, -326, 20, -45.3, 11, 0), Func(self.setChatAbsolute, TTLocalizer.BrutalCashbotBossGetAwayFromThat, ChatGlobals.CFSpeech), Wait(2), Func(self.clearChat), base.camera.posHprInterval(1.5, Point3(105, -326, 5), Point3(136.3, 0, 0), blendType='easeInOut'), Func(rToon.setChatAbsolute, TTLocalizer.ResistanceToonCraneInstructions1, ChatGlobals.CFSpeech), Wait(4), Func(rToon.setChatAbsolute, TTLocalizer.ResistanceToonCraneInstructions2, ChatGlobals.CFSpeech), Wait(4), Func(rToon.setChatAbsolute, TTLocalizer.BrutalResistanceToonCraneInstructions3, ChatGlobals.CFSpeech), Wait(4), Func(rToon.setChatAbsolute, TTLocalizer.BrutalResistanceToonCraneInstructions4, ChatGlobals.CFSpeech), Wait(4), Func(rToon.clearChat), Func(base.camera.setPosHpr, 102, -323.6, 0.9, -10.6, 14, 0), Func(goon.request, 'Recovery'), Wait(2), Func(base.camera.setPosHpr, 95.4, -332.6, 4.2, 167.1, -13.2, 0), Func(rToon.setChatAbsolute, TTLocalizer.ResistanceToonGetaway, ChatGlobals.CFSpeech), Func(rToon.animFSM.request, 'jump'), Wait(1.8), Func(rToon.clearChat), Func(base.camera.setPosHpr, 109.1, -300.7, 13.9, -15.6, -13.6, 0), Func(rToon.animFSM.request, 'run'), Func(goon.request, 'Walk'), Parallel( self.door3.posInterval(3, VBase3(0, 0, 0)), rToon.posHprInterval(3, Point3(136, -212.9, 0), VBase3(-14, 0, 0), startPos=Point3(110.8, -292.7, 0), startHpr=VBase3(-14, 0, 0)), goon.posHprInterval(3, Point3(125.2, -243.5, 0), VBase3(-14, 0, 0), startPos=Point3(104.8, -309.5, 0), startHpr=VBase3(-14, 0, 0))), Func(self._DistributedCashbotBoss__hideFakeGoons), Func(crane.request, 'Free'), Func(self.getGeomNode().setH, 0), self.moveToonsToBattleThreePos(self.involvedToons), Func(self._DistributedCashbotBoss__showToons)) return Sequence(Func(base.camera.reparentTo, self), Func(base.camera.setPosHpr, 0, -27, 25, 0, -18, 0), track)
def makeIntroductionMovie(self, delayDeletes): for toonId in self.involvedToons: toon = self.cr.doId2do.get(toonId) if toon: delayDeletes.append( DelayDelete(toon, 'CashbotBoss.makeIntroductionMovie')) rtTrack = Sequence() startPos = Point3(ToontownGlobals.CashbotBossOffstagePosHpr[0], ToontownGlobals.CashbotBossOffstagePosHpr[1], ToontownGlobals.CashbotBossOffstagePosHpr[2]) battlePos = Point3(ToontownGlobals.CashbotBossBattleOnePosHpr[0], ToontownGlobals.CashbotBossBattleOnePosHpr[1], ToontownGlobals.CashbotBossBattleOnePosHpr[2]) battleHpr = VBase3(ToontownGlobals.CashbotBossBattleOnePosHpr[3], ToontownGlobals.CashbotBossBattleOnePosHpr[4], ToontownGlobals.CashbotBossBattleOnePosHpr[5]) bossTrack = Sequence() bossTrack.append(Func(self.reparentTo, render)) bossTrack.append(Func(self.getGeomNode().setH, 180)) bossTrack.append(Func(self.pelvis.setHpr, self.pelvisForwardHpr)) bossTrack.append(Func(self.loop, 'Ff_neutral')) track, hpr = self.rollBossToPoint(startPos, None, battlePos, None, 0) bossTrack.append(track) track, hpr = self.rollBossToPoint(battlePos, hpr, battlePos, battleHpr, 0) bossTrack.append(track) bossTrack.append(Func(self.getGeomNode().setH, 0)) bossTrack.append(Func(self.pelvis.setHpr, self.pelvisReversedHpr)) goonTrack = self._DistributedCashbotBoss__makeGoonMovieForIntro() attackToons = TTLocalizer.CashbotBossCogAttack rToon = self.resistanceToon rToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr) track = Sequence( Func(base.camera.setPosHpr, 82, -219, 5, 267, 0, 0), Func(rToon.setChatAbsolute, TTLocalizer.BrutalResistanceToonWelcome, ChatGlobals.CFSpeech), Wait(3), Sequence(goonTrack, duration=0), Parallel( base.camera.posHprInterval(4, Point3(108, -244, 4), VBase3(211.5, 0, 0)), Sequence( Func(rToon.suit.setPlayRate, 1.4, 'walk'), Func(rToon.suit.loop, 'walk'), Parallel(rToon.hprInterval(1, VBase3(180, 0, 0)), rToon.posInterval(3, VBase3(120, -255, 0)), Sequence(Wait(2), Func(rToon.clearChat))), Func(rToon.suit.loop, 'neutral'), self.door2.posInterval(3, VBase3(0, 0, 30)))), Func(rToon.setHpr, 0, 0, 0), Func(rToon.setChatAbsolute, TTLocalizer.ResistanceToonTooLate, ChatGlobals.CFSpeech), Func(base.camera.reparentTo, render), Func(base.camera.setPosHpr, 61.1, -228.8, 10.2, -90, 0, 0), self.door1.posInterval(2, VBase3(0, 0, 30)), Parallel( bossTrack, Sequence(Wait(3), Func(rToon.clearChat), self.door1.posInterval(3, VBase3(0, 0, 0)))), Func(self.setChatAbsolute, TTLocalizer.CashbotBossDiscoverToons1, ChatGlobals.CFSpeech), base.camera.posHprInterval(1.5, Point3(93.3, -230, 0.7), VBase3(-92.9, 39.7, 8.3)), Func(self.setChatAbsolute, TTLocalizer.BrutalCashbotBossDiscoverToons2, ChatGlobals.CFSpeech), Wait(4), Func(self.clearChat), self.loseCogSuits(self.toonsA + self.toonsB, render, (113, -228, 10, 90, 0, 0)), Wait(1), Func(rToon.setHpr, 0, 0, 0), self.loseCogSuits([rToon], render, (133, -243, 5, 143, 0, 0), True), Func(rToon.setChatAbsolute, TTLocalizer.BrutalResistanceToonKeepHimBusy, ChatGlobals.CFSpeech), Wait(1), Func(self._DistributedCashbotBoss__showResistanceToon, False), Sequence( Func(rToon.animFSM.request, 'run'), rToon.hprInterval(1, VBase3(180, 0, 0)), Parallel( Sequence( rToon.posInterval(1.5, VBase3(109, -294, 0)), Parallel(Func(rToon.animFSM.request, 'jump')), rToon.posInterval(1.5, VBase3(93.935, -341.065, 2))), self.door2.posInterval(3, VBase3(0, 0, 0))), Func(rToon.animFSM.request, 'neutral')), self.toonNormalEyes(self.involvedToons), self.toonNormalEyes([self.resistanceToon], True), Func(rToon.clearChat), Func(base.camera.setPosHpr, 93.3, -230, 0.7, -92.9, 39.7, 8.3), Func(self.setChatAbsolute, attackToons, ChatGlobals.CFSpeech), Wait(2), Func(self.clearChat)) return Sequence(Func(base.camera.reparentTo, render), track)