mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
passthrough in control manager
This commit is contained in:
parent
f481109861
commit
34b7599b6f
@ -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 = []
|
||||
@ -33,6 +34,17 @@ class ControlManager:
|
||||
self.enable()
|
||||
#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
|
||||
@ -245,6 +257,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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user