From 3f83a25f3fe6831a19f03d5aa07941784f2c133f Mon Sep 17 00:00:00 2001 From: John Cote Date: Mon, 11 May 2015 03:12:24 -0400 Subject: [PATCH] Cleanup some code and fix Fireworks. --- toontown/ai/DistributedJorElCam.py | 4 ++-- toontown/chat/ToontownChatManager.py | 2 +- toontown/coderedemption/TTCodeRedemptionMgrAI.py | 3 +-- toontown/effects/DistributedFireworkShowAI.py | 3 +-- toontown/effects/FireworkShowMixin.py | 11 ++++------- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/toontown/ai/DistributedJorElCam.py b/toontown/ai/DistributedJorElCam.py index 748a199d..73ff9607 100644 --- a/toontown/ai/DistributedJorElCam.py +++ b/toontown/ai/DistributedJorElCam.py @@ -25,7 +25,7 @@ class DistributedJorElCam(DistributedObject): self.head.setScale(10) self.head.startBlink() self.head.startLookAround() - + pieces = [['*head*', '*muzzle*'], ['*ears*', '*nose*']] for p in pieces[0]: pc = '**/%s' % p @@ -37,7 +37,7 @@ class DistributedJorElCam(DistributedObject): for node in self.head.findAllMatches(pc): if not node.is_empty(): node.setColor(0, 0, 0, 1) - + base.cr.jorElHead = self.head def delete(self): diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index 791343a9..83ac3663 100644 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -172,4 +172,4 @@ class ToontownChatManager(ChatManager.ChatManager): self.fsm.request('mainMenu') def messageSent(self): - pass \ No newline at end of file + pass diff --git a/toontown/coderedemption/TTCodeRedemptionMgrAI.py b/toontown/coderedemption/TTCodeRedemptionMgrAI.py index 141b04c4..eae89055 100644 --- a/toontown/coderedemption/TTCodeRedemptionMgrAI.py +++ b/toontown/coderedemption/TTCodeRedemptionMgrAI.py @@ -100,14 +100,13 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI): self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [5]) print ("%s attempted to redeem code %s but it wasn't usable yet!" % (avId, code)) return - + av.redeemCode(code) self.requestCodeRedeem(avId, av, codeInfo['items']) print ('%s successfully redeemed %s' % (avId, code)) else: self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [1]) print ('%s tried to redeem non-existant code %s' % (avId, code)) - def requestCodeRedeem(self, avId, av, items): count = self.getMailboxCount(items) diff --git a/toontown/effects/DistributedFireworkShowAI.py b/toontown/effects/DistributedFireworkShowAI.py index 8523667e..7663114c 100644 --- a/toontown/effects/DistributedFireworkShowAI.py +++ b/toontown/effects/DistributedFireworkShowAI.py @@ -52,9 +52,8 @@ def fireworks(showName='july4'): return 'Invalid fireworks show name!' numShows = len(FireworkShows.shows.get(showType, [])) showIndex = random.randint(0, numShows - 1) - # TODO: Start the fireworks show in all districts. for hood in simbase.air.hoods: - if hood.safezone == ToontownGlobals.GolfZone: + if hood.zoneId == ToontownGlobals.GolfZone: continue fireworkShow = DistributedFireworkShowAI(simbase.air) fireworkShow.generateWithRequired(hood.zoneId) diff --git a/toontown/effects/FireworkShowMixin.py b/toontown/effects/FireworkShowMixin.py index 8ab116e3..c58ff482 100644 --- a/toontown/effects/FireworkShowMixin.py +++ b/toontown/effects/FireworkShowMixin.py @@ -132,6 +132,9 @@ class FireworkShowMixin: if self.fireworkShow and not self.fireworkShow.isEmpty(): self.fireworkShow.setColorScaleOff(0) return + if self.__checkHoodValidity() and hasattr(base.cr.playGame, 'hood') and base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky: + preShow = Sequence(Func(base.localAvatar.setSystemMessage, 0, startMessage), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(0.0, 0.0, 0.0, 1.0)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.25, 0.25, 0.35, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(0.85, 0.85, 0.85, 1)), Func(__lightDecorationOn__)), Func(base.setBackgroundColor, Vec4(0, 0, 0, 1)), Func(self.__checkDDFog), Func(base.camLens.setFar, 1000.0), Func(base.cr.playGame.hood.sky.hide), Func(base.localAvatar.setSystemMessage, 0, instructionMessage), Func(self.getLoader().music.stop), Wait(2.0), Func(base.playMusic, self.showMusic, 0, 1, 0.8, max(0, startT))) + return preShow return None def restoreCameraLens(self): @@ -156,13 +159,7 @@ class FireworkShowMixin: return None if self.__checkHoodValidity() and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky: - # Election Only - hood = self.getHood() - if hood.id == ToontownCentral: - postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(self.electionFloor, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(self.slappyBalloon, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) - else: - postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) - #postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) + postShow = Sequence(Func(base.cr.playGame.hood.sky.show), Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(1, 1, 1, 1)), LerpColorScaleInterval(base.localAvatar, 2.5, Vec4(1, 1, 1, 1))), Func(self.__restoreDDFog), Func(self.restoreCameraLens), Func(base.setBackgroundColor, DefaultBackgroundColor), Func(self.showMusic.stop), Func(base.localAvatar.setSystemMessage, 0, endMessage)) if self.restorePlaygroundMusic: postShow.append(Wait(2.0)) postShow.append(Func(base.playMusic, self.getLoader().music, 1, 1, 0.8))