racing: working view pads
This commit is contained in:
parent
03df90b3e2
commit
fcbcd00e45
3 changed files with 48 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue