t.type_ = tokens[2];
t.protection = tokens[3];
t.portable = parseInt(tokens[5]);
+ t.commandable = parseInt(tokens[6]);
} else if (tokens[0] === 'THING_NAME') {
let t = game.get_thing(tokens[1], false);
t.name_ = tokens[2];
game.thing_types[tokens[1]] = tokens[2]
} else if (tokens[0] === 'THING_CARRYING') {
let t = game.get_thing(tokens[1], false);
- t.carrying = true;
+ t.carrying = t = game.get_thing(tokens[2], false);
} else if (tokens[0] === 'THING_INSTALLED') {
let t = game.get_thing(tokens[1], false);
t.installed = true;
tui.log_msg('@ finished tile protection drawing.')
}
this.tile_draw = false;
+ const player = game.things[game.player_id];
+ if (mode_name == 'command_thing' && (!player.carrying || !player.carrying.commandable)) {
+ this.log_msg('? not carrying anything commandable');
+ terminal.blink_screen();
+ this.switch_mode('play');
+ return;
+ };
if (mode_name == 'admin_enter' && this.is_admin) {
mode_name = 'admin';
} else if (['name_thing', 'admin_thing_protect'].includes(mode_name)) {
- let player_position = game.things[game.player_id].position;
let thing_id = null;
for (let t_id in game.things) {
if (t_id == game.player_id) {
continue;
}
let t = game.things[t_id];
- if (player_position[0] == t.position[0] && player_position[1] == t.position[1]) {
+ if (player.position[0] == t.position[0]
+ && player.position[1] == t.position[1]) {
thing_id = t_id;
break;
}
tui.inputEl.value = "";
tui.switch_mode('edit');
} else if (tui.mode.name == 'command_thing' && event.key == 'Enter') {
- if (tui.task_action_on('command')) {
- server.send(['TASK:COMMAND', tui.inputEl.value]);
- tui.inputEl.value = "";
- }
+ server.send(['TASK:COMMAND', tui.inputEl.value]);
+ tui.inputEl.value = "";
} else if (tui.mode.name == 'take_thing' && event.key == 'Enter') {
const i = parseInt(tui.inputEl.value);
if (isNaN(i) || i < 0 || i >= tui.selectables.length) {