Przeglądaj źródła

fix diagonal-running speed exploit

Darren Ranalli 17 lat temu
rodzic
commit
f3fe23c877
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      direct/src/controls/GravityWalker.py

+ 6 - 0
direct/src/controls/GravityWalker.py

@@ -28,6 +28,8 @@ class GravityWalker(DirectObject.DirectObject):
     wantFloorSphere = base.config.GetBool('want-floor-sphere', 0)
     earlyEventSphere = base.config.GetBool('early-event-sphere', 0)
 
+    DiagonalFactor = math.sqrt(2.) / 2.
+
     # special methods
     def __init__(self, gravity = -32.1740, standableGround=0.707,
             hardLandingForce=16.0):
@@ -502,6 +504,10 @@ class GravityWalker(DirectObject.DirectObject):
                 (turnLeft and self.avatarControlRotateSpeed) or
                 (turnRight and -self.avatarControlRotateSpeed))
 
+        if self.speed and self.slideSpeed:
+            self.speed *= GravityWalker.DiagonalFactor
+            self.slideSpeed *= GravityWalker.DiagonalFactor
+
         debugRunning = inputState.isSet("debugRunning")
         if(debugRunning):
             self.speed*=base.debugRunningMultiplier