racing: current progress
This commit is contained in:
parent
1f84f3a96c
commit
248661d51a
5 changed files with 84 additions and 6 deletions
|
@ -25,6 +25,8 @@ from toontown.hood.TTHoodDataAI import TTHoodDataAI
|
|||
from toontown.pets.PetManagerAI import PetManagerAI
|
||||
from toontown.quest.QuestManagerAI import QuestManagerAI
|
||||
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
|
||||
from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
|
||||
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
|
||||
from toontown.racing.RaceManagerAI import RaceManagerAI
|
||||
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
|
||||
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
|
||||
|
@ -269,8 +271,31 @@ class ToontownAIRepository(ToontownInternalRepository):
|
|||
def findPartyHats(self, dnaData, zoneId):
|
||||
return [] # TODO
|
||||
|
||||
def findRacingPads(self, dnaData, zoneId, area, type='racing_pad'):
|
||||
return [], [] # TODO
|
||||
def findRacingPads(self, dnaData, zoneId, area, type='racing_pad', overrideDNAZone=False):
|
||||
kartPads, kartPadGroups = [], []
|
||||
if type in dnaData.getName():
|
||||
if type == 'racing_pad':
|
||||
racePad = DistributedRacePadAI(self)
|
||||
racePad.setArea(area)
|
||||
racePad.generateWithRequired(zoneId)
|
||||
kartPads.append(racePad)
|
||||
kartPadGroups.append(dnaData)
|
||||
elif type == 'viewing_pad':
|
||||
viewPad = DistributedViewPadAI(self)
|
||||
viewPad.setArea(area)
|
||||
viewPad.generateWithRequired(zoneId)
|
||||
kartPads.append(viewPad)
|
||||
kartPadGroups.append(dnaData)
|
||||
|
||||
for i in xrange(dnaData.getNumChildren()):
|
||||
foundKartPads, foundKartPadGroups = self.findRacingPads(dnaData.at(i), zoneId, area, type, overrideDNAZone)
|
||||
kartPads.extend(foundKartPads)
|
||||
kartPadGroups.extend(foundKartPadGroups)
|
||||
|
||||
return kartPads, kartPadGroups
|
||||
|
||||
def findStartingBlocks(self, dnaData, racePad):
|
||||
return [] # TODO
|
||||
|
||||
def findLeaderBoards(self, dnaData, zoneId):
|
||||
leaderBoards = []
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
|
||||
|
||||
class DistributedKartPadAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedKartPadAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedObjectAI.__init__(self, air)
|
||||
self.area = None
|
||||
|
||||
def setArea(self, area):
|
||||
self.area = area
|
||||
|
||||
def getArea(self):
|
||||
return self.area
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from panda3d.core import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.task.Task import Task
|
||||
from direct.distributed.ClockDelta import *
|
||||
|
|
|
@ -1,5 +1,32 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from direct.distributed.ClockDelta import globalClockDelta
|
||||
|
||||
class DistributedRacePadAI(DistributedObjectAI):
|
||||
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
||||
|
||||
|
||||
class DistributedRacePadAI(DistributedKartPadAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRacePadAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedKartPadAI.__init__(self, air)
|
||||
self.state = 'Off'
|
||||
self.trackInfo = [0, 0]
|
||||
|
||||
def setState(self, state):
|
||||
self.state = state
|
||||
|
||||
def d_setState(self, state):
|
||||
self.sendUpdate('setState', [state, globalClockDelta.getRealNetworkTime()])
|
||||
|
||||
def b_setState(self, state):
|
||||
self.setState(state)
|
||||
self.d_setState(state)
|
||||
|
||||
def getState(self):
|
||||
return self.state, globalClockDelta.getRealNetworkTime()
|
||||
|
||||
def getTrackInfo(self):
|
||||
return self.trackInfo
|
||||
|
||||
def request(self, state):
|
||||
self.b_setState(state)
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from direct.distributed.ClockDelta import globalClockDelta
|
||||
|
||||
class DistributedViewPadAI(DistributedObjectAI):
|
||||
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
||||
|
||||
|
||||
class DistributedViewPadAI(DistributedKartPadAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedViewPadAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedKartPadAI.__init__(self, air)
|
||||
self.lastEntered = 0
|
||||
|
||||
def announceGenerate(self):
|
||||
DistributedKartPadAI.announceGenerate(self)
|
||||
self.lastEntered = globalClockDelta.getRealNetworkTime()
|
||||
|
||||
def getLastEntered(self):
|
||||
return self.lastEntered
|
||||
|
|
Loading…
Reference in a new issue