diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index f1f9191..76a12c5 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -309,7 +309,7 @@ class ToontownAIRepository(ToontownInternalRepository): return kartPads, kartPadGroups - def findStartingBlocks(self, dnaData, pad): + def findStartingBlocks(self, dnaData, kartPad): startingBlocks = [] for i in range(dnaData.getNumChildren()): groupName = dnaData.getName() @@ -320,8 +320,8 @@ class ToontownAIRepository(ToontownInternalRepository): x, y, z = block.getPos() h, p, r = block.getHpr() padLocationId = int(blockName[-1]) - startingBlock = cls(self, pad, x, y, z, h, p, r, padLocationId) - startingBlock.generateWithRequired(pad.zoneId) + startingBlock = cls(self, kartPad, x, y, z, h, p, r, padLocationId) + startingBlock.generateWithRequired(kartPad.zoneId) startingBlocks.append(startingBlock) return startingBlocks diff --git a/toontown/racing/DistributedKartPadAI.py b/toontown/racing/DistributedKartPadAI.py index ccc71f2..03fad6d 100644 --- a/toontown/racing/DistributedKartPadAI.py +++ b/toontown/racing/DistributedKartPadAI.py @@ -19,3 +19,12 @@ class DistributedKartPadAI(DistributedObjectAI): def addStartingBlock(self, startingBlock): self.startingBlocks.append(startingBlock) + + def addAvBlock(self, avId, startingBlock, paid): + pass + + def removeAvBlock(self, avId, startingBlock): + pass + + def kartMovieDone(self): + pass diff --git a/toontown/racing/DistributedViewPadAI.py b/toontown/racing/DistributedViewPadAI.py index 9023d0e..aa2ee72 100644 --- a/toontown/racing/DistributedViewPadAI.py +++ b/toontown/racing/DistributedViewPadAI.py @@ -2,6 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import globalClockDelta from toontown.racing.DistributedKartPadAI import DistributedKartPadAI +from toontown.racing.KartShopGlobals import KartGlobals class DistributedViewPadAI(DistributedKartPadAI): @@ -15,5 +16,40 @@ class DistributedViewPadAI(DistributedKartPadAI): DistributedKartPadAI.announceGenerate(self) self.lastEntered = globalClockDelta.getRealNetworkTime() + def setLastEntered(self, lastEntered): + self.lastEntered = lastEntered + + def d_setLastEntered(self, lastEntered): + self.sendUpdate('setLastEntered', [lastEntered]) + + def b_setLastEntered(self, lastEntered): + self.setLastEntered(lastEntered) + self.d_setLastEntered(lastEntered) + def getLastEntered(self): return self.lastEntered + + def addAvBlock(self, avId, startingBlock, paid): + av = self.air.doId2do.get(avId) + if not av: + return + + if not av.hasKart(): + return KartGlobals.ERROR_CODE.eNoKart + + if not startingBlock.avId: + self.b_setLastEntered(globalClockDelta.getRealNetworkTime()) + taskMgr.doMethodLater(KartGlobals.COUNTDOWN_TIME, self.kickAvatar, + startingBlock.uniqueName('viewTimer'), + extraArgs=[avId, startingBlock]) + return KartGlobals.ERROR_CODE.success + else: + return KartGlobals.ERROR_CODE.eOccupied + + def removeAvBlock(self, avId, startingBlock): + if avId == startingBlock.avId: + taskMgr.remove(startingBlock.uniqueName('viewTimer')) + + def kickAvatar(self, avId, startingBlock): + if avId == startingBlock.avId and not startingBlock.currentMovie: + startingBlock.normalExit()