Removed hydrant sounds

This commit is contained in:
DenialMC 2015-04-10 16:34:44 +03:00
parent 41521624cf
commit 7d82aedce8
3 changed files with 27 additions and 51 deletions

View file

@ -259,7 +259,11 @@ class DistributedBuilding(DistributedObject.DistributedObject):
pass pass
def enterSuit(self, ts): def enterSuit(self, ts):
self.makePropSad() prop = self.getInteractiveProp()
if prop and not prop.state == 'Sad':
prop.gotoSad(self.doId)
self.setToSuit() self.setToSuit()
def exitSuit(self): def exitSuit(self):
@ -946,9 +950,3 @@ class DistributedBuilding(DistributedObject.DistributedObject):
return self.interactiveProp return self.interactiveProp
return None return None
def makePropSad(self):
prop = self.getInteractiveProp()
if prop and not prop.state == 'Sad':
prop.gotoSad(self.doId)

View file

@ -111,8 +111,8 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
if self.hasOverrideIval(origAnimName): if self.hasOverrideIval(origAnimName):
result.append(Func(self.showWater)) result.append(Func(self.showWater))
animAndSound = self.createAnimAndSoundIval('fight0' if 'fightBoost' in origAnimName else 'fight1') anim = self.createAnimIval('fight0' if 'fightBoost' in origAnimName else 'fight1')
result.append(animAndSound) result.append(anim)
result.append(Func(self.hideWater)) result.append(Func(self.hideWater))
return result return result

View file

