From 9a23134a7efab3ede099f6a99e7f9bfa3fe21d85 Mon Sep 17 00:00:00 2001 From: Roger Hughston Date: Wed, 9 May 2007 00:53:55 +0000 Subject: [PATCH] Modified sone Ai's to not always listen do the DOID channel.. This supports a Ai being a client to another AI --- .../distributed/DistributedObjectGlobalAI.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/direct/src/distributed/DistributedObjectGlobalAI.py b/direct/src/distributed/DistributedObjectGlobalAI.py index 15c888d076..ba93c688ab 100755 --- a/direct/src/distributed/DistributedObjectGlobalAI.py +++ b/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) + \ No newline at end of file