if not speaker:
raise GameError('need to be logged in for this')
largest_audible_distance = 20
- dijkstra_map = DijkstraMap(game.maps, speaker.position,
+ things = [t for t in game.things if t.type_ != 'Player']
+ dijkstra_map = DijkstraMap(things, game.maps, speaker.position,
largest_audible_distance, game.get_map)
for c_id in game.sessions:
listener = game.get_player(c_id)
t = game.thing_types['Player'](game)
t.position = game.spawn_point
game.things += [t] # TODO refactor into Thing.__init__?
- t.player_char = game.get_next_player_char()
+ t.thing_char = game.get_next_player_char()
game.sessions[connection_id] = {
'thing_id': t.id_,
'status': 'player'
t.name = nick
game.io.send('CHAT ' + quote(t.name + ' entered the map.'))
game.io.send('PLAYER_ID %s' % t.id_, connection_id)
+ for s in [s for s in game.things
+ if s.type_ == 'SpawnPoint' and s.name == t.name]:
+ t.position = s.position
+ break
game.changed = True
cmd_LOGIN.argtypes = 'string'
raise GameError('thing of ID %s not found' % thing_id)
t.protection = protection_char
cmd_GOD_THING_PROTECTION.argtypes = 'int:pos char'
+
+def cmd_THING_DOOR_CLOSED(game, thing_id):
+ t = game.get_thing(thing_id)
+ if not t:
+ raise GameError('thing of ID %s not found' % thing_id)
+ if not t.type_ == 'Door':
+ raise GameError('thing of ID %s not door' % thing_id)
+ t.blocking = True
+ t.portable = False
+ t.thing_char = '#'
+cmd_THING_DOOR_CLOSED.argtypes = 'int:pos'