Knock Knock door toonups

This commit is contained in:
John 2015-06-27 20:01:51 +03:00
parent 11122c2486
commit 40875ea6f6
5 changed files with 35 additions and 7 deletions

View file

@ -749,6 +749,7 @@ dclass DistributedToon : DistributedPlayer {
setRedeemedCodes(string [] = []) required ownrecv db; setRedeemedCodes(string [] = []) required ownrecv db;
setEmblems(uint32[] = [0, 0]) required ownrecv db; setEmblems(uint32[] = [0, 0]) required ownrecv db;
setTrueFriends(uint32[] = []) required clsend ownrecv db; setTrueFriends(uint32[] = []) required clsend ownrecv db;
setNextKnockHeal(uint32) ram airecv;
}; };
dclass DistributedPartyGate : DistributedObject { dclass DistributedPartyGate : DistributedObject {
@ -1872,6 +1873,7 @@ dclass DistributedNPCGlove : DistributedNPCToonBase {
}; };
dclass DistributedKnockKnockDoor : DistributedAnimatedProp { dclass DistributedKnockKnockDoor : DistributedAnimatedProp {
requestToonup() airecv clsend;
}; };
dclass DistributedElevator : DistributedObject { dclass DistributedElevator : DistributedObject {

View file

@ -90,7 +90,11 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp)
pos = doorNP.getBounds().getCenter() pos = doorNP.getBounds().getCenter()
self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2)) self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2))
d = duration * 0.125 d = duration * 0.125
track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack)) track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]))
if avatar == base.localAvatar:
track.append(Func(self.sendUpdate, 'requestToonup'))
track.append(Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)))
track.append(Func(self.cleanupTrack))
track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack') track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack')
return track return track

View file

@ -1,11 +1,8 @@
import DistributedAnimatedPropAI
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import *
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.task.Task import Task from direct.task.Task import Task
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
from toontown.toonbase import ToontownGlobals
import DistributedAnimatedPropAI
import time
class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI): class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI):
def __init__(self, air, propId): def __init__(self, air, propId):
@ -38,3 +35,12 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self) DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self)
taskMgr.remove(self.doLaterTask) taskMgr.remove(self.doLaterTask)
self.doLaterTask = None self.doLaterTask = None
def requestToonup(self):
av = self.air.doId2do.get(self.air.getAvatarIdFromSender())
if (not av) or av.getHp() == av.getMaxHp() or av.getNextKnockHeal() > time.time():
return
av.toonUp(ToontownGlobals.KnockKnockHeal)
av.b_setNextKnockHeal(int(time.time() + ToontownGlobals.KnockKnockCooldown))

View file

@ -159,6 +159,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.reported = [] self.reported = []
self.trueFriends = [] self.trueFriends = []
self.fishBingoTutorialDone = False self.fishBingoTutorialDone = False
self.nextKnockHeal = 0
def generate(self): def generate(self):
DistributedPlayerAI.DistributedPlayerAI.generate(self) DistributedPlayerAI.DistributedPlayerAI.generate(self)
@ -4020,6 +4021,19 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def getTrueFriends(self, trueFriends): def getTrueFriends(self, trueFriends):
return self.trueFriends return self.trueFriends
def setNextKnockHeal(self, nextKnockHeal):
self.nextKnockHeal = nextKnockHeal
def d_setNextKnockHeal(self, nextKnockHeal):
self.sendUpdate('setNextKnockHeal', [nextKnockHeal])
def b_setNextKnockHeal(self, nextKnockHeal):
self.setNextKnockHeal(nextKnockHeal)
self.d_setNextKnockHeal(nextKnockHeal)
def getNextKnockHeal(self):
return self.nextKnockHeal
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int]) @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int])
def cheesyEffect(value, hood=0, expire=0): def cheesyEffect(value, hood=0, expire=0):
""" """

View file

@ -1619,3 +1619,5 @@ FISHSALE_NONE = 0
FISHSALE_COMPLETE = 1 FISHSALE_COMPLETE = 1
FISHSALE_TROPHY = 2 FISHSALE_TROPHY = 2
NPCCollisionDelay = 2.5 NPCCollisionDelay = 2.5
KnockKnockHeal = 12
KnockKnockCooldown = 600