listener_vol = dijkstra_map[game.map.get_position_index(listener.position)]
volume = 1 / max(1, listener_vol)
lowered_msg = lower_msg_by_volume(msg, volume)
- lowered_nick = lower_msg_by_volume(speaker.nickname, volume)
+ lowered_nick = lower_msg_by_volume(speaker.name, volume)
game.io.send('CHAT ' +
quote('(volume: %.2f) %s: %s' % (volume, lowered_nick,
lowered_msg)),
cmd_ALL.argtypes = 'string'
def cmd_LOGIN(game, nick, connection_id):
- for t in [t for t in game.things if t.type_ == 'Player' and t.nickname == nick]:
+ for t in [t for t in game.things if t.type_ == 'Player' and t.name == nick]:
raise GameError('name already in use')
if connection_id in game.sessions:
raise GameError('cannot log in twice')
t.player_char = game.get_next_player_char()
game.sessions[connection_id] = t.id_
game.io.send('LOGIN_OK', connection_id)
- t.nickname = nick
- game.io.send('CHAT ' + quote(t.nickname + ' entered the map.'))
+ t.name = nick
+ game.io.send('CHAT ' + quote(t.name + ' entered the map.'))
game.io.send('PLAYER_ID %s' % t.id_, connection_id)
game.changed = True
cmd_LOGIN.argtypes = 'string'
def cmd_NICK(game, nick, connection_id):
- for t in [t for t in game.things if t.type_ == 'Player' and t.nickname == nick]:
+ for t in [t for t in game.things if t.type_ == 'Player' and t.name == nick]:
raise GameError('name already in use')
if not connection_id in game.sessions:
raise GameError('can only rename when already logged in')
t_id = game.sessions[connection_id]
t = game.get_thing(t_id)
- old_nick = t.nickname
- t.nickname = nick
+ old_nick = t.name
+ t.name = nick
game.io.send('CHAT ' + quote(old_nick + ' renamed themselves to ' + nick))
game.changed = True
cmd_NICK.argtypes = 'string'
# if not connection_id in game.sessions:
# raise GameError('can only query when logged in')
# t = game.get_thing(game.sessions[connection_id], False)
-# source_nick = t.nickname
-# for t in [t for t in game.things if t.type_ == 'Player' and t.nickname == target_nick]:
+# source_nick = t.name
+# for t in [t for t in game.things if t.type_ == 'Player' and t.name == target_nick]:
# for c_id in game.sessions:
# if game.sessions[c_id] == t.id_:
# game.io.send('CHAT ' + quote(source_nick+ '->' + target_nick + ': ' + msg), c_id)
for t in [t for t in self.things
if player.fov_stencil[t.position] == '.']:
self.io.send('THING %s %s %s' % (t.position, t.type_, t.id_), c_id)
- if hasattr(t, 'nickname'):
- self.io.send('THING_NAME %s %s' % (t.id_,
- quote(t.nickname)), c_id)
+ if hasattr(t, 'name'):
+ self.io.send('THING_NAME %s %s' % (t.id_, quote(t.name)), c_id)
if hasattr(t, 'player_char'):
self.io.send('THING_CHAR %s %s' % (t.id_,
quote(t.player_char)), c_id)
break
if not connection_id_found:
t = self.get_thing(self.sessions[connection_id])
- if hasattr(t, 'nickname'):
- self.io.send('CHAT ' + quote(t.nickname + ' left the map.'))
+ if hasattr(t, 'name'):
+ self.io.send('CHAT ' + quote(t.name + ' left the map.'))
self.things.remove(t)
to_delete += [connection_id]
for connection_id in to_delete: