+ mode: mode_waiting_for_server,
+ log: [],
+ input_prompt: '> ',
+ input: '',
+ input_lines: [],
+ window_width: terminal.cols / 2,
+ height_turn_line: 1,
+ height_mode_line: 1,
+ height_input: 1,
+ key_up: 'w',
+ key_down: 's',
+ key_left: 'a',
+ key_right: 'd',
+ movement_keys_desc: 'w, a, s, d',
+ init: function() {
+ this.recalc_input_lines();
+ this.height_header = this.height_turn_line + this.height_mode_line;
+ this.log_msg("@ waiting for server connection ...");
+ this.wasd_selector = document.getElementById("WASD_selector");
+ this.wasd_selector.addEventListener('input', function() {
+ if (tui.wasd_selector.value == 'w, a, s, d') {
+ tui.key_up = 'w';
+ tui.key_down = 's';
+ tui.key_left = 'a';
+ tui.key_right = 'd';
+ } else if (tui.wasd_selector.value == 'arrow keys') {
+ tui.key_up = 'ArrowUp';
+ tui.key_down = 'ArrowDown';
+ tui.key_left = 'ArrowLeft';
+ tui.key_right = 'ArrowRight';
+ };
+ tui.movement_keys_desc = tui.wasd_selector.value;
+ }, false);
+ },
+ init_login: function() {
+ this.log_msg("@ please enter your username:");
+ this.switch_mode(mode_login);
+ },
+ switch_mode: function(mode, keep_pos=false) {
+ if (mode == mode_study && !keep_pos) {
+ explorer.position = game.things[game.player_id];
+ }
+ this.mode = mode;
+ this.empty_input();
+ if (mode == mode_annotate && explorer.position in explorer.info_db) {
+ let info = explorer.info_db[explorer.position];
+ if (info != "(none)") {
+ this.add_to_input(explorer.info_db[explorer.position]);
+ }