Add base.localAvatar check to lerpCam and add createTalkSequence

This commit is contained in:
DenialMC 2015-05-10 22:39:47 +03:00
parent 32cb6371ac
commit 83e859ae4c
3 changed files with 28 additions and 26 deletions

View file

@ -40,16 +40,9 @@ class DDSafeZoneLoader(SafeZoneLoader.SafeZoneLoader):
self.donald.setPos(0, -1, 3.95)
self.donald.reparentTo(self.boat)
self.donald.setHat(48, 0, 0)
self.donaldSpeech = Sequence()
random.shuffle(TTLocalizer.DonaldChatter)
for speechText in TTLocalizer.DonaldChatter:
self.donaldSpeech.append(Func(self.donald.setChatAbsolute, speechText, CFSpeech))
self.donaldSpeech.append(Wait(len(speechText.split(' '))))
self.donaldSpeech.append(Func(self.donald.clearChat))
self.donaldSpeech.append(Wait(15))
self.donaldSpeech = self.donald.createTalkSequence(TTLocalizer.DonaldChatter, 15)
self.donaldSpeech.loop(0)
def unload(self):

View file

@ -221,4 +221,4 @@ class DistributedNPCToon(DistributedNPCToonBase):
if self.trackChoiceGui:
self.trackChoiceGui.destroy()
self.trackChoiceGui = None
self.sendUpdate('chooseTrack', [trackId])
self.sendUpdate('chooseTrack', [trackId])

View file

@ -1790,18 +1790,21 @@ class Toon(Avatar.Avatar, ToonHead):
self.getGeomNode().setClipPlane(self.holeClipPath)
self.nametag3d.setClipPlane(self.holeClipPath)
avHeight = max(self.getHeight(), 3)
def lerpCam(task):
degrees = task.time * 52.941
radians = degrees * (math.pi / 180.0)
x = -12 * math.sin(radians)
y = -12 * math.cos(radians)
z = base.localAvatar.getHeight()
camera.setPos(x, y, z)
camera.setH(-degrees)
if task.time > 3.4:
return Task.done
return Task.cont
taskMgr.add(lerpCam, 'lerpCam')
if self == base.localAvatar:
def lerpCam(task):
degrees = task.time * 52.941
radians = degrees * (math.pi / 180.0)
x = -12 * math.sin(radians)
y = -12 * math.cos(radians)
z = base.localAvatar.getHeight()
camera.setPos(x, y, z)
camera.setH(-degrees)
if task.time > 3.4:
return Task.done
return Task.cont
taskMgr.add(lerpCam, 'lerpCam')
self.track.start(ts)
self.setActiveShadow(0)
@ -2990,8 +2993,6 @@ class Toon(Avatar.Avatar, ToonHead):
def enterScientistJealous(self, animMultiplier = 1, ts = 0, callback = None, extraArgs = []):
self.loop('scientistJealous')
if hasattr(self, 'showScientistProp'):
self.showScientistProp()
def exitScientistJealous(self):
self.stop()
@ -3016,12 +3017,20 @@ class Toon(Avatar.Avatar, ToonHead):
def enterScientistPlay(self, animMultiplier = 1, ts = 0, callback = None, extraArgs = []):
self.loop('scientistGame')
if hasattr(self, 'scientistPlay'):
self.scientistPlay()
def exitScientistPlay(self):
self.stop()
def createTalkSequence(self, speech, waitTime):
sequence = Sequence()
for text in speech:
sequence.append(Func(self.setChatAbsolute, text, CFSpeech))
sequence.append(Wait(len(text.split(' '))))
sequence.append(Func(self.clearChat))
sequence.append(Wait(waitTime))
return sequence
loadModels()
compileGlobalAnimList()