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

@ -41,15 +41,8 @@ class DDSafeZoneLoader(SafeZoneLoader.SafeZoneLoader):
self.donald.reparentTo(self.boat) self.donald.reparentTo(self.boat)
self.donald.setHat(48, 0, 0) self.donald.setHat(48, 0, 0)
self.donaldSpeech = Sequence()
random.shuffle(TTLocalizer.DonaldChatter) random.shuffle(TTLocalizer.DonaldChatter)
self.donaldSpeech = self.donald.createTalkSequence(TTLocalizer.DonaldChatter, 15)
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.loop(0) self.donaldSpeech.loop(0)
def unload(self): def unload(self):

View file

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