coghq: fix more cj crashes

This commit is contained in:
John Cote 2020-01-10 22:53:57 -05:00
parent cf68a25f81
commit 747fff520c

View file

@ -9,6 +9,7 @@ from toontown.estate import DistributedCannon
from toontown.estate import CannonGlobals
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from libotp import *
from toontown.toon import NPCToons
from toontown.toon import ToonHead
from toontown.toonbase import TTLocalizer
@ -667,12 +668,7 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject):
avId = task.avId
if self.toonHead == None or not self.boss.state == 'BattleTwo':
return Task.done
flightResults = self.__calcFlightResults(avId, launchTime)
if not isClient():
print('EXECWARNING DistributedLawbotCannon: %s' % flightResults)
printStack()
for key in flightResults:
exec("%s = flightResults['%s']" % (key, key))
startPos, startHpr, startVel, trajectory, timeOfImpact, hitWhat = self.__calcFlightResults(avId, launchTime)
self.notify.debug('start position: ' + str(startPos))
self.notify.debug('start velocity: ' + str(startVel))
@ -744,12 +740,7 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject):
trajectory = Trajectory.Trajectory(launchTime, startPos, startVel)
self.trajectory = trajectory
timeOfImpact, hitWhat = self.__calcToonImpact(trajectory)
return {'startPos': startPos,
'startHpr': startHpr,
'startVel': startVel,
'trajectory': trajectory,
'timeOfImpact': 3 * timeOfImpact,
'hitWhat': hitWhat}
return startPos, startHpr, startVel, trajectory, 3 * timeOfImpact, hitWhat
def __calcToonImpact(self, trajectory):
t_groundImpact = trajectory.checkCollisionWithGround(GROUND_PLANE_MIN)