'enter_hat': {
'short': 'enter your hat',
'intro': '@ enter hat line (enter nothing to abort):',
- 'long': 'Draw your hat as ASCII art. The string you enter must be 18 characters long, and will be divided on display into 3 lines of 6 characters each, from top to bottom..'
+ 'long': 'Draw your face as ASCII art. The string you enter must be 18 characters long, and will be divided on display into 3 lines of 6 characters each, from top to bottom. Eat cookies to extend the ASCII characters available for drawing.'
},
'write': {
'short': 'change terrain',
self.fov = ''
self.flash = False
self.map_lines = []
+ self.ascii_draw_stage = 0
+ self.full_ascii_draw = ''
self.offset = YX(0,0)
curses.wrapper(self.loop)
elif self.mode.name == 'admin_thing_protect':
if hasattr(self.thing_selected, 'protection'):
self.input_ = self.thing_selected.protection
+ elif self.mode.name in {'enter_face', 'enter_hat'}:
+ start = self.ascii_draw_stage * 6
+ end = (self.ascii_draw_stage + 1) * 6
+ if self.mode.name == 'enter_face':
+ self.input_ = self.game.player.face[start:end]
+ elif self.mode.name == 'enter_hat':
+ self.input_ = self.game.player.hat[start:end]
def send_tile_control_command(self):
self.send('SET_TILE_CONTROL %s %s' %
return fail('already carrying something')
if mode_name == 'drop_thing' and not self.game.player.carrying:
return fail('not carrying anything droppable')
+ if mode_name == 'enter_hat' and not hasattr(self.game.player, 'hat'):
+ return fail('not wearing hat to edit', 'edit')
if mode_name == 'admin_enter' and self.is_admin:
mode_name = 'admin'
elif mode_name in {'name_thing', 'admin_thing_protect'}:
self.input_ = ''
self.switch_mode('play')
+ def enter_ascii_art(command):
+ if len(self.input_) != 6:
+ self.log_msg('? wrong input length, try again')
+ return
+ self.log_msg(' ' + self.input_)
+ self.full_ascii_draw += self.input_
+ self.ascii_draw_stage += 1
+ if self.ascii_draw_stage < 3:
+ self.restore_input_values()
+ else:
+ self.send('%s %s' % (command, quote(self.full_ascii_draw)))
+ self.full_ascii_draw = ""
+ self.ascii_draw_stage = 0
+ self.input_ = ""
+ self.switch_mode('edit')
+
action_descriptions = {
'move': 'move',
'flatten': 'flatten surroundings',
self.send('LOGIN ' + quote(self.input_))
self.input_ = ""
elif self.mode.name == 'enter_face' and key == '\n':
- if len(self.input_) != 18:
- self.log_msg('? wrong input length, aborting')
- else:
- self.send('PLAYER_FACE %s' % quote(self.input_))
- self.input_ = ""
- self.switch_mode('edit')
+ enter_ascii_art('PLAYER_FACE')
elif self.mode.name == 'enter_hat' and key == '\n':
- if len(self.input_) != 18:
- self.log_msg('? wrong input length, aborting')
- else:
- self.send('PLAYER_HAT %s' % quote(self.input_))
- self.input_ = ""
- self.switch_mode('edit')
+ enter_ascii_art('PLAYER_HAT')
elif self.mode.name == 'take_thing' and key == '\n':
pick_selectable('PICK_UP')
elif self.mode.name == 'drop_thing' and key == '\n':