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

This commit is contained in:
Roger Hughston 2007-05-09 00:53:55 +00:00
parent a9259e8964
commit 9a23134a7e
1 changed files with 14 additions and 5 deletions

View File

@ -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)