浏览代码

formatting

Dave Schuyler 21 年之前
父节点
当前提交
38e02dd79c
共有 1 个文件被更改,包括 24 次插入24 次删除
  1. 24 24
      direct/src/controls/GravityWalker.py

+ 24 - 24
direct/src/controls/GravityWalker.py

@@ -26,7 +26,7 @@ class GravityWalker(DirectObject.DirectObject):
     notify = DirectNotifyGlobal.directNotify.newCategory("GravityWalker")
     notify = DirectNotifyGlobal.directNotify.newCategory("GravityWalker")
     wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
     wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
     wantFloorSphere = base.config.GetBool('want-floor-sphere', 0)
     wantFloorSphere = base.config.GetBool('want-floor-sphere', 0)
-    
+
     # special methods
     # special methods
     def __init__(self, gravity = -32.1740, standableGround=0.707,
     def __init__(self, gravity = -32.1740, standableGround=0.707,
             hardLandingForce=16.0):
             hardLandingForce=16.0):
@@ -35,7 +35,7 @@ class GravityWalker(DirectObject.DirectObject):
         self.__gravity=gravity
         self.__gravity=gravity
         self.__standableGround=standableGround
         self.__standableGround=standableGround
         self.__hardLandingForce=hardLandingForce
         self.__hardLandingForce=hardLandingForce
-        
+
         self.mayJump = 1
         self.mayJump = 1
         self.jumpDelayTask = None
         self.jumpDelayTask = None
 
 
@@ -50,18 +50,18 @@ class GravityWalker(DirectObject.DirectObject):
         self.avatarControlReverseSpeed=0
         self.avatarControlReverseSpeed=0
         self.avatarControlRotateSpeed=0
         self.avatarControlRotateSpeed=0
         self.getAirborneHeight=None
         self.getAirborneHeight=None
-        
+
         self.priorParent=Vec3(0)
         self.priorParent=Vec3(0)
         self.__oldPosDelta=Vec3(0)
         self.__oldPosDelta=Vec3(0)
         self.__oldDt=0
         self.__oldDt=0
-        
+
         self.moving=0
         self.moving=0
         self.speed=0.0
         self.speed=0.0
         self.rotationSpeed=0.0
         self.rotationSpeed=0.0
         self.slideSpeed=0.0
         self.slideSpeed=0.0
         self.vel=Vec3(0.0)
         self.vel=Vec3(0.0)
         self.collisionsActive = 0
         self.collisionsActive = 0
-        
+
         self.isAirborne = 0
         self.isAirborne = 0
         self.highMark = 0
         self.highMark = 0
 
 
@@ -71,7 +71,7 @@ class GravityWalker(DirectObject.DirectObject):
             self.doLaterTask.remove()
             self.doLaterTask.remove()
             del self.doLaterTask
             del self.doLaterTask
         #DirectObject.DirectObject.delete(self)
         #DirectObject.DirectObject.delete(self)
