Eject method; bug fix; style

This commit is contained in:
bobbybee 2014-08-14 20:47:28 -04:00
parent 4274450c3f
commit 6e0b6bd622
2 changed files with 18 additions and 8 deletions

View File

@ -422,12 +422,22 @@ class AstronInternalRepository(ConnectionRepository):
dg.addString(str(arg))
self.eventSocket.Send(dg.getMessage())
def setAI(self, doID, aiChannel):
def setAI(self, doId, aiChannel):
"""
Sets the AI of the specified DistributedObjectAI to be the specified channel.
Generally, you should not call this method, and instead call DistributedObjectAI.setAI.
"""
dg = PyDatagram()
dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI)
dg.add_uint64(aiChannel)
self.send(dg)
def eject(self, clientChannel, reasonCode, reason):
"""
Sets the AI of the specified DistributedObjectAI to be the specified channel.
Generally, you should not call this method, and instead call DistributedObjectAI.setAI.
Kicks the client residing at the specified clientChannel, using the specifed reasoning.
"""
dg = PyDatagram()
dg.addServerHeader(doID, aiChannel, MsgTypes.STATESERVER_OBJECT_SET_AI)
dg.add_uint64(aiChannel)
dg.send(dg)
dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_EJECT)
dg.addUint16(reasonCode)
dg.addString(reason)
self.send(dg)

View File

@ -569,6 +569,6 @@ class DistributedObjectAI(DistributedObjectBase):
""" This is a no-op on the AI. """
pass
def setAI(self, aiChannel):
self.air.setAI(self.doId, aiChannel)
def setAI(self, aiChannel):
self.air.setAI(self.doId, aiChannel)