Fix eating things
This commit is contained in:
parent
c04ed062f7
commit
e77e43850e
|
@ -49,10 +49,12 @@ export const eat = new Command(
|
||||||
if (foundObject.objtype == "fish") thingy = "fish";
|
if (foundObject.objtype == "fish") thingy = "fish";
|
||||||
|
|
||||||
const bhv = itemBehaviorMap[thingy];
|
const bhv = itemBehaviorMap[thingy];
|
||||||
|
let res;
|
||||||
|
|
||||||
if (bhv) {
|
if (bhv) {
|
||||||
if (!bhv["eat"]) return `You can't eat the ${foundObject.name}.`;
|
if (!bhv["eat"]) return `You can't eat the ${foundObject.name}.`;
|
||||||
|
|
||||||
const res = await runBehavior(thingy, "eat", foundObject, props);
|
res = await runBehavior(thingy, "eat", foundObject, props);
|
||||||
shouldRemove = res.shouldRemove;
|
shouldRemove = res.shouldRemove;
|
||||||
} else {
|
} else {
|
||||||
shouldRemove = true;
|
shouldRemove = true;
|
||||||
|
@ -105,13 +107,15 @@ export const eat = new Command(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundObject.id == "sand") {
|
if (foundObject.id == "sand") {
|
||||||
if (res.and) {
|
if (res) {
|
||||||
|
if (res.and)
|
||||||
return `Our friend ${part.name} ate of his/her ${foundObject.name} ${res.and}`;
|
return `Our friend ${part.name} ate of his/her ${foundObject.name} ${res.and}`;
|
||||||
} else {
|
} else {
|
||||||
return `Our friend ${part.name} ate of his/her ${foundObject.name}.`;
|
return `Our friend ${part.name} ate of his/her ${foundObject.name}.`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (res.and) {
|
if (res) {
|
||||||
|
if (res.and)
|
||||||
return `Our friend ${part.name} ate his/her ${foundObject.name} ${res.and}`;
|
return `Our friend ${part.name} ate his/her ${foundObject.name} ${res.and}`;
|
||||||
} else {
|
} else {
|
||||||
return `Our friend ${part.name} ate his/her ${foundObject.name}.`;
|
return `Our friend ${part.name} ate his/her ${foundObject.name}.`;
|
||||||
|
|
Loading…
Reference in New Issue