#NEWLINE# @ tornado . gen . coroutine #NEWLINE# def find_locale_players( self , uid = None , notself = False ) : #NEWLINE# #INDENT# 'Generate a list of all players in the same location as a given\n        player. If no player is given, we presume the player that triggered\n        the current event. (Which means that for server events, you must\n        specify a uid or get None.)\n        If notself is true, the list excludes the given player.\n        ' #NEWLINE# if ( uid is None ) : #NEWLINE# #INDENT# conn = self . app . playconns . get ( self . connid ) #NEWLINE# if ( not conn ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# uid = conn . uid #NEWLINE# #UNINDENT# playstate = ( yield motor . Op ( self . app . mongodb . playstate . find_one , { #NEWLINE# #INDENT# '_id' : uid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'iid' : 1 , #NEWLINE# 'locid' : 1 , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# if ( not playstate ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# iid = playstate [ 'iid' ] #NEWLINE# if ( not iid ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# locid = playstate [ 'locid' ] #NEWLINE# if ( not locid ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# cursor = self . app . mongodb . playstate . find ( { #NEWLINE# #INDENT# 'iid' : iid , #NEWLINE# 'locid' : locid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# people = [ ] #NEWLINE# while ( yield cursor . fetch_next ) : #NEWLINE# #INDENT# ostate = cursor . next_object ( ) #NEWLINE# if ( notself and ( ostate [ '_id' ] == uid ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# people . append ( ostate [ '_id' ] ) #NEWLINE# #UNINDENT# return people