Browse Source

Modified sone Ai's to not always listen do the DOID channel.. This supports a Ai being a client to another AI

Roger Hughston 18 years ago
parent
commit
9a23134a7e
1 changed files with 14 additions and 5 deletions
  1. 14 5
      direct/src/distributed/DistributedObjectGlobalAI.py

+ 14 - 5
direct/src/distributed/DistributedObjectGlobalAI.py

@@ -1,5 +1,4 @@
 
-
 from DistributedObjectAI import DistributedObjectAI
 from direct.directnotify.DirectNotifyGlobal import directNotify
 
@@ -14,14 +13,24 @@ class DistributedObjectGlobalAI(DistributedObjectAI):
     doNotDeallocateChannel = 1
     isGlobalDistObj = 1
 
-    def __init__(self, air):
+    def __init__(self, air): 
         DistributedObjectAI.__init__(self, air)
 
     def announceGenerate(self):
-        self.air.registerForChannel(self.doId)
         DistributedObjectAI.announceGenerate(self)
+        try:
+            if not self.doNotListenToChannel:
+                self.air.registerForChannel(self.doId)            
+        except AttributeError:
+                self.air.registerForChannel(self.doId)            
+        return False        
 
     def delete(self):
-        self.air.unregisterForChannel(self.doId)
+       DistributedObjectAI.delete(self)
+       try:
+            if not self.doNotListenToChannel:
+               self.air.unregisterForChannel(self.doId)
+       except AttributeError:
+           self.air.unregisterForChannel(self.doId)
         ## self.air.removeDOFromTables(self)
-        DistributedObjectAI.delete(self)
+