16 lines
426 B
JavaScript
16 lines
426 B
JavaScript
|
export default async function UseCommand(args, context) {
|
||
|
const room = context.getRoom(context.player.currentRoom);
|
||
|
const items = room.getItems();
|
||
|
let item = null;
|
||
|
for (let i of items) {
|
||
|
if (i.name.includes(args[1])) {
|
||
|
item = i;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (!item) {
|
||
|
context.output.say(`I could not find a ${args[1]}`);
|
||
|
} else {
|
||
|
await item.onUse();
|
||
|
}
|
||
|
}
|