@ -2,7 +2,7 @@ import math
import random import random
import GenericAnimatedProp import GenericAnimatedProp
from direct.actor import Actor from direct.actor import Actor
from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, SoundInterval, Parallel from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, Parallel
from direct.fsm import FSM from direct.fsm import FSM
from direct.showbase.PythonUtil import weightedChoice from direct.showbase.PythonUtil import weightedChoice
from pandac.PandaModules import TextNode, Vec3 from pandac.PandaModules import TextNode, Vec3
@ -44,7 +44,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.okToStartNextAnim = False self.okToStartNextAnim = False
cellIndexStr = node.getTag('DNACellIndex') cellIndexStr = node.getTag('DNACellIndex')
self.cellIndex = ord(cellIndexStr) self.cellIndex = ord(cellIndexStr)
self.origAnimNameToSound = {}
self.lastPlayingAnimPhase = 0 self.lastPlayingAnimPhase = 0
self.buildingsMakingMeSad = set() self.buildingsMakingMeSad = set()
GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) GenericAnimatedProp.GenericAnimatedProp.__init__(self, node)
@ -155,14 +154,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = Sequence() result = Sequence()
for i in xrange(self.numFightAnims): for i in xrange(self.numFightAnims):
animKey = 'fight%d' % i animKey = 'fight%d' % i
animAndSoundIval = self.createAnimAndSoundIval(animKey) animIval = self.createAnimIval(animKey)
origAnimName = self.node.getAnimFilename(animKey).split('/')[-1] origAnimName = self.node.getAnimFilename(animKey).split('/')[-1]
if self.hasOverrideIval(origAnimName): if self.hasOverrideIval(origAnimName):
result.append(self.getOverrideIval(origAnimName)) result.append(self.getOverrideIval(origAnimName))
elif self.hasSpecialIval(origAnimName): elif self.hasSpecialIval(origAnimName):
result.append(Parallel(animAndSoundIval, self.getSpecialIval(origAnimName))) result.append(Parallel(animIval, self.getSpecialIval(origAnimName)))
else: else:
result.append(animAndSoundIval) result.append(animIval)
self.createBattleCheerText() 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)) 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))
@ -172,7 +171,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createSadInterval(self): def createSadInterval(self):
result = Sequence() result = Sequence()
if self.hoodId in self.ZoneToSadAnims: if self.hoodId in self.ZoneToSadAnims:
result = self.createAnimAndSoundIval('sad') result = self.createAnimIval('sad')
return result return result
def hasSpecialIval(self, origAnimName): def hasSpecialIval(self, origAnimName):
@ -190,8 +189,8 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createVictoryInterval(self): def createVictoryInterval(self):
result = Sequence() result = Sequence()
if self.hoodId in self.ZoneToVictoryAnims: if self.hoodId in self.ZoneToVictoryAnims:
animAndSoundIval = self.createAnimAndSoundIval('victory') animIval = self.createAnimIval('victory')
result.append(animAndSoundIval) result.append(animIval)
return result return result
def enter(self): def enter(self):
@ -286,28 +285,25 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim) self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim)
return return
def createIdleAnimAndSoundInterval(self, whichIdleAnim, startingTime = 0): def createIdleAnimInterval(self, whichIdleAnim, startingTime = 0):
animIval = self.node.actorInterval('idle%d' % whichIdleAnim, startTime=startingTime) animIval = self.node.actorInterval('idle%d' % whichIdleAnim, startTime=startingTime)
animIvalDuration = animIval.getDuration() animIvalDuration = animIval.getDuration()
origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim] origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim]
if isinstance(origAnimName, tuple): if isinstance(origAnimName, tuple):
origAnimName = origAnimName[0] origAnimName = origAnimName[0]
soundIval = self.createSoundInterval(origAnimName, animIvalDuration)
soundIvalDuration = soundIval.getDuration()
if self.hasSpecialIval(origAnimName): if self.hasSpecialIval(origAnimName):
specialIval = self.getSpecialIval(origAnimName) specialIval = self.getSpecialIval(origAnimName)
idleAnimAndSound = Parallel(animIval, soundIval, specialIval) return Parallel(animIval, specialIval)
else: else:
idleAnimAndSound = Parallel(animIval, soundIval) return animIval
return idleAnimAndSound
def createIdleAnimSequence(self, whichIdleAnim): def createIdleAnimSequence(self, whichIdleAnim):
dummyResult = Sequence(Wait(self.IdlePauseTime)) dummyResult = Sequence(Wait(self.IdlePauseTime))
if not hasattr(self, 'node') or not self.node: if not hasattr(self, 'node') or not self.node:
self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node')) self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node'))
return dummyResult return dummyResult
idleAnimAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim) idleAnim = self.createIdleAnimInterval(whichIdleAnim)
result = Sequence(idleAnimAndSound, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim)) result = Sequence(idleAnim, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim))
if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 2: if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 2:
info = self.ZoneToIdles[self.hoodId][whichIdleAnim] info = self.ZoneToIdles[self.hoodId][whichIdleAnim]
origAnimName = info[0] origAnimName = info[0]
@ -320,7 +316,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
pauseTime = random.randrange(minPauseTime, maxPauseTime + 1) pauseTime = random.randrange(minPauseTime, maxPauseTime + 1)
result = Sequence() result = Sequence()
for i in xrange(numberOfLoops): for i in xrange(numberOfLoops):
result.append(idleAnimAndSound) result.append(idleAnim)
if self.getSettleName(whichIdleAnim): if self.getSettleName(whichIdleAnim):
result.append(self.node.actorInterval('settle%d' % whichIdleAnim)) result.append(self.node.actorInterval('settle%d' % whichIdleAnim))
@ -383,9 +379,9 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = Sequence() result = Sequence()
if self.lastIdleAnimName: if self.lastIdleAnimName:
whichIdleAnim = self.calcWhichIdleAnim(self.lastIdleAnimName) whichIdleAnim = self.calcWhichIdleAnim(self.lastIdleAnimName)
animAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim, self.lastIdleTime) anim = self.createIdleAnimInterval(whichIdleAnim, self.lastIdleTime)
result.append(animAndSound) result.append(anim)
idleIntoFightIval = self.createAnimAndSoundIval('idleIntoFight') idleIntoFightIval = self.createAnimIval('idleIntoFight')
result.append(idleIntoFightIval) result.append(idleIntoFightIval)
result.append(Func(self.gotoBattleCheer)) result.append(Func(self.gotoBattleCheer))
return result return result
@ -443,33 +439,15 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = self.ZoneToIdles[self.hoodId][whichIdleAnim] result = self.ZoneToIdles[self.hoodId][whichIdleAnim]
return result return result
def createAnimAndSoundIval(self, animKey): def createAnimIval(self, animKey):
animIval = self.node.actorInterval(animKey) animIval = self.node.actorInterval(animKey)
animIvalDuration = animIval.getDuration() animIvalDuration = animIval.getDuration()
origAnimName = self.node.getAnimFilename(animKey) origAnimName = self.node.getAnimFilename(animKey)
soundIval = self.createSoundInterval(origAnimName, animIvalDuration)
soundIvalDuration = soundIval.getDuration()
printFunc = Func(self.printAnimIfClose, animKey)
if self.hasSpecialIval(origAnimName): if self.hasSpecialIval(origAnimName):
specialIval = self.getSpecialIval(origAnimName) specialIval = self.getSpecialIval(origAnimName)
idleAnimAndSound = Parallel(animIval, soundIval, specialIval) return Parallel(animIval, specialIval)
if base.config.GetBool('interactive-prop-info', False):
idleAnimAndSound.append(printFunc)
else: else:
idleAnimAndSound = Parallel(animIval, soundIval) return animIval
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): def clearCurIval(self):
if self.curIval: if self.curIval: