mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Initial work on goofy leaderboard
This commit is contained in:
parent
54125c5b65
commit
1e47509477
2 changed files with 45 additions and 12 deletions
|
@ -6,9 +6,9 @@ from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
|
||||||
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI
|
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI
|
||||||
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
|
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
|
||||||
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
|
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
|
||||||
|
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
|
||||||
|
|
||||||
class GSHoodAI(HoodAI.HoodAI):
|
class GSHoodAI(HoodAI.HoodAI):
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
HoodAI.HoodAI.__init__(self, air,
|
HoodAI.HoodAI.__init__(self, air,
|
||||||
|
@ -121,8 +121,30 @@ class GSHoodAI(HoodAI.HoodAI):
|
||||||
for viewingBlock in foundViewingBlocks:
|
for viewingBlock in foundViewingBlocks:
|
||||||
viewPad.addStartingBlock(viewingBlock)
|
viewPad.addStartingBlock(viewingBlock)
|
||||||
|
|
||||||
def findLeaderBoards(self, dnaData, zoneId):
|
def findLeaderBoards(self, dnaGroup, zoneId):
|
||||||
return [] # TODO
|
leaderBoards = []
|
||||||
|
|
||||||
|
if isinstance(dnaGroup, DNAGroup) and ('leader_board' in dnaGroup.getName()):
|
||||||
|
for i in xrange(dnaGroup.getNumChildren()):
|
||||||
|
childDnaGroup = dnaGroup.at(i)
|
||||||
|
|
||||||
|
if 'leaderBoard' in childDnaGroup.getName():
|
||||||
|
pos = childDnaGroup.getPos()
|
||||||
|
hpr = childDnaGroup.getHpr()
|
||||||
|
nameInfo = childDnaGroup.getName().split('_')
|
||||||
|
|
||||||
|
leaderBoard = DistributedLeaderBoardAI(simbase.air, nameInfo[1])
|
||||||
|
leaderBoard.setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
|
||||||
|
leaderBoard.generateWithRequired(zoneId)
|
||||||
|
leaderBoards.append(leaderBoard)
|
||||||
|
elif isinstance(dnaGroup, DNAVisGroup):
|
||||||
|
zoneId = int(dnaGroup.getName().split(':')[0])
|
||||||
|
|
||||||
|
for i in xrange(dnaGroup.getNumChildren()):
|
||||||
|
foundLeaderBoards = self.findLeaderBoards(dnaGroup.at(i), zoneId)
|
||||||
|
leaderBoards.extend(foundLeaderBoards)
|
||||||
|
|
||||||
|
return leaderBoards
|
||||||
|
|
||||||
def createLeaderBoards(self):
|
def createLeaderBoards(self):
|
||||||
self.leaderBoards = []
|
self.leaderBoards = []
|
||||||
|
@ -132,12 +154,7 @@ class GSHoodAI(HoodAI.HoodAI):
|
||||||
for leaderBoard in self.leaderBoards:
|
for leaderBoard in self.leaderBoards:
|
||||||
if not leaderBoard:
|
if not leaderBoard:
|
||||||
continue
|
continue
|
||||||
if 'city' in leaderBoard.getName():
|
leaderBoardType = leaderBoard.getName()
|
||||||
leaderBoardType = 'city'
|
|
||||||
elif 'stadium' in leaderBoard.getName():
|
|
||||||
leaderBoardType = 'stadium'
|
|
||||||
elif 'country' in leaderBoard.getName():
|
|
||||||
leaderBoardType = 'country'
|
|
||||||
for subscription in RaceGlobals.LBSubscription[leaderBoardType]:
|
for subscription in RaceGlobals.LBSubscription[leaderBoardType]:
|
||||||
leaderBoard.subscribeTo(subscription)
|
leaderBoard.subscribeTo(subscription)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,25 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
class DistributedLeaderBoardAI(DistributedObjectAI):
|
class DistributedLeaderBoardAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLeaderBoardAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLeaderBoardAI")
|
||||||
|
|
||||||
def setPosHpr(self, todo0, todo1, todo2, todo3, todo4, todo5):
|
def __init__(self, air, name):
|
||||||
pass
|
DistributedObjectAI.__init__(self, air)
|
||||||
|
self.posHpr = (0, 0, 0, 0, 0, 0)
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def setPosHpr(self, x, y, z, h, p, r):
|
||||||
|
self.posHpr = (x, y, z, h, p, r)
|
||||||
|
|
||||||
|
def getPosHpr(self):
|
||||||
|
return self.posHpr
|
||||||
|
|
||||||
|
def setName(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def getName(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
def setDisplay(self, todo0):
|
def setDisplay(self, todo0):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def subscribeTo(self, todo0):
|
||||||
|
print 'subscribed to %s' % (todo0,)
|
Loading…
Reference in a new issue