From fa8750d2e5e04398944b7d2c9179da3f2d526cd0 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 24 Jan 2014 06:06:48 -0700 Subject: [PATCH] In AIR, implement sendSetLocation. Also change sendActivate workaround to do the SET_FIELDS while in another zone. --- .../distributed/AstronInternalRepository.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index 9ae17b9289..c04d9c168c 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -260,8 +260,8 @@ class AstronInternalRepository(ConnectionRepository): dg = PyDatagram() dg.addServerHeader(doId, self.ourChannel, DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS) dg.addUint32(doId) - dg.addUint32(parentId) - dg.addUint32(zoneId) + dg.addUint32(0) + dg.addUint32(0) self.send(dg) # DEFAULTS_OTHER isn't implemented yet, so we chase it with a SET_FIELDS dg = PyDatagram() @@ -270,6 +270,13 @@ class AstronInternalRepository(ConnectionRepository): dg.addUint16(fieldCount) dg.appendData(fieldPacker.getString()) self.send(dg) + # Now slide it into the zone we expect to see it in (so it + # generates onto us with all of the fields in place) + dg = PyDatagram() + dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_LOCATION) + dg.addUint32(parentId) + dg.addUint32(zoneId) + self.send(dg) else: dg = PyDatagram() dg.addServerHeader(doId, self.ourChannel, DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS) @@ -278,6 +285,13 @@ class AstronInternalRepository(ConnectionRepository): dg.addUint32(zoneId) self.send(dg) + def sendSetLocation(self, do, parentId, zoneId): + dg = PyDatagram() + dg.addServerHeader(do.doId, self.ourChannel, STATESERVER_OBJECT_SET_LOCATION) + dg.addUint32(parentId) + dg.addUint32(zoneId) + self.send(dg) + def generateWithRequired(self, do, parentId, zoneId, optionalFields=[]): """ Generate an object onto the State Server, choosing an ID from the pool.