Add some sound functionality
This commit is contained in:
@@ -3,6 +3,6 @@ export default function EchoCommand(args, context) {
|
||||
context.print(`Usage: echo <on/off>`);
|
||||
} else {
|
||||
context.setInputEcho(args[1] == "on" ? true : false);
|
||||
context.print(`Command echo is now ${args[1]}`);
|
||||
context.print(`Command echo is now ${args[1]}.`);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ export default function LookCommand(args, context) {
|
||||
}
|
||||
}
|
||||
if (!item) {
|
||||
context.output.say(`I could not find a ${args[1]}`);
|
||||
context.output.say(`I could not find a ${args[1]}.`);
|
||||
} else {
|
||||
context.output.say(item.name);
|
||||
context.output.say(item.description);
|
||||
|
||||
@@ -9,14 +9,14 @@ export default function TakeCommand(args, context) {
|
||||
}
|
||||
}
|
||||
if (!item) {
|
||||
context.print(`You can't find any ${args[1]}`);
|
||||
context.print(`You can't find any ${args[1]}.`);
|
||||
} else {
|
||||
if (!item.takeable) {
|
||||
context.print(`You can't take ${item.name}`);
|
||||
context.print(`You can't take ${item.name}.`);
|
||||
} else {
|
||||
room.removeItem(item.id);
|
||||
context.player.addItem(item.id);
|
||||
context.print(`You take ${item.name}`);
|
||||
context.print(`You take ${item.name}.`);
|
||||
item.onTake();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,16 @@ export default async function UseCommand(args, context) {
|
||||
}
|
||||
}
|
||||
if (!item) {
|
||||
context.output.say(`I could not find a ${args[1]}`);
|
||||
const items = context.player.getInventory();
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user