for (let t_id in game.things) {
let t = game.things[t_id];
if (t.position[0] == this.position[0] && t.position[1] == this.position[1]) {
- info_to_cache += this.get_thing_info(t);
+ info_to_cache += this.get_thing_info(t, true);
}
}
let terrain_char = game.map[position_i]
this.info_cached = info_to_cache;
return this.info_cached;
},
- get_thing_info: function(t) {
- const symbol = game.thing_types[t.type_];
- let info = '- ' + symbol;
+ get_thing_info: function(t, detailed=false) {
+ let info = '';
+ if (detailed) {
+ info += '- ';
+ }
+ info += game.thing_types[t.type_];
if (t.thing_char) {
info += t.thing_char;
};
if (t.installed) {
info += "/installed";
}
- const protection = t.protection;
- if (protection != '.') {
- info += '/protection:' + protection;
- }
- info += ')\n';
- if (t.hat || t.face) {
- info += '----------\n';
- }
- if (t.hat) {
- info += '| ' + t.hat.slice(0, 6) + ' |\n';
- info += '| ' + t.hat.slice(6, 12) + ' |\n';
- info += '| ' + t.hat.slice(12, 18) + ' |\n';
- }
- if (t.face) {
- info += '| ' + t.face.slice(0, 6) + ' |\n';
- info += '| ' + t.face.slice(6, 12) + ' |\n';
- info += '| ' + t.face.slice(12, 18) + ' |\n';
- info += '----------\n';
- }
- if (t.design) {
- const line_length = t.design[0][1];
- info += '-'.repeat(line_length + 4) + '\n';
- const regexp = RegExp('.{1,' + line_length + '}', 'g');
- const lines = t.design[1].match(regexp);
- for (const line of lines) {
- info += '| ' + line + ' |\n';
+ if (detailed) {
+ const protection = t.protection;
+ if (protection != '.') {
+ info += '/protection:' + protection;
}
- info += '-'.repeat(line_length + 4) + '\n';
+ info += ')\n';
+ if (t.hat || t.face) {
+ info += '----------\n';
+ }
+ if (t.hat) {
+ info += '| ' + t.hat.slice(0, 6) + ' |\n';
+ info += '| ' + t.hat.slice(6, 12) + ' |\n';
+ info += '| ' + t.hat.slice(12, 18) + ' |\n';
+ }
+ if (t.face) {
+ info += '| ' + t.face.slice(0, 6) + ' |\n';
+ info += '| ' + t.face.slice(6, 12) + ' |\n';
+ info += '| ' + t.face.slice(12, 18) + ' |\n';
+ info += '----------\n';
+ }
+ if (t.design) {
+ const line_length = t.design[0][1];
+ info += '-'.repeat(line_length + 4) + '\n';
+ const regexp = RegExp('.{1,' + line_length + '}', 'g');
+ const lines = t.design[1].match(regexp);
+ for (const line of lines) {
+ info += '| ' + line + ' |\n';
+ }
+ info += '-'.repeat(line_length + 4) + '\n';
+ }
+ } else {
+ info += ')';
}
return info;
},