racing: fix toon battles

This commit is contained in:
John Cote 2020-01-05 21:53:40 -05:00
parent bdfd01b6b0
commit 22486021aa
2 changed files with 36 additions and 0 deletions

View file

@ -1,5 +1,38 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import globalClockDelta
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedGagAI(DistributedObjectAI): class DistributedGagAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGagAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGagAI')
def __init__(self, air, ownerId, race, _, x, y, z, gagType):
DistributedObjectAI.__init__(self, air)
self.ownerId = ownerId
self.race = race
self.pos = (x, y, z)
self.gagType = gagType
self.initTime = globalClockDelta.getFrameNetworkTime()
self.activateTime = 0
def getInitTime(self):
return self.initTime
def getActivateTime(self):
return self.activateTime
def getPos(self):
return self.pos
def getRace(self):
return self.race.getDoId()
def getOwnerId(self):
return self.ownerId
def getType(self):
return self.gagType
def hitSomebody(self, avId, time):
self.race.thrownGags.remove(self)
self.requestDelete()

View file

@ -11,6 +11,9 @@ class Racer:
self.avatar = self.air.doId2do.get(self.avId) self.avatar = self.air.doId2do.get(self.avId)
self.avatar.takeOutKart(self.zoneId) self.avatar.takeOutKart(self.zoneId)
self.kart = self.avatar.kart self.kart = self.avatar.kart
self.hasGag = False
self.gagType = None
self.anvilTarget = False
self.finished = False self.finished = False
self.maxLap = 0 self.maxLap = 0
self.lapT = 0.0 self.lapT = 0.0