cmd_TASKS.argtypes = ''
def cmd_ALL(game, msg, connection_id):
- import math
+
+ def lower_msg_by_volume(msg, volume):
+ lowered_msg = ''
+ for c in msg:
+ c = c
+ while random.random() > volume * 4:
+ if c.isupper():
+ c = c.lower()
+ elif c != '.':
+ c = '.'
+ else:
+ c = ' '
+ lowered_msg += c
+ return lowered_msg
+
+ import random
if not connection_id in game.sessions:
raise GameError('need to be logged in for this')
speaker = game.get_thing(game.sessions[connection_id], False)
for c_id in game.sessions:
listener = game.get_thing(game.sessions[c_id], create_unfound=False)
volume = 1 / max(1, dijkstra_map[listener.position])
+ lowered_msg = lower_msg_by_volume(msg, volume)
+ lowered_nick = lower_msg_by_volume(speaker.nickname, volume)
game.io.send('CHAT ' +
- quote('(volume: %.3f) %s: %s' % (volume, speaker.nickname, msg)),
+ quote('(volume: %.2f) %s: %s' % (volume, lowered_nick,
+ lowered_msg)),
c_id)
cmd_ALL.argtypes = 'string'