passthrough in control manager

This commit is contained in:
John Loehrlein 2007-08-14 17:54:40 +00:00
parent f481109861
commit 34b7599b6f

View File

@ -21,7 +21,8 @@ class ControlManager:
wantAvatarPhysicsDebug = base.config.GetBool('want-avatar-physics-debug', 0)
wantWASD = base.config.GetBool('want-WASD', 0)
def __init__(self, enable=True):
def __init__(self, enable=True, passMessagesThrough = False):
print ("init control manager %s" % (passMessagesThrough))
assert self.notify.debugCall(id(self))
self.inputStateTokens = []
self.WASDTurnTokens = []
@ -34,6 +35,17 @@ class ControlManager:
#self.monitorTask = taskMgr.add(self.monitor, "ControlManager-%s"%(id(self)), priority=-1)
self.forceAvJumpToken = None
self.passMessagesThrough = passMessagesThrough
if self.passMessagesThrough: # for not breaking toontown
self.inputStateTokens = []
ist=self.inputStateTokens
ist.append(inputState.watchWithModifiers("forward", "arrow_up", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("reverse", "arrow_down", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("turnLeft", "arrow_left", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("turnRight", "arrow_right", inputSource=inputState.ArrowKeys))
def __str__(self):
return 'ControlManager: using \'%s\'' % self.currentControlsName
@ -246,6 +258,14 @@ class ControlManager:
if self.currentControls:
self.currentControls.disableAvatarControls()
if self.passMessagesThrough: # for not breaking toontown
self.inputStateTokens = []
ist=self.inputStateTokens
ist.append(inputState.watchWithModifiers("forward", "arrow_up", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("reverse", "arrow_down", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("turnLeft", "arrow_left", inputSource=inputState.ArrowKeys))
ist.append(inputState.watchWithModifiers("turnRight", "arrow_right", inputSource=inputState.ArrowKeys))
def stop(self):
self.disable()
if self.currentControls: