These need some more work

This commit is contained in:
John Cote 2015-05-17 22:46:24 -04:00
parent 76a8190ed7
commit badea7d47e
16 changed files with 858 additions and 321 deletions

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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:
result = self.interactiveProp
else:
visZoneId = self.getVisZoneId()
if base.cr.playGame.hood:
loader = base.cr.playGame.hood.loader
if hasattr(loader, 'getInteractiveProp'):
self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.getVisZoneId())
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
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)

View file

@ -46,6 +46,18 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
def enter(self):
self.node.postFlatten()
AnimatedProp.AnimatedProp.enter(self)
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):

View file

@ -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',
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',
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',
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'),
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

View file

@ -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')
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)
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)
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)
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)
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)
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

View file

@ -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',
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',
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',
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'),
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

View file

@ -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',
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',
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',
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'),
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.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)
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.TRASHCANS_BUFF_BATTLES)

View file

@ -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:

View file

@ -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

View file

@ -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():

View file

@ -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

View file

@ -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_*')
for j in xrange(interactivePropNodes.getNumPaths()):
propNode = interactivePropNodes.getPath(j)
propName = propNode.getName()
if 'hydrant' in propName:
prop = HydrantInteractiveProp.HydrantInteractiveProp(propNode)
elif 'trashcan' in propName:
prop = TrashcanInteractiveProp.TrashcanInteractiveProp(propNode)
elif 'mailbox' in propName:
prop = MailboxInteractiveProp.MailboxInteractiveProp(propNode)
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:
continue
self.notify.error('already have interactive prop %s in zone %s' % (self.zoneIdToInteractivePropDict, zoneId))
if i in self.animPropDict:
self.animPropDict[i].append(prop)
else:
self.animPropDict[i] = [prop]
animatedBuildingNodes = i.findAllMatches('**/*:animated_building_*;-h')
for np in animatedBuildingNodes:
if np.getName().startswith('sb'):
animatedBuildingNodes.removePath(np)
self.zoneIdToInteractivePropDict[int(i.getName())] = prop
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)
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