mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
comment
This commit is contained in:
parent
850170e393
commit
09d6501c76
@ -15,7 +15,11 @@ ESGenerating = 5 # values here and greater are considered "generated"
|
|||||||
ESGenerated = 6
|
ESGenerated = 6
|
||||||
|
|
||||||
class DistributedObject(PandaObject):
|
class DistributedObject(PandaObject):
|
||||||
"""Distributed Object class:"""
|
"""
|
||||||
|
The Distributed Object class is the base class for all network based
|
||||||
|
(i.e. distributed) objects. These will usually (always?) have a
|
||||||
|
dclass entry in a *.dc file.
|
||||||
|
"""
|
||||||
notify = directNotify.newCategory("DistributedObject")
|
notify = directNotify.newCategory("DistributedObject")
|
||||||
|
|
||||||
# A few objects will set neverDisable to 1... Examples are
|
# A few objects will set neverDisable to 1... Examples are
|
||||||
@ -182,7 +186,7 @@ class DistributedObject(PandaObject):
|
|||||||
self.DistributedObject_deleted = 1
|
self.DistributedObject_deleted = 1
|
||||||
self.cr = None
|
self.cr = None
|
||||||
self.dclass = None
|
self.dclass = None
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
"""
|
"""
|
||||||
Inheritors should redefine this to take appropriate action on generate
|
Inheritors should redefine this to take appropriate action on generate
|
||||||
@ -196,17 +200,17 @@ class DistributedObject(PandaObject):
|
|||||||
to the world... Not when it is pulled from the cache.
|
to the world... Not when it is pulled from the cache.
|
||||||
"""
|
"""
|
||||||
self.activeState = ESGenerating
|
self.activeState = ESGenerating
|
||||||
|
|
||||||
def getDoId(self):
|
def getDoId(self):
|
||||||
"""
|
"""
|
||||||
Return the distributed object id
|
Return the distributed object id
|
||||||
"""
|
"""
|
||||||
return self.doId
|
return self.doId
|
||||||
|
|
||||||
def updateRequiredFields(self, dclass, di):
|
def updateRequiredFields(self, dclass, di):
|
||||||
dclass.receiveUpdateBroadcastRequired(self, di)
|
dclass.receiveUpdateBroadcastRequired(self, di)
|
||||||
self.announceGenerate()
|
self.announceGenerate()
|
||||||
|
|
||||||
def updateAllRequiredFields(self, dclass, di):
|
def updateAllRequiredFields(self, dclass, di):
|
||||||
dclass.receiveUpdateAllRequired(self, di)
|
dclass.receiveUpdateAllRequired(self, di)
|
||||||
self.announceGenerate()
|
self.announceGenerate()
|
||||||
@ -233,7 +237,7 @@ class DistributedObject(PandaObject):
|
|||||||
|
|
||||||
def taskName(self, taskString):
|
def taskName(self, taskString):
|
||||||
return (taskString + "-" + str(self.getDoId()))
|
return (taskString + "-" + str(self.getDoId()))
|
||||||
|
|
||||||
def uniqueName(self, idString):
|
def uniqueName(self, idString):
|
||||||
return (idString + "-" + str(self.getDoId()))
|
return (idString + "-" + str(self.getDoId()))
|
||||||
|
|
||||||
@ -292,7 +296,7 @@ class DistributedObject(PandaObject):
|
|||||||
del self.__callbacks[context]
|
del self.__callbacks[context]
|
||||||
else:
|
else:
|
||||||
self.notify.warning("Got unexpected context from AI: %s" % (context))
|
self.notify.warning("Got unexpected context from AI: %s" % (context))
|
||||||
|
|
||||||
def setBarrierData(self, data):
|
def setBarrierData(self, data):
|
||||||
# This message is sent by the AI to tell us the barriers and
|
# This message is sent by the AI to tell us the barriers and
|
||||||
# avIds for which the AI is currently waiting. The client
|
# avIds for which the AI is currently waiting. The client
|
||||||
@ -307,10 +311,10 @@ class DistributedObject(PandaObject):
|
|||||||
self.__barrierContext = (context, name)
|
self.__barrierContext = (context, name)
|
||||||
assert(self.notify.debug('setBarrierData(%s, %s)' % (context, name)))
|
assert(self.notify.debug('setBarrierData(%s, %s)' % (context, name)))
|
||||||
return
|
return
|
||||||
|
|
||||||
assert(self.notify.debug('setBarrierData(%s)' % (None)))
|
assert(self.notify.debug('setBarrierData(%s)' % (None)))
|
||||||
self.__barrierContext = None
|
self.__barrierContext = None
|
||||||
|
|
||||||
def doneBarrier(self, name = None):
|
def doneBarrier(self, name = None):
|
||||||
# Tells the AI we have finished handling our task. If the
|
# Tells the AI we have finished handling our task. If the
|
||||||
# optional name parameter is specified, it must match the
|
# optional name parameter is specified, it must match the
|
||||||
@ -332,11 +336,11 @@ class DistributedObject(PandaObject):
|
|||||||
assert(self.notify.debug('doneBarrier(%s) ignored; current barrier is %s' % (name, aiName)))
|
assert(self.notify.debug('doneBarrier(%s) ignored; current barrier is %s' % (name, aiName)))
|
||||||
else:
|
else:
|
||||||
assert(self.notify.debug('doneBarrier(%s) ignored; no active barrier.' % (name)))
|
assert(self.notify.debug('doneBarrier(%s) ignored; no active barrier.' % (name)))
|
||||||
|
|
||||||
if wantOtpServer:
|
if wantOtpServer:
|
||||||
def addInterest(self, zoneId, note="", event=None):
|
def addInterest(self, zoneId, note="", event=None):
|
||||||
self.cr.addInterest(self.getDoId(), zoneId, note, event)
|
self.cr.addInterest(self.getDoId(), zoneId, note, event)
|
||||||
|
|
||||||
def setLocation(self, parentId, zoneId):
|
def setLocation(self, parentId, zoneId):
|
||||||
# The store must run first so we know the old location
|
# The store must run first so we know the old location
|
||||||
self.cr.storeObjectLocation(self.doId, parentId, zoneId)
|
self.cr.storeObjectLocation(self.doId, parentId, zoneId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user