mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
generate global object
This commit is contained in:
parent
c0a68a536f
commit
0985f1d169
@ -335,6 +335,18 @@ class DistributedObjectAI(DirectObject.DirectObject):
|
|||||||
self.generate()
|
self.generate()
|
||||||
|
|
||||||
if wantOtpServer:
|
if wantOtpServer:
|
||||||
|
def generateGlobalObject(self, parentId, zoneId, doId):
|
||||||
|
assert self.notify.debugStateCall(self)
|
||||||
|
self.doId = doId
|
||||||
|
# Put the new DO in the dictionaries
|
||||||
|
self.air.addDOToTables(self, location=(parentId,zoneId))
|
||||||
|
|
||||||
|
assert not hasattr(self, 'parentId')
|
||||||
|
self.parentId = parentId
|
||||||
|
self.zoneId = zoneId
|
||||||
|
self.__location = (parentId, zoneId)
|
||||||
|
self.generate()
|
||||||
|
|
||||||
def generateOtpObject(self, parentId, zoneId, optionalFields=[], doId=None):
|
def generateOtpObject(self, parentId, zoneId, optionalFields=[], doId=None):
|
||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
# have we already allocated a doId?
|
# have we already allocated a doId?
|
||||||
@ -342,8 +354,17 @@ class DistributedObjectAI(DirectObject.DirectObject):
|
|||||||
assert doId is None or doId == self.__preallocDoId
|
assert doId is None or doId == self.__preallocDoId
|
||||||
doId=self.__preallocDoId
|
doId=self.__preallocDoId
|
||||||
self.__preallocDoId = 0
|
self.__preallocDoId = 0
|
||||||
self.air.sendGenerateOtpObject(
|
|
||||||
self, parentId, zoneId, optionalFields, doId=doId)
|
# Assign it an id
|
||||||
|
if doId is None:
|
||||||
|
self.doId = self.air.allocateChannel()
|
||||||
|
else:
|
||||||
|
self.doId = doId
|
||||||
|
# Put the new DO in the dictionaries
|
||||||
|
self.air.addDOToTables(self, location=(parentId,zoneId))
|
||||||
|
# Send a generate message
|
||||||
|
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
|
||||||
|
|
||||||
assert not hasattr(self, 'parentId')
|
assert not hasattr(self, 'parentId')
|
||||||
self.parentId = parentId
|
self.parentId = parentId
|
||||||
self.zoneId = zoneId
|
self.zoneId = zoneId
|
||||||
@ -376,9 +397,6 @@ class DistributedObjectAI(DirectObject.DirectObject):
|
|||||||
|
|
||||||
def sendGenerateWithRequired(self, repository, parentId, zoneId, optionalFields=[]):
|
def sendGenerateWithRequired(self, repository, parentId, zoneId, optionalFields=[]):
|
||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
if not wantOtpServer:
|
|
||||||
parentId = 0
|
|
||||||
# Make the dclass do the hard work
|
|
||||||
if not wantOtpServer:
|
if not wantOtpServer:
|
||||||
dg = self.dclass.aiFormatGenerate(
|
dg = self.dclass.aiFormatGenerate(
|
||||||
self, self.doId, 0, zoneId,
|
self, self.doId, 0, zoneId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user