fix diagonal-running speed exploit

This commit is contained in:
Darren Ranalli 2008-07-25 20:45:15 +00:00
parent 63f0e86da0
commit f3fe23c877

View File

@ -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