maybe fixing AI crash with orphand doLater

This commit is contained in:
Dave Schuyler 2003-12-02 01:45:53 +00:00
parent 973d3d81cc
commit 6a636ddc9e
3 changed files with 12 additions and 7 deletions

View File

@ -137,6 +137,9 @@ class FourStateAI:
def delete(self): def delete(self):
assert(self.debugPrint("delete()")) assert(self.debugPrint("delete()"))
if self.doLaterTask is not None:
self.doLaterTask.remove()
del self.doLaterTask
del self.states del self.states
del self.fsm del self.fsm

View File

@ -57,7 +57,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
# Set up the collision sphere # Set up the collision sphere
# This is a sphere on the ground to detect barrier collisions # This is a sphere on the ground to detect barrier collisions
self.cSphere = CollisionSphere(0.0, 0.0, 0.0, avatarRadius) self.cSphere = CollisionSphere(0.0, 0.0, 0.0, avatarRadius)
cSphereNode = CollisionNode('cSphereNode') cSphereNode = CollisionNode('NPW.cSphereNode')
cSphereNode.addSolid(self.cSphere) cSphereNode.addSolid(self.cSphere)
self.cSphereNodePath = avatarNodePath.attachNewNode(cSphereNode) self.cSphereNodePath = avatarNodePath.attachNewNode(cSphereNode)
self.cSphereBitMask = wallCollideMask self.cSphereBitMask = wallCollideMask
@ -69,7 +69,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
# This is a ray cast from your head down to detect floor polygons # This is a ray cast from your head down to detect floor polygons
# A toon is about 4.0 feet high, so start it there # A toon is about 4.0 feet high, so start it there
self.cRay = CollisionRay(0.0, 0.0, 4.0, 0.0, 0.0, -1.0) self.cRay = CollisionRay(0.0, 0.0, 4.0, 0.0, 0.0, -1.0)
cRayNode = CollisionNode('cRayNode') cRayNode = CollisionNode('NPW.cRayNode')
cRayNode.addSolid(self.cRay) cRayNode.addSolid(self.cRay)
self.cRayNodePath = avatarNodePath.attachNewNode(cRayNode) self.cRayNodePath = avatarNodePath.attachNewNode(cRayNode)
self.cRayBitMask = floorCollideMask self.cRayBitMask = floorCollideMask
@ -93,12 +93,12 @@ class NonPhysicsWalker(DirectObject.DirectObject):
# from 8.0 to 16.0 to prevent this # from 8.0 to 16.0 to prevent this
self.lifter.setMaxVelocity(16.0) self.lifter.setMaxVelocity(16.0)
# activate the collider with the traverser and pusher
self.setCollisionsActive(1)
self.pusher.addCollider(self.cSphereNodePath, avatarNodePath) self.pusher.addCollider(self.cSphereNodePath, avatarNodePath)
self.lifter.addCollider(self.cRayNodePath, avatarNodePath) self.lifter.addCollider(self.cRayNodePath, avatarNodePath)
# activate the collider with the traverser and pusher
self.setCollisionsActive(1)
def setAirborneHeightFunc(self, getAirborneHeight): def setAirborneHeightFunc(self, getAirborneHeight):
self.getAirborneHeight = getAirborneHeight self.getAirborneHeight = getAirborneHeight
@ -130,6 +130,8 @@ class NonPhysicsWalker(DirectObject.DirectObject):
# Now that we have disabled collisions, make one more pass # Now that we have disabled collisions, make one more pass
# right now to ensure we aren't standing in a wall. # right now to ensure we aren't standing in a wall.
self.oneTimeCollide() self.oneTimeCollide()
print " cTrav.ls()" #*#
print self.cTrav #*#
def oneTimeCollide(self): def oneTimeCollide(self):
""" """

View File

@ -119,7 +119,7 @@ class PhysicsWalker(DirectObject.DirectObject):
# This is a ray cast from your head down to detect floor polygons # This is a ray cast from your head down to detect floor polygons
# A toon is about 4.0 feet high, so start it there # A toon is about 4.0 feet high, so start it there
self.cRay = CollisionRay(0.0, 0.0, 4.0, 0.0, 0.0, -1.0) self.cRay = CollisionRay(0.0, 0.0, 4.0, 0.0, 0.0, -1.0)
cRayNode = CollisionNode('cRayNode') cRayNode = CollisionNode('PW.cRayNode')
cRayNode.addSolid(self.cRay) cRayNode.addSolid(self.cRay)
self.cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode) self.cRayNodePath = self.avatarNodePath.attachNewNode(cRayNode)
self.cRayBitMask = floorBitmask self.cRayBitMask = floorBitmask
@ -189,7 +189,7 @@ class PhysicsWalker(DirectObject.DirectObject):
if self.useHeightRay: if self.useHeightRay:
centerHeight *= 2.0 centerHeight *= 2.0
self.cSphere = CollisionSphere(0.0, 0.0, centerHeight, avatarRadius) self.cSphere = CollisionSphere(0.0, 0.0, centerHeight, avatarRadius)
cSphereNode = CollisionNode('cSphereNode') cSphereNode = CollisionNode('PW.cSphereNode')
cSphereNode.addSolid(self.cSphere) cSphereNode.addSolid(self.cSphere)
self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode) self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
self.cSphereBitMask = bitmask self.cSphereBitMask = bitmask