},
switch_mode: function(mode_name) {
- function fail(msg) {
+ function fail(msg, return_mode) {
tui.log_msg('? ' + msg);
terminal.blink_screen();
- this.switch_mode('play');
+ this.switch_mode(return_mode);
}
if (this.mode && this.mode.name == 'control_tile_draw') {
this.tile_draw = false;
if (mode_name == 'command_thing' && (!game.player.carrying
|| !game.player.carrying.commandable)) {
- return fail('not carrying anything commandable');
+ return fail('not carrying anything commandable', 'play');
};
if (mode_name == 'take_thing' && game.player.carrying) {
- return fail('already carrying something');
+ return fail('already carrying something', 'play');
};
if (mode_name == 'drop_thing' && !game.player.carrying) {
- return fail('not carrying anything droppable');
+ return fail('not carrying anything droppable', 'play');
}
if (mode_name == 'admin_enter' && this.is_admin) {
mode_name = 'admin';
}
}
if (!thing_id) {
- return fail('not standing over thing');
+ return fail('not standing over thing', 'fail');
} else {
this.selected_thing_id = thing_id;
}
def switch_mode(self, mode_name):
- def fail(msg):
+ def fail(msg, return_mode='play'):
self.log_msg('? ' + msg)
self.flash = True
- self.switch_mode('play')
+ self.switch_mode(return_mode)
if self.mode and self.mode.name == 'control_tile_draw':
self.log_msg('@ finished tile protection drawing.')
thing = t
break
if not thing:
- return fail('not standing over thing')
+ return fail('not standing over thing', 'edit')
else:
self.thing_selected = thing
self.mode = getattr(self, 'mode_' + mode_name)
keycode = None
if len(key) == 1:
keycode = ord(key)
+ self.show_help = False
if key == 'KEY_RESIZE':
reset_screen_size()
elif self.mode.has_input_prompt and key == 'KEY_BACKSPACE':