From badea7d47e1b8e38ffb7fb6f2e0b502834abfcc2 Mon Sep 17 00:00:00 2001 From: John Cote Date: Sun, 17 May 2015 22:46:24 -0400 Subject: [PATCH] These need some more work --- config/general.prc | 1 + toontown/battle/BattleCalculatorAI.py | 5 +- toontown/battle/DistributedBattle.py | 37 ++- toontown/battle/DistributedBattleBase.py | 39 +-- toontown/battle/Movie.py | 3 +- toontown/building/DistributedBuilding.py | 48 ++-- toontown/hood/GenericAnimatedProp.py | 14 +- toontown/hood/HydrantInteractiveProp.py | 292 +++++++++++++++++------ toontown/hood/InteractiveAnimatedProp.py | 110 ++++++--- toontown/hood/MailboxInteractiveProp.py | 271 +++++++++++++++------ toontown/hood/TrashcanInteractiveProp.py | 264 +++++++++++++++----- toontown/safezone/SafeZoneLoader.py | 16 ++ toontown/suit/DistributedSuitBase.py | 4 +- toontown/toon/InventoryNew.py | 5 +- toontown/toonbase/ToontownGlobals.py | 3 + toontown/town/TownLoader.py | 67 ++++-- 16 files changed, 858 insertions(+), 321 deletions(-) diff --git a/config/general.prc b/config/general.prc index 681f0c00..353ea380 100644 --- a/config/general.prc +++ b/config/general.prc @@ -106,6 +106,7 @@ want-mat-all-tailors #t want-talkative-tyler #f estate-day-night #t want-language-selection #t +active-holidays 64, 65, 66 # Developer options: want-dev #f diff --git a/toontown/battle/BattleCalculatorAI.py b/toontown/battle/BattleCalculatorAI.py index f967c851..55964e51 100644 --- a/toontown/battle/BattleCalculatorAI.py +++ b/toontown/battle/BattleCalculatorAI.py @@ -260,7 +260,10 @@ class BattleCalculatorAI: return def __checkPropBonus(self, track): - return self.battle.getInteractivePropTrackBonus() == track + result = False + if self.battle.getInteractivePropTrackBonus() == track: + result = True + return result def __targetDefense(self, suit, atkTrack): if atkTrack == HEAL: diff --git a/toontown/battle/DistributedBattle.py b/toontown/battle/DistributedBattle.py index aa067c1f..6a5efed7 100644 --- a/toontown/battle/DistributedBattle.py +++ b/toontown/battle/DistributedBattle.py @@ -39,6 +39,25 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.ignore(self.PlayGameSetPlaceEvent) self.removeCollisionData() + def setInteractivePropTrackBonus(self, trackBonus): + DistributedBattleBase.DistributedBattleBase.setInteractivePropTrackBonus(self, trackBonus) + if self.interactivePropTrackBonus >= 0: + if base.cr.playGame.hood: + self.calcInteractiveProp() + else: + self.acceptOnce(self.PlayGameSetPlaceEvent, self.calcInteractiveProp) + + def calcInteractiveProp(self): + if base.cr.playGame.hood: + loader = base.cr.playGame.hood.loader + if hasattr(loader, 'getInteractiveProp'): + self.interactiveProp = loader.getInteractiveProp(self.zoneId) + self.notify.debug('self.interactiveProp = %s' % self.interactiveProp) + else: + self.notify.warning('no loader.getInteractiveProp self.interactiveProp is None') + else: + self.notify.warning('no hood self.interactiveProp is None') + def setMembers(self, suits, suitsJoining, suitsPending, suitsActive, suitsLured, suitTraps, toons, toonsJoining, toonsPending, toonsActive, toonsRunning, timestamp): if self.battleCleanedUp(): return @@ -133,10 +152,8 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): if len(self.toons) > 0 and base.localAvatar == self.toons[0]: Emote.globalEmote.disableAll(self.toons[0], 'dbattle, enterFaceOff') self.__faceOff(ts, self.faceOffName, self.__handleFaceOffDone) - prop = self.getInteractiveProp() - - if prop: - prop.gotoBattleCheer() + if self.interactiveProp: + self.interactiveProp.gotoFaceoff() def __handleFaceOffDone(self): self.notify.debug('FaceOff done') @@ -164,10 +181,8 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): toon.startSmooth() self.accept('resumeAfterReward', self.handleResumeAfterReward) - prop = self.getInteractiveProp() - - if prop: - prop.gotoVictory() + if self.interactiveProp: + self.interactiveProp.gotoVictory() self.playReward(ts) def playReward(self, ts): @@ -195,10 +210,8 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.notify.debug('enterResume()') if self.hasLocalToon(): self.removeLocalToon() - prop = self.getInteractiveProp() - - if prop: - prop.requestIdleOrSad() + if self.interactiveProp: + self.interactiveProp.requestIdleOrSad() def exitResume(self): pass diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 2b0713c6..51b6c89a 100644 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -318,25 +318,11 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): def setBattleCellId(self, battleCellId): pass - def getInteractiveProp(self): - if config.GetBool('want-anim-props', True): - if self.interactiveProp: - return self.interactiveProp - elif base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'loader'): - loader = base.cr.playGame.hood.loader - - if hasattr(loader, 'getInteractiveProp'): - self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.zoneId) - - return self.interactiveProp - return None - else: - return None + def setInteractivePropTrackBonus(self, trackBonus): + self.interactivePropTrackBonus = trackBonus def getInteractivePropTrackBonus(self): - prop = self.getInteractiveProp() - - return prop.BattleTrack if prop else -1 + return self.interactivePropTrackBonus def setPosition(self, x, y, z): self.notify.debug('setPosition() - %d %d %d' % (x, y, z)) @@ -377,17 +363,12 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): oldsuits = self.suits self.suits = [] suitGone = 0 - prop = self.getInteractiveProp() - for s in suits: if s in self.cr.doId2do: suit = self.cr.doId2do[s] suit.setState('Battle') self.suits.append(suit) - - if prop: - suit.interactivePropTrackBonus = prop.BattleTrack - + suit.interactivePropTrackBonus = self.interactivePropTrackBonus try: suit.battleTrap except: @@ -1067,10 +1048,9 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): return Task.done def enterWaitForInput(self, ts = 0): - prop = self.getInteractiveProp() - - if prop: - prop.gotoBattleCheer() + self.notify.debug('enterWaitForInput()') + if self.interactiveProp: + self.interactiveProp.gotoBattleCheer() self.choseAttackAlready = 0 if self.localToonActive(): self.__enterLocalToonWaitForInput() @@ -1262,10 +1242,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): if base.cr.playGame.getPlace() != None: base.cr.playGame.getPlace().setState('battle', self.localToonBattleEvent) if localAvatar and hasattr(localAvatar, 'inventory') and localAvatar.inventory: - prop = self.getInteractiveProp() - - if prop: - localAvatar.inventory.setInteractivePropTrackBonus(prop.BattleTrack) + localAvatar.inventory.setInteractivePropTrackBonus(self.interactivePropTrackBonus) camera.wrtReparentTo(self) base.camLens.setMinFov(self.camFov/(4./3.)) return diff --git a/toontown/battle/Movie.py b/toontown/battle/Movie.py index 1f3b4132..c3b3245b 100644 --- a/toontown/battle/Movie.py +++ b/toontown/battle/Movie.py @@ -400,7 +400,8 @@ class Movie(DirectObject.DirectObject): if ival: track.append(ival) camTrack.append(camIval) - ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), self.battle.getInteractivePropTrackBonus() == HEAL) + hasHealBonus = self.battle.getInteractivePropTrackBonus() == HEAL + ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), hasHealBonus) if ival: track.append(ival) camTrack.append(camIval) diff --git a/toontown/building/DistributedBuilding.py b/toontown/building/DistributedBuilding.py index 79cc1358..c2e2cf00 100644 --- a/toontown/building/DistributedBuilding.py +++ b/toontown/building/DistributedBuilding.py @@ -236,11 +236,8 @@ class DistributedBuilding(DistributedObject.DistributedObject): pass def enterToon(self, ts): - prop = self.getInteractiveProp() - - if prop: - prop.buildingLiberated(self.doId) - + if self.getInteractiveProp(): + self.getInteractiveProp().buildingLiberated(self.doId) self.setToToon() def exitToon(self): @@ -259,11 +256,7 @@ class DistributedBuilding(DistributedObject.DistributedObject): pass def enterSuit(self, ts): - prop = self.getInteractiveProp() - - if prop and not prop.state == 'Sad': - prop.gotoSad(self.doId) - + self.makePropSad() self.setToSuit() def exitSuit(self): @@ -928,23 +921,38 @@ class DistributedBuilding(DistributedObject.DistributedObject): self.elevatorNodePath.setPosHpr(0, 0, 0, 0, 0, 0) def getSbSearchString(self): - return 'landmarkBlocks/sb' + str(self.block) + ':*_landmark_*_DNARoot' + result = 'landmarkBlocks/sb' + str(self.block) + ':*_landmark_*_DNARoot' + return result def adjustSbNodepathScale(self, nodePath): pass def getVisZoneId(self): exteriorZoneId = base.cr.playGame.hood.dnaStore.getZoneFromBlockNumber(self.block) - return ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId) + visZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId) + return visZoneId def getInteractiveProp(self): + result = None if self.interactiveProp: - return self.interactiveProp - elif base.cr.playGame.hood: - loader = base.cr.playGame.hood.loader + result = self.interactiveProp + else: + visZoneId = self.getVisZoneId() + if base.cr.playGame.hood: + loader = base.cr.playGame.hood.loader + if hasattr(loader, 'getInteractiveProp'): + self.interactiveProp = loader.getInteractiveProp(visZoneId) + result = self.interactiveProp + self.notify.debug('self.interactiveProp = %s' % self.interactiveProp) + else: + self.notify.warning('no loader.getInteractiveProp self.interactiveProp is None') + else: + self.notify.warning('no hood self.interactiveProp is None') + return result - if hasattr(loader, 'getInteractiveProp'): - self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.getVisZoneId()) - - return self.interactiveProp - return None + def makePropSad(self): + self.notify.debug('makePropSad') + if self.getInteractiveProp(): + if self.getInteractiveProp().state == 'Sad': + pass + self.getInteractiveProp().gotoSad(self.doId) diff --git a/toontown/hood/GenericAnimatedProp.py b/toontown/hood/GenericAnimatedProp.py index d439b675..c8f68d69 100644 --- a/toontown/hood/GenericAnimatedProp.py +++ b/toontown/hood/GenericAnimatedProp.py @@ -46,7 +46,19 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): def enter(self): self.node.postFlatten() AnimatedProp.AnimatedProp.enter(self) - self.node.loop('anim') + doAnimLoop = True + try: + if type(self).__name__ == 'instance': + if self.__class__.__name__ == 'GenericAnimatedProp': + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HYDRANTS_BUFF_BATTLES): + doAnimLoop = True + else: + doAnimLoop = False + except: + pass + + if doAnimLoop: + self.node.loop('anim') def exit(self): AnimatedProp.AnimatedProp.exit(self) diff --git a/toontown/hood/HydrantInteractiveProp.py b/toontown/hood/HydrantInteractiveProp.py index 15463bce..7ce722b9 100644 --- a/toontown/hood/HydrantInteractiveProp.py +++ b/toontown/hood/HydrantInteractiveProp.py @@ -2,94 +2,235 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import Sequence, Func from toontown.hood import InteractiveAnimatedProp +from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('HydrantInteractiveProp') - BattleTrack = ToontownBattleGlobals.SQUIRT_TRACK - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] - - ZoneToIdles = { - ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0', 3, 10, 'tt_a_ara_dga_hydrant_idle0settle', 3, 10), - ('tt_a_ara_dga_hydrant_idleLook1', 1, 1, None, 3, 10), - ('tt_a_ara_dga_hydrant_idleSneeze2', 1, 1, None, 3, 10), - ('tt_a_ara_dga_hydrant_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0', 3, 10, 'tt_a_ara_mml_hydrant_idle0settle', 3, 10), - ('tt_a_ara_mml_hydrant_idle2', 3, 10, 'tt_a_ara_mml_hydrant_idle2settle', 3, 10), - ('tt_a_ara_mml_hydrant_idle1', 3, 10, 'tt_a_ara_mml_hydrant_idle1settle', 3, 10), - ('tt_a_ara_mml_hydrant_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_hydrant_idleRubNose0', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_hydrant_idleSneeze2', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_hydrant_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0', 3, 10, None, 0, 0), - ('tt_a_ara_ddl_hydrant_idle1', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_hydrant_idle2', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_hydrant_idleAwesome3', 1, 1, None, 0, 0))} - - ZoneToIdleIntoFightAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_idleIntoFight'} - - ZoneToVictoryAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_victoryDance'} - - ZoneToSadAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_fightSad'} - - ZoneToFightAnims = { - ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_hydrant_fightBoost', 'tt_a_ara_dga_hydrant_fightCheer', 'tt_a_ara_dga_hydrant_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_hydrant_fightBoost', 'tt_a_ara_mml_hydrant_fightCheer', 'tt_a_ara_mml_hydrant_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_hydrant_fightBoost', 'tt_a_ara_tbr_hydrant_fightCheer', 'tt_a_ara_tbr_hydrant_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_hydrant_fightBoost', 'tt_a_ara_ddl_hydrant_fightCheer', 'tt_a_ara_ddl_hydrant_fightIdle')} - + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.SQUIRT_TRACK] + ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_hydrant_idle0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idle1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0', + 3, + 10, + 'tt_a_ara_dga_hydrant_idle0settle', + 3, + 10), + ('tt_a_ara_dga_hydrant_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_hydrant_idleSneeze2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0', + 3, + 10, + 'tt_a_ara_mml_hydrant_idle0settle', + 3, + 10), + ('tt_a_ara_mml_hydrant_idle2', + 3, + 10, + 'tt_a_ara_mml_hydrant_idle2settle', + 3, + 10), + ('tt_a_ara_mml_hydrant_idle1', + 3, + 10, + 'tt_a_ara_mml_hydrant_idle1settle', + 3, + 10), + ('tt_a_ara_mml_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_hydrant_idleRubNose0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_hydrant_idleSneeze2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_hydrant_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0', + 3, + 10, + None, + 0, + 0), + ('tt_a_ara_ddl_hydrant_idle1', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_hydrant_idle2', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_hydrant_idleAwesome3', + 1, + 1, + None, + 0, + 0))} + ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ddl_hydrant_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_idleIntoFight'} + ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_hydrant_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_victoryDance'} + ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_hydrant_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_fightSad'} + ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), + ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_hydrant_fightBoost', 'tt_a_ara_dga_hydrant_fightCheer', 'tt_a_ara_dga_hydrant_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_hydrant_fightBoost', 'tt_a_ara_mml_hydrant_fightCheer', 'tt_a_ara_mml_hydrant_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_hydrant_fightBoost', 'tt_a_ara_tbr_hydrant_fightCheer', 'tt_a_ara_tbr_hydrant_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_hydrant_fightBoost', 'tt_a_ara_ddl_hydrant_fightCheer', 'tt_a_ara_ddl_hydrant_fightIdle')} IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): self.leftWater = None self.rightWater = None - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.HYDRANTS_BUFF_BATTLES) + return def setupActor(self, node): InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node) - if not self.hoodId == ToontownGlobals.TheBrrrgh: water = loader.loadModel('phase_5/models/char/tt_m_efx_hydrantSquirt') self.leftWater = water.find('**/efx_hydrantSquirtLeft') self.rightWater = water.find('**/efx_hydrantSquirtRight') - + dx_left_water = self.node.find('**/dx_left_water') if self.leftWater: - self.leftWater.reparentTo(self.node.find('**/dx_left_water')) + self.leftWater.reparentTo(dx_left_water) base.leftWater = self.leftWater self.leftWater.hide() - + else: + self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId)) + dx_right_water = self.node.find('**/dx_right_water') if self.rightWater: - self.rightWater.reparentTo(self.node.find('**/dx_right_water')) + self.rightWater.reparentTo(dx_right_water) self.rightWater.hide() + else: + self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId)) def hideWater(self): if self.leftWater: @@ -104,15 +245,20 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): self.rightWater.show() def hasOverrideIval(self, origAnimName): - return ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh + result = False + if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh: + result = True + return result def getOverrideIval(self, origAnimName): result = Sequence() - - if self.hasOverrideIval(origAnimName): + if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh: result.append(Func(self.showWater)) - anim = self.createAnimIval('fight0' if 'fightBoost' in origAnimName else 'fight1') - result.append(anim) + if 'fightBoost' in origAnimName: + animKey = 'fight0' + else: + animKey = 'fight1' + animAndSound = self.createAnimAndSoundIval(animKey) + result.append(animAndSound) result.append(Func(self.hideWater)) - return result diff --git a/toontown/hood/InteractiveAnimatedProp.py b/toontown/hood/InteractiveAnimatedProp.py index 18123b11..af0b93a5 100644 --- a/toontown/hood/InteractiveAnimatedProp.py +++ b/toontown/hood/InteractiveAnimatedProp.py @@ -2,7 +2,7 @@ import math import random import GenericAnimatedProp from direct.actor import Actor -from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, Parallel +from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, SoundInterval, Parallel from direct.fsm import FSM from direct.showbase.PythonUtil import weightedChoice from pandac.PandaModules import TextNode, Vec3 @@ -30,8 +30,9 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): HpTextGenerator = TextNode('HpTextGenerator') BattleCheerText = '+' - def __init__(self, node): + def __init__(self, node, holidayId = -1): FSM.FSM.__init__(self, 'InteractiveProp-%s' % str(node)) + self.holidayId = holidayId self.numIdles = 0 self.numFightAnims = 0 self.idleInterval = None @@ -44,9 +45,11 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.okToStartNextAnim = False cellIndexStr = node.getTag('DNACellIndex') self.cellIndex = ord(cellIndexStr) + self.origAnimNameToSound = {} self.lastPlayingAnimPhase = 0 self.buildingsMakingMeSad = set() GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) + return def delete(self): self.exit() @@ -55,6 +58,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.battleCheerInterval = None self.sadInterval = None self.victoryInterval = None + return def getCellIndex(self): return self.cellIndex @@ -110,6 +114,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.battleCheerInterval = self.createBattleCheerInterval() self.victoryInterval = self.createVictoryInterval() self.sadInterval = self.createSadInterval() + return def createIdleInterval(self): result = Sequence() @@ -154,14 +159,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = Sequence() for i in xrange(self.numFightAnims): animKey = 'fight%d' % i - animIval = self.createAnimIval(animKey) + animAndSoundIval = self.createAnimAndSoundIval(animKey) origAnimName = self.node.getAnimFilename(animKey).split('/')[-1] if self.hasOverrideIval(origAnimName): result.append(self.getOverrideIval(origAnimName)) elif self.hasSpecialIval(origAnimName): - result.append(Parallel(animIval, self.getSpecialIval(origAnimName))) + result.append(Parallel(animAndSoundIval, self.getSpecialIval(origAnimName))) else: - result.append(animIval) + result.append(animAndSoundIval) self.createBattleCheerText() battleCheerTextIval = Sequence(Func(self.hpText.show), self.hpText.posInterval(duration=4.0, pos=Vec3(0, 0, 7), startPos=(0, 0, 3)), Func(self.hpText.hide)) @@ -171,7 +176,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createSadInterval(self): result = Sequence() if self.hoodId in self.ZoneToSadAnims: - result = self.createAnimIval('sad') + result = self.createAnimAndSoundIval('sad') return result def hasSpecialIval(self, origAnimName): @@ -189,17 +194,26 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createVictoryInterval(self): result = Sequence() if self.hoodId in self.ZoneToVictoryAnims: - animIval = self.createAnimIval('victory') - result.append(animIval) + animAndSoundIval = self.createAnimAndSoundIval('victory') + result.append(animAndSoundIval) return result def enter(self): GenericAnimatedProp.GenericAnimatedProp.enter(self) if base.config.GetBool('props-buff-battles', True): self.notify.debug('props buff battles is true') - self.node.stop() - self.node.pose('idle0', 0) - self.idleInterval.loop() + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.notify.debug('holiday is running, doing idle interval') + self.node.stop() + self.node.pose('idle0', 0) + if base.config.GetBool('interactive-prop-random-idles', 1): + self.requestIdleOrSad() + else: + self.idleInterval.loop() + else: + self.notify.debug('holiday is NOT running, doing nothing') + self.node.stop() + self.node.pose('idle0', 0) else: self.notify.debug('props do not buff battles') self.node.stop() @@ -274,6 +288,8 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): whichAnim = self.chooseIdleAnimToRun() if self.visId == localAvatar.zoneId: self.notify.debug('whichAnim=%s' % whichAnim) + if __dev__: + self.notify.info('whichAnim=%s %s' % (whichAnim, self.getOrigIdleAnimName(whichAnim))) self.lastPlayingAnimPhase = whichAnim self.curIval = self.createIdleAnimSequence(whichAnim) self.notify.debug('starting curIval of length %s' % self.curIval.getDuration()) @@ -283,25 +299,28 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim) return - def createIdleAnimInterval(self, whichIdleAnim, startingTime = 0): + def createIdleAnimAndSoundInterval(self, whichIdleAnim, startingTime = 0): animIval = self.node.actorInterval('idle%d' % whichIdleAnim, startTime=startingTime) animIvalDuration = animIval.getDuration() origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim] if isinstance(origAnimName, tuple): origAnimName = origAnimName[0] + soundIval = self.createSoundInterval(origAnimName, animIvalDuration) + soundIvalDuration = soundIval.getDuration() if self.hasSpecialIval(origAnimName): specialIval = self.getSpecialIval(origAnimName) - return Parallel(animIval, specialIval) + idleAnimAndSound = Parallel(animIval, soundIval, specialIval) else: - return animIval + idleAnimAndSound = Parallel(animIval, soundIval) + return idleAnimAndSound def createIdleAnimSequence(self, whichIdleAnim): dummyResult = Sequence(Wait(self.IdlePauseTime)) if not hasattr(self, 'node') or not self.node: self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node')) return dummyResult - idleAnim = self.createIdleAnimInterval(whichIdleAnim) - result = Sequence(idleAnim, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim)) + idleAnimAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim) + result = Sequence(idleAnimAndSound, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim)) if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 2: info = self.ZoneToIdles[self.hoodId][whichIdleAnim] origAnimName = info[0] @@ -314,7 +333,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): pauseTime = random.randrange(minPauseTime, maxPauseTime + 1) result = Sequence() for i in xrange(numberOfLoops): - result.append(idleAnim) + result.append(idleAnimAndSound) if self.getSettleName(whichIdleAnim): result.append(self.node.actorInterval('settle%d' % whichIdleAnim)) @@ -324,24 +343,39 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def gotoFaceoff(self): self.notify.debugStateCall(self) - self.request('Faceoff') + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.request('Faceoff') + else: + self.notify.debug('not going to faceoff because holiday %d is not running' % self.holidayId) def gotoBattleCheer(self): self.notify.debugStateCall(self) - self.request('BattleCheer') + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.request('BattleCheer') + else: + self.notify.debug('not going to battleCheer because holiday %d is not running' % self.holidayId) def gotoIdle(self): self.notify.debugStateCall(self) - self.request('DoIdleAnim') + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.request('DoIdleAnim') + else: + self.notify.debug('not going to idle because holiday %d is not running' % self.holidayId) def gotoVictory(self): self.notify.debugStateCall(self) - self.request('Victory') + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.request('Victory') + else: + self.notify.debug('not going to victory because holiday %d is not running' % self.holidayId) def gotoSad(self, buildingDoId): self.notify.debugStateCall(self) self.buildingsMakingMeSad.add(buildingDoId) - self.request('Sad') + if base.cr.newsManager.isHolidayRunning(self.holidayId): + self.request('Sad') + else: + self.notify.debug('not going to sad because holiday %d is not running' % self.holidayId) def buildingLiberated(self, buildingDoId): self.buildingsMakingMeSad.discard(buildingDoId) @@ -357,6 +391,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.notify.debugStateCall(self) self.curIval.pause() self.curIval = None + return def calcWhichIdleAnim(self, animName): result = 0 @@ -377,9 +412,9 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = Sequence() if self.lastIdleAnimName: whichIdleAnim = self.calcWhichIdleAnim(self.lastIdleAnimName) - anim = self.createIdleAnimInterval(whichIdleAnim, self.lastIdleTime) - result.append(anim) - idleIntoFightIval = self.createAnimIval('idleIntoFight') + animAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim, self.lastIdleTime) + result.append(animAndSound) + idleIntoFightIval = self.createAnimAndSoundIval('idleIntoFight') result.append(idleIntoFightIval) result.append(Func(self.gotoBattleCheer)) return result @@ -437,18 +472,37 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = self.ZoneToIdles[self.hoodId][whichIdleAnim] return result - def createAnimIval(self, animKey): + def createAnimAndSoundIval(self, animKey): animIval = self.node.actorInterval(animKey) animIvalDuration = animIval.getDuration() origAnimName = self.node.getAnimFilename(animKey) + soundIval = self.createSoundInterval(origAnimName, animIvalDuration) + soundIvalDuration = soundIval.getDuration() + printFunc = Func(self.printAnimIfClose, animKey) if self.hasSpecialIval(origAnimName): specialIval = self.getSpecialIval(origAnimName) - return Parallel(animIval, specialIval) + idleAnimAndSound = Parallel(animIval, soundIval, specialIval) + if base.config.GetBool('interactive-prop-info', False): + idleAnimAndSound.append(printFunc) else: - return animIval + idleAnimAndSound = Parallel(animIval, soundIval) + if base.config.GetBool('interactive-prop-info', False): + idleAnimAndSound.append(printFunc) + return idleAnimAndSound + + def printAnimIfClose(self, animKey): + if base.config.GetBool('interactive-prop-info', False): + try: + animName = self.node.getAnimFilename(animKey) + baseAnimName = animName.split('/')[-1] + if localAvatar.zoneId == self.visId: + self.notify.info('playing %s' % baseAnimName) + except Exception, e: + self.notify.warning('Unknown error in printAnimIfClose, giving up:\n%s' % str(e)) def clearCurIval(self): if self.curIval: self.curIval.finish() clearPythonIvals(self.curIval) self.curIval = None + return diff --git a/toontown/hood/MailboxInteractiveProp.py b/toontown/hood/MailboxInteractiveProp.py index fa2a315f..da13ea7f 100644 --- a/toontown/hood/MailboxInteractiveProp.py +++ b/toontown/hood/MailboxInteractiveProp.py @@ -2,92 +2,229 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import Sequence, Func from toontown.hood import InteractiveAnimatedProp +from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('MailboxInteractiveProp') - BattleTrack = ToontownBattleGlobals.THROW_TRACK - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] - - ZoneToIdles = { - ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0', 3, 10, 'tt_a_ara_ttc_mailbox_idle0settle', 3, 10), - ('tt_a_ara_ttc_mailbox_idleTake2', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_mailbox_idleLook1', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_mailbox_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0', 3, 10, 'tt_a_ara_dod_mailbox_idle0settle', 3, 10), - ('tt_a_ara_dod_mailbox_idle2', 1, 1, None, 3, 10), - ('tt_a_ara_dod_mailbox_idle1', 1, 1, None, 3, 10), - ('tt_a_ara_dod_mailbox_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0', 3, 10, 'tt_a_ara_dga_mailbox_idle0settle', 3, 10), - ('tt_a_ara_dga_mailbox_idleTake1', 1, 1, None, 3, 10), - ('tt_a_ara_dga_mailbox_idleLook2', 1, 1, None, 3, 10), - ('tt_a_ara_dga_mailbox_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0', 3, 10, 'tt_a_ara_mml_mailbox_idle0settle', 3, 10), - ('tt_a_ara_mml_mailbox_idleTake1', 1, 1, None, 3, 10), - ('tt_a_ara_mml_mailbox_idleLook2', 1, 1, None, 3, 10), - ('tt_a_ara_mml_mailbox_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_mailbox_idleSneeze2', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_mailbox_idleSpin0', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_mailbox_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0', 3, 10, None, 0, 0), - ('tt_a_ara_ddl_mailbox_idleShake2', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_mailbox_idleSnore1', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_mailbox_idleAwesome3', 1, 1, None, 0, 0))} - - ZoneToIdleIntoFightAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_idleIntoFight'} - - ZoneToVictoryAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_victoryDance'} - - ZoneToSadAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_fightSad'} - - ZoneToFightAnims = { - ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_mailbox_fightBoost', 'tt_a_ara_dod_mailbox_fightCheer', 'tt_a_ara_dod_mailbox_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_mailbox_fightBoost', 'tt_a_ara_dga_mailbox_fightCheer', 'tt_a_ara_dga_mailbox_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_mailbox_fightBoost', 'tt_a_ara_mml_mailbox_fightCheer', 'tt_a_ara_mml_mailbox_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_mailbox_fightBoost', 'tt_a_ara_tbr_mailbox_fightCheer', 'tt_a_ara_tbr_mailbox_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_mailbox_fightBoost', 'tt_a_ara_ddl_mailbox_fightCheer', 'tt_a_ara_ddl_mailbox_fightIdle')} - + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.THROW_TRACK] + ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0', + 3, + 10, + 'tt_a_ara_ttc_mailbox_idle0settle', + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleTake2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_mailbox_idle0', + 3, + 10, + 'tt_a_ara_ttc_mailbox_idle0settle', + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleTake2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0', + 3, + 10, + 'tt_a_ara_dod_mailbox_idle0settle', + 3, + 10), + ('tt_a_ara_dod_mailbox_idle2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dod_mailbox_idle1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dod_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0', + 3, + 10, + 'tt_a_ara_dga_mailbox_idle0settle', + 3, + 10), + ('tt_a_ara_dga_mailbox_idleTake1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_mailbox_idleLook2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0', + 3, + 10, + 'tt_a_ara_mml_mailbox_idle0settle', + 3, + 10), + ('tt_a_ara_mml_mailbox_idleTake1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_mml_mailbox_idleLook2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_mml_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_mailbox_idleSneeze2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_mailbox_idleSpin0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_mailbox_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0', + 3, + 10, + None, + 0, + 0), + ('tt_a_ara_ddl_mailbox_idleShake2', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_mailbox_idleSnore1', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_mailbox_idleAwesome3', + 1, + 1, + None, + 0, + 0))} + ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_idleIntoFight'} + ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_victoryDance'} + ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_fightSad'} + ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'), + ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_mailbox_fightBoost', 'tt_a_ara_dod_mailbox_fightCheer', 'tt_a_ara_dod_mailbox_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_mailbox_fightBoost', 'tt_a_ara_dga_mailbox_fightCheer', 'tt_a_ara_dga_mailbox_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_mailbox_fightBoost', 'tt_a_ara_mml_mailbox_fightCheer', 'tt_a_ara_mml_mailbox_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_mailbox_fightBoost', 'tt_a_ara_tbr_mailbox_fightCheer', 'tt_a_ara_tbr_mailbox_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_mailbox_fightBoost', 'tt_a_ara_ddl_mailbox_fightCheer', 'tt_a_ara_ddl_mailbox_fightIdle')} IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.MAILBOXES_BUFF_BATTLES) def setupActor(self, node): self.pieActor = Actor.Actor('phase_5/models/char/tt_r_prp_ext_piePackage', {'fightBoost': 'phase_5/models/char/tt_a_prp_ext_piePackage_fightBoost'}) self.pieActor.reparentTo(self.node) self.pieActor.hide() - InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node) def hasSpecialIval(self, origAnimName): - return 'fightBoost' in origAnimName + result = False + if 'fightBoost' in origAnimName: + result = True + return result def getSpecialIval(self, origAnimName): result = Sequence() - - if self.hasSpecialIval(origAnimName): + if 'fightBoost' in origAnimName: result.append(Func(self.pieActor.show)) result.append(self.pieActor.actorInterval('fightBoost')) result.append(Func(self.pieActor.hide)) - return result diff --git a/toontown/hood/TrashcanInteractiveProp.py b/toontown/hood/TrashcanInteractiveProp.py index 1ac6c658..b5eee585 100644 --- a/toontown/hood/TrashcanInteractiveProp.py +++ b/toontown/hood/TrashcanInteractiveProp.py @@ -1,72 +1,212 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from toontown.hood import InteractiveAnimatedProp +from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class TrashcanInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanInteractiveProp') - BattleTrack = ToontownBattleGlobals.HEAL_TRACK - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] - - ZoneToIdles = { - ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_trashcan_idleHiccup0', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_trashcan_idleLook1', 1, 1, None, 3, 10), - ('tt_a_ara_ttc_trashcan_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2', 3, 10, 'tt_a_ara_dod_trashcan_idle0settle', 3, 10), - ('tt_a_ara_dod_trashcan_idle0', 1, 1, None, 3, 10), - ('tt_a_ara_dod_trashcan_idle1', 1, 1, None, 3, 10), - ('tt_a_ara_dod_trashcan_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2', 1, 1, None, 3, 10), - ('tt_a_ara_dga_trashcan_idleHiccup0', 1, 1, None, 3, 10), - ('tt_a_ara_dga_trashcan_idleLook1', 1, 1, None, 3, 10), - ('tt_a_ara_dga_trashcan_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0', 3, 10, 'tt_a_ara_mml_trashcan_idle0settle', 3, 10), - ('tt_a_ara_mml_trashcan_idleLook1', 1, 1, None, 3, 10), - ('tt_a_ara_mml_trashcan_idleHelicopter2', 1, 1, None, 3, 10), - ('tt_a_ara_mml_trashcan_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_trashcan_idleSneeze2', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_trashcan_idle0', 1, 1, None, 3, 10), - ('tt_a_ara_tbr_trashcan_idleAwesome3', 1, 1, None, 3, 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0', 3, 10, None, 0, 0), - ('tt_a_ara_ddl_trashcan_idleShake2', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_trashcan_idleSnore1', 1, 1, None, 0, 0), - ('tt_a_ara_ddl_trashcan_idleAwesome3', 1, 1, None, 0, 0))} - - ZoneToIdleIntoFightAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_idleIntoFight'} - - ZoneToVictoryAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_victoryDance'} - - ZoneToSadAnims = { - ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_fightSad'} - - ZoneToFightAnims = { - ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_trashcan_fightBoost', 'tt_a_ara_dod_trashcan_fightCheer', 'tt_a_ara_dod_trashcan_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_trashcan_fightBoost', 'tt_a_ara_dga_trashcan_fightCheer', 'tt_a_ara_dga_trashcan_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost', 'tt_a_ara_mml_trashcan_fightCheer0', 'tt_a_ara_mml_trashcan_fightCheer1', 'tt_a_ara_mml_trashcan_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')} - + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.HEAL_TRACK] + ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleHiccup0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_trashcan_idleTake2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleHiccup0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_ttc_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2', + 3, + 10, + 'tt_a_ara_dod_trashcan_idle0settle', + 3, + 10), + ('tt_a_ara_dod_trashcan_idle0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dod_trashcan_idle1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dod_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_trashcan_idleHiccup0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_trashcan_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_dga_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0', + 3, + 10, + 'tt_a_ara_mml_trashcan_idle0settle', + 3, + 10), + ('tt_a_ara_mml_trashcan_idleLook1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_mml_trashcan_idleHelicopter2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_mml_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_trashcan_idleSneeze2', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_trashcan_idle0', + 1, + 1, + None, + 3, + 10), + ('tt_a_ara_tbr_trashcan_idleAwesome3', + 1, + 1, + None, + 3, + 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0', + 3, + 10, + None, + 0, + 0), + ('tt_a_ara_ddl_trashcan_idleShake2', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_trashcan_idleSnore1', + 1, + 1, + None, + 0, + 0), + ('tt_a_ara_ddl_trashcan_idleAwesome3', + 1, + 1, + None, + 0, + 0))} + ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_idleIntoFight'} + ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_victoryDance'} + ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad', + ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_fightSad'} + ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'), + ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_trashcan_fightBoost', 'tt_a_ara_dod_trashcan_fightCheer', 'tt_a_ara_dod_trashcan_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_trashcan_fightBoost', 'tt_a_ara_dga_trashcan_fightCheer', 'tt_a_ara_dga_trashcan_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost', + 'tt_a_ara_mml_trashcan_fightCheer0', + 'tt_a_ara_mml_trashcan_fightCheer1', + 'tt_a_ara_mml_trashcan_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')} IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) \ No newline at end of file + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.TRASHCANS_BUFF_BATTLES) diff --git a/toontown/safezone/SafeZoneLoader.py b/toontown/safezone/SafeZoneLoader.py index ad673b46..1f63df6f 100644 --- a/toontown/safezone/SafeZoneLoader.py +++ b/toontown/safezone/SafeZoneLoader.py @@ -222,6 +222,22 @@ class SafeZoneLoader(StateData.StateData): animPropList = self.animPropDict.setdefault(i, []) animPropList.append(animPropObj) + interactivePropNodes = i.findAllMatches('**/interactive_prop_*') + numInteractivePropNodes = interactivePropNodes.getNumPaths() + for j in xrange(numInteractivePropNodes): + interactivePropNode = interactivePropNodes.getPath(j) + className = 'GenericAnimatedProp' + symbols = {} + base.cr.importModule(symbols, 'toontown.hood', [className]) + classObj = getattr(symbols[className], className) + interactivePropObj = classObj(interactivePropNode) + animPropList = self.animPropDict.get(i) + if animPropList is None: + animPropList = self.animPropDict.setdefault(i, []) + animPropList.append(interactivePropObj) + + return + def deleteAnimatedProps(self): for zoneNode, animPropList in self.animPropDict.items(): for animProp in animPropList: diff --git a/toontown/suit/DistributedSuitBase.py b/toontown/suit/DistributedSuitBase.py index 0b17b62b..186479e5 100644 --- a/toontown/suit/DistributedSuitBase.py +++ b/toontown/suit/DistributedSuitBase.py @@ -60,9 +60,7 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa self.maxSkeleRevives = 0 self.sillySurgeText = False self.interactivePropTrackBonus = -1 - - def setInteractivePropTrackBonus(self, trackBonus): - self.interactivePropTrackBonus = trackBonus + return def setVirtual(self, virtual): pass diff --git a/toontown/toon/InventoryNew.py b/toontown/toon/InventoryNew.py index 02769171..33d775b6 100644 --- a/toontown/toon/InventoryNew.py +++ b/toontown/toon/InventoryNew.py @@ -1187,7 +1187,10 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): messenger.send('exitTrackFrame', [track]) def checkPropBonus(self, track): - return track == self.interactivePropTrackBonus + result = False + if track == self.interactivePropTrackBonus: + result = True + return result def stopAndClearPropBonusIval(self): if self.propBonusIval and self.propBonusIval.isPlaying(): diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index 7cba83ed..97691b54 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -886,6 +886,9 @@ WINTER_CAROLING = 57 VALENTINES_DAY = 59 SILLYMETER_HOLIDAY = 60 SILLY_SURGE_HOLIDAY = 63 +HYDRANTS_BUFF_BATTLES = 64 +MAILBOXES_BUFF_BATTLES = 65 +TRASHCANS_BUFF_BATTLES = 66 SILLY_CHATTER_ONE = 67 SILLY_CHATTER_TWO = 68 SILLY_CHATTER_THREE = 69 diff --git a/toontown/town/TownLoader.py b/toontown/town/TownLoader.py index 0cb5a224..fcd35e5d 100644 --- a/toontown/town/TownLoader.py +++ b/toontown/town/TownLoader.py @@ -17,7 +17,8 @@ from toontown.toon.Toon import teleportDebug from toontown.battle import BattleParticles from direct.fsm import StateData from toontown.building import ToonInterior -from toontown.hood import QuietZoneState, ZoneUtil, HydrantInteractiveProp, MailboxInteractiveProp, TrashcanInteractiveProp +from toontown.hood import QuietZoneState +from toontown.hood import ZoneUtil from direct.interval.IntervalGlobal import * from toontown.dna.DNAParser import DNABulkLoader @@ -291,7 +292,6 @@ class TownLoader(StateData.StateData): def createAnimatedProps(self, nodeList): self.animPropDict = {} self.zoneIdToInteractivePropDict = {} - for i in nodeList: animPropNodes = i.findAllMatches('**/animated_prop_*') numAnimPropNodes = animPropNodes.getNumPaths() @@ -313,26 +313,50 @@ class TownLoader(StateData.StateData): animPropList.append(animPropObj) interactivePropNodes = i.findAllMatches('**/interactive_prop_*') + numInteractivePropNodes = interactivePropNodes.getNumPaths() + for j in xrange(numInteractivePropNodes): + interactivePropNode = interactivePropNodes.getPath(j) + className = 'InteractiveAnimatedProp' + if 'hydrant' in interactivePropNode.getName(): + className = 'HydrantInteractiveProp' + elif 'trashcan' in interactivePropNode.getName(): + className = 'TrashcanInteractiveProp' + elif 'mailbox' in interactivePropNode.getName(): + className = 'MailboxInteractiveProp' + symbols = {} + base.cr.importModule(symbols, 'toontown.hood', [className]) + classObj = getattr(symbols[className], className) + interactivePropObj = classObj(interactivePropNode) + animPropList = self.animPropDict.get(i) + if animPropList is None: + animPropList = self.animPropDict.setdefault(i, []) + animPropList.append(interactivePropObj) + if interactivePropObj.getCellIndex() == 0: + zoneId = int(i.getName()) + if zoneId not in self.zoneIdToInteractivePropDict: + self.zoneIdToInteractivePropDict[zoneId] = interactivePropObj + else: + self.notify.error('already have interactive prop %s in zone %s' % (self.zoneIdToInteractivePropDict, zoneId)) - for j in xrange(interactivePropNodes.getNumPaths()): - propNode = interactivePropNodes.getPath(j) - propName = propNode.getName() + animatedBuildingNodes = i.findAllMatches('**/*:animated_building_*;-h') + for np in animatedBuildingNodes: + if np.getName().startswith('sb'): + animatedBuildingNodes.removePath(np) - if 'hydrant' in propName: - prop = HydrantInteractiveProp.HydrantInteractiveProp(propNode) - elif 'trashcan' in propName: - prop = TrashcanInteractiveProp.TrashcanInteractiveProp(propNode) - elif 'mailbox' in propName: - prop = MailboxInteractiveProp.MailboxInteractiveProp(propNode) - else: - continue + numAnimatedBuildingNodes = animatedBuildingNodes.getNumPaths() + for j in xrange(numAnimatedBuildingNodes): + animatedBuildingNode = animatedBuildingNodes.getPath(j) + className = 'GenericAnimatedBuilding' + symbols = {} + base.cr.importModule(symbols, 'toontown.hood', [className]) + classObj = getattr(symbols[className], className) + animatedBuildingObj = classObj(animatedBuildingNode) + animPropList = self.animPropDict.get(i) + if animPropList is None: + animPropList = self.animPropDict.setdefault(i, []) + animPropList.append(animatedBuildingObj) - if i in self.animPropDict: - self.animPropDict[i].append(prop) - else: - self.animPropDict[i] = [prop] - - self.zoneIdToInteractivePropDict[int(i.getName())] = prop + return def deleteAnimatedProps(self): for zoneNode, animPropList in self.animPropDict.items(): @@ -350,6 +374,7 @@ class TownLoader(StateData.StateData): animProp.exit() def getInteractiveProp(self, zoneId): + result = None if zoneId in self.zoneIdToInteractivePropDict: - return self.zoneIdToInteractivePropDict[zoneId] - return None + result = self.zoneIdToInteractivePropDict[zoneId] + return result