Browse Source

write messenger wrappers to ensure that the distributedObject is referencing the messenger object created by its own air

Samir Naik 20 years ago
parent
commit
6763aa46fa
1 changed files with 20 additions and 0 deletions
  1. 20 0
      direct/src/distributed/DistributedObjectAI.py

+ 20 - 0
direct/src/distributed/DistributedObjectAI.py

@@ -478,3 +478,23 @@ class DistributedObjectAI(DirectObject.DirectObject):
         # If this distributed object is a DistributedGrid return 1.  0 by default
         # If this distributed object is a DistributedGrid return 1.  0 by default
         return 0
         return 0
 
 
+    # Wrapper functions to have a cleaner, more object oriented approach to
+    # the messenger functionality.
+
+    def accept(self, event, method, extraArgs=[]):
+        return self.air.messenger.accept(event, self, method, extraArgs, 1)
+
+    def acceptOnce(self, event, method, extraArgs=[]):
+        return self.air.messenger.accept(event, self, method, extraArgs, 0)
+
+    def ignore(self, event):
+        return self.air.messenger.ignore(event, self)
+
+    def ignoreAll(self):
+        return self.air.messenger.ignoreAll(self)
+
+    def isAccepting(self, event):
+        return self.air.messenger.isAccepting(event, self)
+
+    def isIgnoring(self, event):
+        return self.air.messenger.isIgnoring(event, self)