From 22486021aaaacb8fe8585b3e16fce37429b620c7 Mon Sep 17 00:00:00 2001 From: John Cote Date: Sun, 5 Jan 2020 21:53:40 -0500 Subject: [PATCH] racing: fix toon battles --- toontown/racing/DistributedGagAI.py | 33 +++++++++++++++++++++++++++++ toontown/racing/Racer.py | 3 +++ 2 files changed, 36 insertions(+) diff --git a/toontown/racing/DistributedGagAI.py b/toontown/racing/DistributedGagAI.py index 30a2118..993ea0d 100644 --- a/toontown/racing/DistributedGagAI.py +++ b/toontown/racing/DistributedGagAI.py @@ -1,5 +1,38 @@ from direct.directnotify import DirectNotifyGlobal +from direct.distributed.ClockDelta import globalClockDelta from direct.distributed.DistributedObjectAI import DistributedObjectAI + class DistributedGagAI(DistributedObjectAI): 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() diff --git a/toontown/racing/Racer.py b/toontown/racing/Racer.py index 5f9c31a..0559dbd 100644 --- a/toontown/racing/Racer.py +++ b/toontown/racing/Racer.py @@ -11,6 +11,9 @@ class Racer: self.avatar = self.air.doId2do.get(self.avId) self.avatar.takeOutKart(self.zoneId) self.kart = self.avatar.kart + self.hasGag = False + self.gagType = None + self.anvilTarget = False self.finished = False self.maxLap = 0 self.lapT = 0.0