pass # we assume socket will be known as dead by now
def cmd_TURN(game, n):
+ game.info_db = {}
+ game.info_hints = []
game.turn = n
game.things = []
game.portals = {}
cmd_MAP_CONTROL.argtypes = 'string'
def cmd_GAME_STATE_COMPLETE(game):
- game.info_db = {}
if game.tui.mode.name == 'post_login_wait':
game.tui.switch_mode('play')
if game.tui.mode.shows_info:
game.tui.do_refresh = True
cmd_ARGUMENT_ERROR.argtypes = 'string'
+def cmd_ANNOTATION_HINT(game, position):
+ game.info_hints += [position]
+cmd_ANNOTATION_HINT.argtypes = 'yx_tuple:nonneg'
+
def cmd_ANNOTATION(game, position, msg):
game.info_db[position] = msg
+ game.tui.restore_input_values()
if game.tui.mode.shows_info:
game.tui.do_refresh = True
cmd_ANNOTATION.argtypes = 'yx_tuple:nonneg string'
self.register_command(cmd_MAP_CONTROL)
self.register_command(cmd_PORTAL)
self.register_command(cmd_ANNOTATION)
+ self.register_command(cmd_ANNOTATION_HINT)
self.register_command(cmd_GAME_STATE_COMPLETE)
self.register_command(cmd_ARGUMENT_ERROR)
self.register_command(cmd_GAME_ERROR)
self.map_content = ''
self.player_id = -1
self.info_db = {}
+ self.info_hints = []
self.portals = {}
self.terrains = {}
if self.mode.shows_info:
player = self.game.get_thing(self.game.player_id)
self.explorer = YX(player.position.y, player.position.x)
+ self.query_info()
if self.mode.name == 'waiting_for_server':
self.log_msg('@ waiting for server …')
if self.mode.name == 'edit':
self.window_width)
def move_explorer(direction):
- target = self.game.map_geometry.move(self.explorer, direction)
+ target = self.game.map_geometry.move_yx(self.explorer, direction)
if target:
self.explorer = target
self.query_info()
if terrain_char in self.game.terrains:
terrain_desc = self.game.terrains[terrain_char]
info = 'TERRAIN: "%s" / %s\n' % (terrain_char, terrain_desc)
+ protection = self.game.map_control_content[pos_i]
+ if protection == '.':
+ protection = 'unprotected'
+ info = 'PROTECTION: %s\n' % protection
for t in self.game.things:
if t.position == self.explorer:
info += 'THING: %s / %s' % (t.type_,
start = self.game.map_geometry.size.x * y
end = start + self.game.map_geometry.size.x
map_lines_split += [[c + ' ' for c in map_content[start:end]]]
- if self.map_mode == 'terrain':
+ if self.map_mode == 'annotations':
+ for p in self.game.info_hints:
+ map_lines_split[p.y][p.x] = 'A '
+ elif self.map_mode == 'terrain':
for p in self.game.portals.keys():
map_lines_split[p.y][p.x] = 'P '
used_positions = []
elif self.mode == self.mode_study:
content += 'Available actions:\n'
content += '[%s] – move question mark\n' % ','.join(self.movement_keys)
- content += '[%s] – toggle view between terrain, and password protection areas\n' % self.keys['toggle_map_mode']
+ content += '[%s] – toggle view between terrain, annotations, and password protection areas\n' % self.keys['toggle_map_mode']
content += '\n\nOther modes available from here:'
content += '[%s] – chat mode\n' % self.keys['switch_to_chat']
content += '[%s] – play mode\n' % self.keys['switch_to_play']
elif self.mode == self.mode_chat:
content += '/nick NAME – re-name yourself to NAME\n'
- #content += '/msg USER TEXT – send TEXT to USER\n'
content += '/%s or /play – switch to play mode\n' % self.keys['switch_to_play']
content += '/%s or /study – switch to study mode\n' % self.keys['switch_to_study']
for i in range(self.size.y):
self.switch_mode('play')
elif key == self.keys['toggle_map_mode']:
if self.map_mode == 'terrain':
+ self.map_mode = 'annotations'
+ elif self.map_mode == 'annotations':
self.map_mode = 'control'
else:
self.map_mode = 'terrain'