-    
+
     """
     """
     def spawnTest(self):
     def spawnTest(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
@@ -80,7 +80,7 @@ class GravityWalker(DirectObject.DirectObject):
         from pandac.PandaModules import *
         from pandac.PandaModules import *
         from direct.interval.IntervalGlobal import *
         from direct.interval.IntervalGlobal import *
         from toontown.coghq import MovingPlatform
         from toontown.coghq import MovingPlatform
-        
+
         if hasattr(self, "platform"):
         if hasattr(self, "platform"):
             # Remove the prior instantiation:
             # Remove the prior instantiation:
             self.moveIval.pause()
             self.moveIval.pause()
@@ -89,7 +89,7 @@ class GravityWalker(DirectObject.DirectObject):
             del self.platform
             del self.platform
             self.platform2.destroy()
             self.platform2.destroy()
             del self.platform2
             del self.platform2
-        
+
         model = loader.loadModelCopy('phase_9/models/cogHQ/platform1')
         model = loader.loadModelCopy('phase_9/models/cogHQ/platform1')
         fakeId = id(self)
         fakeId = id(self)
         self.platform = MovingPlatform.MovingPlatform()
         self.platform = MovingPlatform.MovingPlatform()
@@ -292,14 +292,14 @@ class GravityWalker(DirectObject.DirectObject):
             walks under a ledge that is <= floorOffset above the ground (a
             walks under a ledge that is <= floorOffset above the ground (a
             double floor situation), the avatar will step up on to the
             double floor situation), the avatar will step up on to the
             ledge (instantly).
             ledge (instantly).
-        
+
         Set up the avatar collisions
         Set up the avatar collisions
         """
         """
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
-        
+
         assert not avatarNodePath.isEmpty()
         assert not avatarNodePath.isEmpty()
         self.avatarNodePath = avatarNodePath
         self.avatarNodePath = avatarNodePath
-        
+
         self.cTrav = collisionTraverser
         self.cTrav = collisionTraverser
 
 
         self.setupRay(self.floorBitmask, floorOffset, reach )
         self.setupRay(self.floorBitmask, floorOffset, reach )
@@ -342,14 +342,14 @@ class GravityWalker(DirectObject.DirectObject):
         # del self.pusherFloor
         # del self.pusherFloor
         del self.event
         del self.event
         del self.lifter
         del self.lifter
-        
+
         del self.getAirborneHeight
         del self.getAirborneHeight
 
 
     def setCollisionsActive(self, active = 1):
     def setCollisionsActive(self, active = 1):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         if self.collisionsActive != active:
         if self.collisionsActive != active:
             self.collisionsActive = active
             self.collisionsActive = active
-            # Each time we change the collision geometry, make one 
+            # Each time we change the collision geometry, make one
             # more pass to ensure we aren't standing in a wall.
             # more pass to ensure we aren't standing in a wall.
             self.oneTimeCollide()
             self.oneTimeCollide()
             if active:
             if active:
@@ -374,11 +374,11 @@ class GravityWalker(DirectObject.DirectObject):
         assert(self.debugPrint("getCollisionsActive() returning=%s"%(
         assert(self.debugPrint("getCollisionsActive() returning=%s"%(
             self.collisionsActive,)))
             self.collisionsActive,)))
         return self.collisionsActive
         return self.collisionsActive
-    
+
     def placeOnFloor(self):
     def placeOnFloor(self):
         """
         """
         Make a reasonable effor to place the avatar on the ground.
         Make a reasonable effor to place the avatar on the ground.
-        For example, this is useful when switching away from the 
+        For example, this is useful when switching away from the
         current walker.
         current walker.
         """
         """
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
@@ -426,7 +426,7 @@ class GravityWalker(DirectObject.DirectObject):
         For debug use.
         For debug use.
         """
         """
         onScreenDebug.add("w controls", "GravityWalker")
         onScreenDebug.add("w controls", "GravityWalker")
-        
+
         onScreenDebug.add("w airborneHeight", self.lifter.getAirborneHeight())
         onScreenDebug.add("w airborneHeight", self.lifter.getAirborneHeight())
         onScreenDebug.add("w falling", self.falling)
         onScreenDebug.add("w falling", self.falling)
         onScreenDebug.add("w isOnGround", self.lifter.isOnGround())
         onScreenDebug.add("w isOnGround", self.lifter.isOnGround())
@@ -452,18 +452,18 @@ class GravityWalker(DirectObject.DirectObject):
         slide = 0 #hack -- was: inputState.isSet("slide")
         slide = 0 #hack -- was: inputState.isSet("slide")
         jump = inputState.isSet("jump")
         jump = inputState.isSet("jump")
         # Determine what the speeds are based on the buttons:
         # Determine what the speeds are based on the buttons:
-        self.speed=(forward and self.avatarControlForwardSpeed or 
+        self.speed=(forward and self.avatarControlForwardSpeed or
                     reverse and -self.avatarControlReverseSpeed)
                     reverse and -self.avatarControlReverseSpeed)
         #if run and self.speed>0.0:
         #if run and self.speed>0.0:
         #    self.speed*=2.0 #*#
         #    self.speed*=2.0 #*#
         # Should fSlide be renamed slideButton?
         # Should fSlide be renamed slideButton?
         self.slideSpeed=slide and (
         self.slideSpeed=slide and (
-                (turnLeft and -self.avatarControlForwardSpeed) or 
+                (turnLeft and -self.avatarControlForwardSpeed) or
                 (turnRight and self.avatarControlForwardSpeed))
                 (turnRight and self.avatarControlForwardSpeed))
         self.rotationSpeed=not slide and (
         self.rotationSpeed=not slide and (
                 (turnLeft and self.avatarControlRotateSpeed) or
                 (turnLeft and self.avatarControlRotateSpeed) or
                 (turnRight and -self.avatarControlRotateSpeed))
                 (turnRight and -self.avatarControlRotateSpeed))
-        
+
         if __debug__:
         if __debug__:
             debugRunning = inputState.isSet("debugRunning")
             debugRunning = inputState.isSet("debugRunning")
             if debugRunning:
             if debugRunning:
@@ -516,7 +516,7 @@ class GravityWalker(DirectObject.DirectObject):
             rotation = dt * self.rotationSpeed
             rotation = dt * self.rotationSpeed
 
 
             # Take a step in the direction of our previous heading.
             # Take a step in the direction of our previous heading.
-            self.vel=Vec3(Vec3.forward() * distance + 
+            self.vel=Vec3(Vec3.forward() * distance +
                           Vec3.right() * slideDistance)
                           Vec3.right() * slideDistance)
             if self.vel != Vec3.zero() or self.priorParent != Vec3.zero():
             if self.vel != Vec3.zero() or self.priorParent != Vec3.zero():
                 if 1:
                 if 1:
@@ -561,11 +561,11 @@ class GravityWalker(DirectObject.DirectObject):
         if self.moving or jump:
         if self.moving or jump:
             messenger.send("avatarMoving")
             messenger.send("avatarMoving")
         return Task.cont
         return Task.cont
-    
+
     def doDeltaPos(self):
     def doDeltaPos(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         self.needToDeltaPos = 1
         self.needToDeltaPos = 1
-    
+
     def setPriorParentVector(self):
     def setPriorParentVector(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         if __debug__:
         if __debug__:
@@ -577,7 +577,7 @@ class GravityWalker(DirectObject.DirectObject):
         if __debug__:
         if __debug__:
             if self.wantDebugIndicator:
             if self.wantDebugIndicator:
                 onScreenDebug.add("priorParent", self.priorParent.pPrintValues())
                 onScreenDebug.add("priorParent", self.priorParent.pPrintValues())
-    
+
     def reset(self):
     def reset(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         self.lifter.setVelocity(0.0)
         self.lifter.setVelocity(0.0)
@@ -628,7 +628,7 @@ class GravityWalker(DirectObject.DirectObject):
         if __debug__:
         if __debug__:
             self.ignore("control-f3") #*#
             self.ignore("control-f3") #*#
 
 
-    
+
     if __debug__:
     if __debug__:
         def debugPrint(self, message):
         def debugPrint(self, message):
             """for debugging"""
             """for debugging"""