Browse Source

ships now have their own control manager that the avatar uses when he takes the wheel

Josh Wilson 19 years ago
parent
commit
6e32e478cf
2 changed files with 172 additions and 576 deletions
  1. 11 3
      direct/src/controls/ControlManager.py
  2. 161 573
      direct/src/controls/ShipPilot.py

+ 11 - 3
direct/src/controls/ControlManager.py

@@ -13,7 +13,6 @@ from direct.directnotify import DirectNotifyGlobal
 #if __debug__:
 #    import DevWalker
 from direct.task import Task
-
 CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a line instead of a ray.
 
 class ControlManager:
@@ -162,6 +161,7 @@ class ControlManager:
     def delete(self):
         assert self.notify.debugCall(id(self))
         self.disable()
+        # TODO: put controls delete code in here
         del self.controls
         del self.currentControls
 
@@ -201,13 +201,21 @@ class ControlManager:
     def enable(self):
         assert self.notify.debugCall(id(self))
         self.isEnabled = 1
-        self.currentControls.enableAvatarControls()
+        if self.currentControls:
+            self.currentControls.enableAvatarControls()
 
     def disable(self):
         assert self.notify.debugCall(id(self))
         self.isEnabled = 0
-        self.currentControls.disableAvatarControls()
+        if self.currentControls:
+            self.currentControls.disableAvatarControls()
 
+    def stop(self):
+        self.disable()
+        self.currentControls.setCollisionsActive(0)
+        self.currentControls.setAvatar(None)
+        self.currentControls = None
+        
     def disableAvatarJump(self):
         """
         prevent 

File diff suppressed because it is too large
+ 161 - 573
direct/src/controls/ShipPilot.py


Some files were not shown because too many files changed in this diff