diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 84cb0a38..ba04dfa3 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -749,6 +749,7 @@ dclass DistributedToon : DistributedPlayer { setRedeemedCodes(string [] = []) required ownrecv db; setEmblems(uint32[] = [0, 0]) required ownrecv db; setTrueFriends(uint32[] = []) required clsend ownrecv db; + setNextKnockHeal(uint32) ram airecv; }; dclass DistributedPartyGate : DistributedObject { @@ -1872,6 +1873,7 @@ dclass DistributedNPCGlove : DistributedNPCToonBase { }; dclass DistributedKnockKnockDoor : DistributedAnimatedProp { + requestToonup() airecv clsend; }; dclass DistributedElevator : DistributedObject { diff --git a/toontown/building/DistributedKnockKnockDoor.py b/toontown/building/DistributedKnockKnockDoor.py index ff0667bf..37f7009c 100755 --- a/toontown/building/DistributedKnockKnockDoor.py +++ b/toontown/building/DistributedKnockKnockDoor.py @@ -90,7 +90,11 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp) pos = doorNP.getBounds().getCenter() self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2)) 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') return track diff --git a/toontown/building/DistributedKnockKnockDoorAI.py b/toontown/building/DistributedKnockKnockDoorAI.py index a14d8033..4e21dfed 100755 --- a/toontown/building/DistributedKnockKnockDoorAI.py +++ b/toontown/building/DistributedKnockKnockDoorAI.py @@ -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 otp.ai.AIBaseGlobal import * - +from toontown.toonbase import ToontownGlobals +import DistributedAnimatedPropAI +import time class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI): def __init__(self, air, propId): @@ -38,3 +35,12 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self) taskMgr.remove(self.doLaterTask) 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)) \ No newline at end of file diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index b89d5b99..f700cb39 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -159,6 +159,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.reported = [] self.trueFriends = [] self.fishBingoTutorialDone = False + self.nextKnockHeal = 0 def generate(self): DistributedPlayerAI.DistributedPlayerAI.generate(self) @@ -4020,6 +4021,19 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getTrueFriends(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]) def cheesyEffect(value, hood=0, expire=0): """ diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index 0501f908..8a75272c 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1619,3 +1619,5 @@ FISHSALE_NONE = 0 FISHSALE_COMPLETE = 1 FISHSALE_TROPHY = 2 NPCCollisionDelay = 2.5 +KnockKnockHeal = 12 +KnockKnockCooldown = 600 \ No newline at end of file