mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
DANIEL: Cycle through races shit
This commit is contained in:
parent
1e47509477
commit
9db517cfb3
5 changed files with 57 additions and 30 deletions
7
dependencies/astron/dclass/stride.dc
vendored
7
dependencies/astron/dclass/stride.dc
vendored
|
@ -2623,9 +2623,14 @@ dclass DistributedStartingBlock : DistributedObject {
|
||||||
dclass DistributedViewingBlock : DistributedStartingBlock {
|
dclass DistributedViewingBlock : DistributedStartingBlock {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LeaderboardResult {
|
||||||
|
string name;
|
||||||
|
uint32 time;
|
||||||
|
};
|
||||||
|
|
||||||
dclass DistributedLeaderBoard : DistributedObject {
|
dclass DistributedLeaderBoard : DistributedObject {
|
||||||
setPosHpr(int16/10, int16/10, int16/10, int16/10, int16/10, int16/10) required broadcast ram;
|
setPosHpr(int16/10, int16/10, int16/10, int16/10, int16/10, int16/10) required broadcast ram;
|
||||||
setDisplay(blob) broadcast ram;
|
setDisplay(uint8, uint8, LeaderboardResult[]) required broadcast ram;
|
||||||
};
|
};
|
||||||
|
|
||||||
dclass DistributedLawbotBoss : DistributedBossCog {
|
dclass DistributedLawbotBoss : DistributedBossCog {
|
||||||
|
|
|
@ -133,10 +133,11 @@ class GSHoodAI(HoodAI.HoodAI):
|
||||||
hpr = childDnaGroup.getHpr()
|
hpr = childDnaGroup.getHpr()
|
||||||
nameInfo = childDnaGroup.getName().split('_')
|
nameInfo = childDnaGroup.getName().split('_')
|
||||||
|
|
||||||
leaderBoard = DistributedLeaderBoardAI(simbase.air, nameInfo[1])
|
if nameInfo[1] in RaceGlobals.LBSubscription:
|
||||||
leaderBoard.setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
|
leaderBoard = DistributedLeaderBoardAI(simbase.air, RaceGlobals.LBSubscription[nameInfo[1]])
|
||||||
leaderBoard.generateWithRequired(zoneId)
|
leaderBoard.setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
|
||||||
leaderBoards.append(leaderBoard)
|
leaderBoard.generateWithRequired(zoneId)
|
||||||
|
leaderBoards.append(leaderBoard)
|
||||||
elif isinstance(dnaGroup, DNAVisGroup):
|
elif isinstance(dnaGroup, DNAVisGroup):
|
||||||
zoneId = int(dnaGroup.getName().split(':')[0])
|
zoneId = int(dnaGroup.getName().split(':')[0])
|
||||||
|
|
||||||
|
@ -151,12 +152,6 @@ class GSHoodAI(HoodAI.HoodAI):
|
||||||
dnaData = self.air.dnaDataMap[self.zoneId]
|
dnaData = self.air.dnaDataMap[self.zoneId]
|
||||||
if dnaData.getName() == 'root':
|
if dnaData.getName() == 'root':
|
||||||
self.leaderBoards = self.findLeaderBoards(dnaData, self.zoneId)
|
self.leaderBoards = self.findLeaderBoards(dnaData, self.zoneId)
|
||||||
for leaderBoard in self.leaderBoards:
|
|
||||||
if not leaderBoard:
|
|
||||||
continue
|
|
||||||
leaderBoardType = leaderBoard.getName()
|
|
||||||
for subscription in RaceGlobals.LBSubscription[leaderBoardType]:
|
|
||||||
leaderBoard.subscribeTo(subscription)
|
|
||||||
|
|
||||||
def __cycleLeaderBoards(self, task = None):
|
def __cycleLeaderBoards(self, task = None):
|
||||||
messenger.send('GS_LeaderBoardSwap' + str(self.zoneId))
|
messenger.send('GS_LeaderBoardSwap' + str(self.zoneId))
|
||||||
|
|
|
@ -5,7 +5,6 @@ from toontown.racing import KartShopGlobals
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
from toontown.toonbase.ToonBaseGlobal import *
|
from toontown.toonbase.ToonBaseGlobal import *
|
||||||
from toontown.toonbase.ToontownGlobals import *
|
from toontown.toonbase.ToontownGlobals import *
|
||||||
import cPickle
|
|
||||||
|
|
||||||
class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DisributedLeaderBoard')
|
notify = DirectNotifyGlobal.directNotify.newCategory('DisributedLeaderBoard')
|
||||||
|
@ -35,10 +34,13 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
||||||
def setPosHpr(self, x, y, z, h, p, r):
|
def setPosHpr(self, x, y, z, h, p, r):
|
||||||
self.surface.setPosHpr(x, y, z, h, p, r)
|
self.surface.setPosHpr(x, y, z, h, p, r)
|
||||||
|
|
||||||
def setDisplay(self, pData):
|
def setDisplay(self, track, type, results):
|
||||||
self.notify.debug('setDisplay: changing leaderboard text on local side')
|
if not track in TTLocalizer.KartRace_TrackNames or len(TTLocalizer.RecordPeriodStrings) <= type:
|
||||||
trackName, recordTitle, scores = cPickle.loads(pData)
|
return
|
||||||
self.display(trackName, recordTitle, scores)
|
|
||||||
|
trackName = TTLocalizer.KartRace_TrackNames[track]
|
||||||
|
recordTitle = TTLocalizer.RecordPeriodStrings[type]
|
||||||
|
self.display(trackName, recordTitle, results)
|
||||||
|
|
||||||
def buildListParts(self):
|
def buildListParts(self):
|
||||||
self.surface = self.board.attachNewNode('surface')
|
self.surface = self.board.attachNewNode('surface')
|
||||||
|
@ -78,7 +80,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject):
|
||||||
self.trackNameNode.setText(pTrackTitle)
|
self.trackNameNode.setText(pTrackTitle)
|
||||||
self.updateCount += 1
|
self.updateCount += 1
|
||||||
for i in xrange(10):
|
for i in xrange(10):
|
||||||
if i > len(pLeaderList):
|
if i >= len(pLeaderList):
|
||||||
self.nameTextNodes[i].setText('-')
|
self.nameTextNodes[i].setText('-')
|
||||||
self.timeTextNodes[i].setText('-')
|
self.timeTextNodes[i].setText('-')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,28 +1,47 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
from direct.task import Task
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
import random
|
||||||
|
|
||||||
class DistributedLeaderBoardAI(DistributedObjectAI):
|
class DistributedLeaderBoardAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLeaderBoardAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLeaderBoardAI")
|
||||||
|
|
||||||
def __init__(self, air, name):
|
def __init__(self, air, displays):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
|
self.displays = displays
|
||||||
|
self.display = (0, 0, [])
|
||||||
self.posHpr = (0, 0, 0, 0, 0, 0)
|
self.posHpr = (0, 0, 0, 0, 0, 0)
|
||||||
self.name = name
|
|
||||||
|
def generateWithRequired(self, zoneId):
|
||||||
|
DistributedObjectAI.generateWithRequired(self, zoneId)
|
||||||
|
self.setup()
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
DistributedObjectAI.delete(self)
|
||||||
|
taskMgr.remove(self.switchTask)
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
self.currentId = 0
|
||||||
|
self.switchDisplay()
|
||||||
|
self.switchTask = taskMgr.doMethodLater(15, self.switchDisplay, 'leaderboardSwitchTask-%s' % random.random())
|
||||||
|
|
||||||
|
def switchDisplay(self, task=None):
|
||||||
|
race = self.displays[self.currentId]
|
||||||
|
|
||||||
|
self.display = (race[0], race[1], [])
|
||||||
|
self.currentId += 1
|
||||||
|
|
||||||
|
if self.currentId >= len(self.displays):
|
||||||
|
self.currentId = 0
|
||||||
|
|
||||||
|
self.sendUpdate('setDisplay', [self.display[0], self.display[1], self.display[2]])
|
||||||
|
return Task.again
|
||||||
|
|
||||||
def setPosHpr(self, x, y, z, h, p, r):
|
def setPosHpr(self, x, y, z, h, p, r):
|
||||||
self.posHpr = (x, y, z, h, p, r)
|
self.posHpr = (x, y, z, h, p, r)
|
||||||
|
|
||||||
def getPosHpr(self):
|
def getPosHpr(self):
|
||||||
return self.posHpr
|
return self.posHpr
|
||||||
|
|
||||||
def setName(self, name):
|
|
||||||
self.name = name
|
|
||||||
|
|
||||||
def getName(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def setDisplay(self, todo0):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def subscribeTo(self, todo0):
|
def getDisplay(self):
|
||||||
print 'subscribed to %s' % (todo0,)
|
return self.display
|
|
@ -8467,3 +8467,9 @@ TrueFriendsNotFriends = 'You cannot be True Friends with %s until you are regula
|
||||||
TrueFriendsAddNotice = 'If you are playing Toontown with someone you trust, you can become True Friends.\n\nYou can chat using the keyboard with your True Friends.\n\nOther Toons won\'t understand what you\'re saying.\n\n\x01WLRed\x01However, this chat is completely unfiltered.\x02\n\nAre you sure you want to be True Friends with %s?'
|
TrueFriendsAddNotice = 'If you are playing Toontown with someone you trust, you can become True Friends.\n\nYou can chat using the keyboard with your True Friends.\n\nOther Toons won\'t understand what you\'re saying.\n\n\x01WLRed\x01However, this chat is completely unfiltered.\x02\n\nAre you sure you want to be True Friends with %s?'
|
||||||
TrueFriendsAdded = 'You are now True Friends with %s!\n\nYou can now understand everything %s says.\n\nHowever, chances are %s hasn\'t added you as a True Friend yet.\n\nIf this is the case, he cannot understand you yet. Please ask %s to add you as a True Friend aswell!'
|
TrueFriendsAdded = 'You are now True Friends with %s!\n\nYou can now understand everything %s says.\n\nHowever, chances are %s hasn\'t added you as a True Friend yet.\n\nIf this is the case, he cannot understand you yet. Please ask %s to add you as a True Friend aswell!'
|
||||||
TrueFriendsRemoved = 'You are no longer True Friends with %s.'
|
TrueFriendsRemoved = 'You are no longer True Friends with %s.'
|
||||||
|
|
||||||
|
def convertSecondsToDate(seconds):
|
||||||
|
m, s = divmod(seconds, 60)
|
||||||
|
h, m = divmod(m, 60)
|
||||||
|
|
||||||
|
print '%d:%02d:%02d' % (h, m, s)
|
||||||
|
|
Loading…
Reference in a new issue