+ elif self.mode.name == 'take_thing':
+ self.log_msg('Portable things in reach for pick-up:')
+ player = self.game.get_thing(self.game.player_id)
+ select_range = [player.position,
+ player.position + YX(0,-1),
+ player.position + YX(0, 1),
+ player.position + YX(-1, 0),
+ player.position + YX(1, 0)]
+ if type(self.game.map_geometry) == MapGeometryHex:
+ if player.position.y % 2:
+ select_range += [player.position + YX(-1, 1),
+ player.position + YX(1, 1)]
+ else:
+ select_range += [player.position + YX(-1, -1),
+ player.position + YX(1, -1)]
+ self.selectables = [t for t in self.game.things
+ if t.portable and t.position in select_range]
+ if len(self.selectables) == 0:
+ self.log_msg('none')
+ else:
+ for i in range(len(self.selectables)):
+ t = self.selectables[i]
+ self.log_msg(str(i) + ': ' + self.get_thing_info(t))
+ elif self.mode.name == 'command_thing':
+ self.send('TASK:COMMAND ' + quote('HELP'))
+ elif self.mode.name == 'control_pw_pw':
+ self.log_msg('@ enter protection password for "%s":' % self.tile_control_char)
+ elif self.mode.name == 'control_tile_draw':
+ self.log_msg('@ can draw protection character "%s", turn drawing on/off with [%s], finish with [%s].' % (self.tile_control_char, self.keys['toggle_tile_draw'], self.keys['switch_to_admin_enter']))
+ self.input_ = ""
+ self.restore_input_values()
+
+ def set_default_colors(self):
+ curses.init_color(1, 1000, 1000, 1000)
+ curses.init_color(2, 0, 0, 0)
+ self.do_refresh = True
+
+ def set_random_colors(self):
+
+ def rand(offset):
+ import random
+ return int(offset + random.random()*375)
+
+ curses.init_color(1, rand(625), rand(625), rand(625))
+ curses.init_color(2, rand(0), rand(0), rand(0))
+ self.do_refresh = True
+
+ def get_info(self):
+ if self.info_cached:
+ return self.info_cached
+ pos_i = self.explorer.y * self.game.map_geometry.size.x + self.explorer.x
+ info_to_cache = ''
+ if len(self.game.fov) > pos_i and self.game.fov[pos_i] != '.':
+ info_to_cache += 'outside field of view'
+ else:
+ for t in self.game.things:
+ if t.position == self.explorer:
+ info_to_cache += 'THING: %s' % self.get_thing_info(t)
+ protection = t.protection
+ if protection == '.':
+ protection = 'none'
+ info_to_cache += ' / protection: %s\n' % protection
+ if hasattr(t, 'hat'):
+ info_to_cache += t.hat[0:6] + '\n'
+ info_to_cache += t.hat[6:12] + '\n'
+ info_to_cache += t.hat[12:18] + '\n'
+ if hasattr(t, 'face'):
+ info_to_cache += t.face[0:6] + '\n'
+ info_to_cache += t.face[6:12] + '\n'
+ info_to_cache += t.face[12:18] + '\n'
+ terrain_char = self.game.map_content[pos_i]
+ terrain_desc = '?'
+ if terrain_char in self.game.terrains:
+ terrain_desc = self.game.terrains[terrain_char]
+ info_to_cache += 'TERRAIN: "%s" / %s\n' % (terrain_char,
+ terrain_desc)
+ protection = self.game.map_control_content[pos_i]
+ if protection == '.':
+ protection = 'unprotected'
+ info_to_cache += 'PROTECTION: %s\n' % protection
+ if self.explorer in self.game.portals:
+ info_to_cache += 'PORTAL: ' +\
+ self.game.portals[self.explorer] + '\n'
+ else:
+ info_to_cache += 'PORTAL: (none)\n'
+ if self.explorer in self.game.annotations:
+ info_to_cache += 'ANNOTATION: ' +\
+ self.game.annotations[self.explorer]
+ self.info_cached = info_to_cache
+ return self.info_cached