racing: it loads and crashes
This commit is contained in:
parent
00f5bfc3a4
commit
9e742f51c4
7 changed files with 50 additions and 31 deletions
|
@ -1,5 +1,6 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.AstronInternalRepository import AstronInternalRepository
|
from direct.distributed.AstronInternalRepository import AstronInternalRepository
|
||||||
|
from direct.distributed.PyDatagram import *
|
||||||
|
|
||||||
|
|
||||||
# TODO: Remove Astron dependence.
|
# TODO: Remove Astron dependence.
|
||||||
|
@ -24,3 +25,19 @@ class OTPInternalRepository(AstronInternalRepository):
|
||||||
def sendSetZone(self, distObj, zoneId):
|
def sendSetZone(self, distObj, zoneId):
|
||||||
distObj.setLocation(distObj.parentId, zoneId)
|
distObj.setLocation(distObj.parentId, zoneId)
|
||||||
self.sendSetLocation(distObj, distObj.parentId, zoneId)
|
self.sendSetLocation(distObj, distObj.parentId, zoneId)
|
||||||
|
|
||||||
|
def setAllowClientSend(self, avId, distObj, fieldNameList=[]):
|
||||||
|
dg = PyDatagram()
|
||||||
|
dg.addServerHeader(distObj.GetPuppetConnectionChannel(avId), self.ourChannel, CLIENTAGENT_SET_FIELDS_SENDABLE)
|
||||||
|
fieldIds = []
|
||||||
|
for fieldName in fieldNameList:
|
||||||
|
field = distObj.dclass.getFieldByName(fieldName)
|
||||||
|
if field:
|
||||||
|
fieldIds.append(field.getNumber())
|
||||||
|
|
||||||
|
dg.addUint32(distObj.getDoId())
|
||||||
|
dg.addUint16(len(fieldIds))
|
||||||
|
for fieldId in fieldIds:
|
||||||
|
dg.addUint16(fieldId)
|
||||||
|
|
||||||
|
self.send(dg)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import builtins
|
import builtins
|
||||||
import sys
|
import sys
|
||||||
import math
|
import math
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
__all__ = ['enumerate', 'nonRepeatingRandomList', 'describeException', 'pdir', 'choice', 'cmp', 'lerp', 'triglerp']
|
__all__ = ['enumerate', 'nonRepeatingRandomList', 'describeException', 'pdir', 'choice', 'cmp', 'lerp', 'triglerp']
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
from direct.particles import ParticleEffect
|
from direct.particles import ParticleEffect
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.showbase import AppRunnerGlobal
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class Drift(NodePath):
|
class Drift(NodePath):
|
||||||
|
@ -15,19 +14,14 @@ class Drift(NodePath):
|
||||||
self.assign(parent.attachNewNode('drift'))
|
self.assign(parent.attachNewNode('drift'))
|
||||||
self.effect = ParticleEffect.ParticleEffect()
|
self.effect = ParticleEffect.ParticleEffect()
|
||||||
particleSearchPath = DSearchPath()
|
particleSearchPath = DSearchPath()
|
||||||
if AppRunnerGlobal.appRunner:
|
if __debug__:
|
||||||
particleSearchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_3.5/etc'))
|
||||||
else:
|
particleSearchPath.appendDirectory(Filename('resources/phase_4/etc'))
|
||||||
basePath = os.path.expandvars('$TOONTOWN') or './toontown'
|
particleSearchPath.appendDirectory(Filename('resources/phase_5/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/effects'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_6/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_3.5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_7/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_4/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_8/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_9/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_6/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_7/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_8/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_9/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('.'))
|
|
||||||
pfile = Filename('drift.ptf')
|
pfile = Filename('drift.ptf')
|
||||||
found = vfs.resolveFilename(pfile, particleSearchPath)
|
found = vfs.resolveFilename(pfile, particleSearchPath)
|
||||||
if not found:
|
if not found:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
from direct.particles import ParticleEffect
|
from direct.particles import ParticleEffect
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.showbase import AppRunnerGlobal
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class Sparks(NodePath):
|
class Sparks(NodePath):
|
||||||
|
@ -15,19 +14,14 @@ class Sparks(NodePath):
|
||||||
self.assign(parent.attachNewNode('sparks'))
|
self.assign(parent.attachNewNode('sparks'))
|
||||||
self.effect = ParticleEffect.ParticleEffect('Sparks')
|
self.effect = ParticleEffect.ParticleEffect('Sparks')
|
||||||
particleSearchPath = DSearchPath()
|
particleSearchPath = DSearchPath()
|
||||||
if AppRunnerGlobal.appRunner:
|
if __debug__:
|
||||||
particleSearchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_3.5/etc'))
|
||||||
else:
|
particleSearchPath.appendDirectory(Filename('resources/phase_4/etc'))
|
||||||
basePath = os.path.expandvars('$TOONTOWN') or './toontown'
|
particleSearchPath.appendDirectory(Filename('resources/phase_5/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/effects'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_6/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_3.5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_7/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_4/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_8/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_5/etc'))
|
particleSearchPath.appendDirectory(Filename('resources/phase_9/etc'))
|
||||||
particleSearchPath.appendDirectory(Filename('phase_6/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_7/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_8/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('phase_9/etc'))
|
|
||||||
particleSearchPath.appendDirectory(Filename('.'))
|
|
||||||
pfile = Filename('sparks.ptf')
|
pfile = Filename('sparks.ptf')
|
||||||
found = vfs.resolveFilename(pfile, particleSearchPath)
|
found = vfs.resolveFilename(pfile, particleSearchPath)
|
||||||
if not found:
|
if not found:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libtoontown import *
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
from direct.distributed import DistributedObject
|
from direct.distributed import DistributedObject
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
@ -965,7 +966,7 @@ class DistributedRace(DistributedObject.DistributedObject):
|
||||||
def precomputeSideStreets(self):
|
def precomputeSideStreets(self):
|
||||||
farDist = base.camLens.getFar() + 300
|
farDist = base.camLens.getFar() + 300
|
||||||
farDistSquared = farDist * farDist
|
farDistSquared = farDist * farDist
|
||||||
for i in range(self.barricadeSegments):
|
for i in range(int(self.barricadeSegments)):
|
||||||
testPoint = Point3(0, 0, 0)
|
testPoint = Point3(0, 0, 0)
|
||||||
self.curve.getPoint(i / self.barricadeSegments * (self.curve.getMaxT() - 1e-11), testPoint)
|
self.curve.getPoint(i / self.barricadeSegments * (self.curve.getMaxT() - 1e-11), testPoint)
|
||||||
for side in ('innersidest', 'outersidest'):
|
for side in ('innersidest', 'outersidest'):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from libotp import *
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
from direct.interval.IntervalGlobal import *
|
from direct.interval.IntervalGlobal import *
|
||||||
from direct.gui.DirectGui import *
|
from direct.gui.DirectGui import *
|
||||||
|
@ -904,7 +905,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart,
|
||||||
driftMin = self.surfaceModifiers[self.groundType]['driftMin'] * 0.2
|
driftMin = self.surfaceModifiers[self.groundType]['driftMin'] * 0.2
|
||||||
if self.skidding:
|
if self.skidding:
|
||||||
driftMin = self.surfaceModifiers[self.groundType]['driftMin']
|
driftMin = self.surfaceModifiers[self.groundType]['driftMin']
|
||||||
for i in range(numFrames):
|
for i in range(int(numFrames)):
|
||||||
self.physicsMgr.doPhysics(self.physicsDt)
|
self.physicsMgr.doPhysics(self.physicsDt)
|
||||||
curVelocity = self.actorNode.getPhysicsObject().getVelocity()
|
curVelocity = self.actorNode.getPhysicsObject().getVelocity()
|
||||||
idealVelocity = curHeading * curSpeed
|
idealVelocity = curHeading * curSpeed
|
||||||
|
|
|
@ -1,2 +1,12 @@
|
||||||
class Racer:
|
class Racer:
|
||||||
pass
|
|
||||||
|
def __init__(self, race, air, avId, zoneId):
|
||||||
|
self.race = race
|
||||||
|
self.air = air
|
||||||
|
self.avId = avId
|
||||||
|
self.zoneId = zoneId
|
||||||
|
self.avatar = self.air.doId2do.get(self.avId)
|
||||||
|
self.avatar.takeOutKart(self.zoneId)
|
||||||
|
self.kart = self.avatar.kart
|
||||||
|
self.finished = False
|
||||||
|
self.exitEvent = self.air.getAvatarExitEvent(self.avId)
|
||||||
|
|
Loading…
Reference in a new issue