In AIR, implement sendSetLocation. Also change sendActivate workaround to do the SET_FIELDS while in another zone.

This commit is contained in:
Sam Edwards 2014-01-24 06:06:48 -07:00
parent 26e18e2b2b
commit fa8750d2e5
1 changed files with 16 additions and 2 deletions

View File

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