- tui.log_msg("");
- tui.log_msg("HELP");
- tui.log_msg("");
- tui.log_msg("chat mode commands:");
- tui.log_msg(":login USER - register as USER");
- tui.log_msg(":msg USER TEXT - send TEXT to USER");
- tui.log_msg(":help - show this help");
- tui.log_msg(":play or :p - switch to play mode");
- tui.log_msg(":study or :s - switch to study mode");
- tui.log_msg("");
- tui.log_msg("play mode commands:");
- tui.log_msg("w, a, s, d - move avatar");
- tui.log_msg("f - flatten surroundings");
- tui.log_msg("e - write following ASCII character");
- tui.log_msg("c - switch to chat mode");
- tui.log_msg("? - switch to study mode");
- tui.log_msg("");
- tui.log_msg("study mode commands:");
- tui.log_msg("w, a, s, d - move question mark");
- tui.log_msg("A - annotate terrain");
- tui.log_msg("c - switch to chat mode");
- tui.log_msg("p - switch to play mode");
- tui.log_msg("");
+ this.log_msg("");
+ this.log_msg("HELP:");
+ this.log_msg("chat mode commands:");
+ this.log_msg(" :nick NAME - re-name yourself to NAME");
+ this.log_msg(" :msg USER TEXT - send TEXT to USER");
+ this.log_msg(" :help - show this help");
+ this.log_msg(" :p or :play - switch to play mode");
+ this.log_msg(" :? or :study - switch to study mode");
+ this.log_msg("commands common to study and play mode:");
+ this.log_msg(" w, a, s, d - move");
+ this.log_msg(" c - switch to chat mode");
+ this.log_msg("commands specific to play mode:");
+ this.log_msg(" e - write following ASCII character");
+ this.log_msg(" f - flatten surroundings");
+ this.log_msg(" ? - switch to study mode");
+ this.log_msg("commands specific to study mode:");
+ this.log_msg(" e - annotate terrain");
+ this.log_msg(" p - switch to play mode");
+ this.log_msg("");
+ },
+ draw_map: function() {
+ let map_lines = [];
+ let line = [];
+ for (let i = 0, j = 0; i < game.map.length; i++, j++) {
+ if (j == game.map_size[1]) {
+ map_lines.push(line);
+ line = [];
+ j = 0;
+ };
+ line.push(game.map[i]);
+ };
+ map_lines.push(line);
+ let player_position = [0,0];
+ let center_pos = [Math.floor(game.map_size[0] / 2),
+ Math.floor(game.map_size[1] / 2)];
+ for (const thing_id in game.things) {
+ let t = game.things[thing_id];
+ map_lines[t[0]][t[1]] = '@';
+ if (game.player_id == thing_id) {
+ center_pos = t;
+ }
+ };
+ if (tui.mode.shows_annotations) {
+ map_lines[explorer.position[0]][explorer.position[1]] = '?';
+ center_pos = explorer.position;
+ }
+ let offset = [(terminal.rows / 2) - center_pos[0],
+ this.window_width / 2 - center_pos[1]];
+ for (let term_y = offset[0], map_y = 0;
+ term_y < terminal.rows && map_y < game.map_size[0];
+ term_y++, map_y++) {
+ if (term_y >= 0) {
+ let to_draw = map_lines[map_y].join('').slice(0, this.window_width - offset[1]);
+ terminal.write(term_y, offset[1], to_draw);
+ }
+ }
+ },
+ draw_mode_line: function() {
+ terminal.write(0, this.window_width, 'MODE: ' + this.mode.name);
+ },
+ draw_turn_line: function(n) {
+ terminal.write(1, this.window_width, 'TURN: ' + game.turn);
+ },
+ draw_history: function() {
+ if (terminal.rows <= this.height_header + this.height_input) {
+ return;
+ }
+ for (let y = terminal.rows - 1 - this.height_input,
+ i = this.log.length - 1;
+ y >= this.height_header && i >= 0;
+ y--, i--) {
+ terminal.write(y, this.window_width, this.log[i]);
+ }