X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/static/git-logo.png?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=c25740bd98f93d174b6f4312147abfa448761052;hb=6cb3a857a09ae974bf0f510dfa94fb19fba2ce31;hp=3a10a4c24e182aa6b72dd6a41ac575bcb2664d0e;hpb=e6a3ab3471ae5a2be10bd64d694eef462d7f7cf6;p=plomrogue2 diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 3a10a4c..c25740b 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -44,7 +44,7 @@ def cmd_ALL(game, msg, connection_id): if not speaker: raise GameError('need to be logged in for this') largest_audible_distance = 20 - dijkstra_map = DijkstraMap(game.maps, speaker.position, + dijkstra_map = DijkstraMap(game.things, game.maps, speaker.position, largest_audible_distance, game.get_map) for c_id in game.sessions: listener = game.get_player(c_id) @@ -79,7 +79,7 @@ def cmd_LOGIN(game, nick, connection_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' @@ -88,6 +88,10 @@ def cmd_LOGIN(game, nick, connection_id): 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'