Now able to eat things without eat behavior

This commit is contained in:
Hri7566 2024-03-05 17:33:14 -05:00
parent 127380f1f0
commit c04ed062f7
2 changed files with 8 additions and 4 deletions

View File

@ -49,11 +49,14 @@ export const eat = new Command(
if (foundObject.objtype == "fish") thingy = "fish";
const bhv = itemBehaviorMap[thingy];
if (!bhv) return `The ${foundObject.name} isn't edible.`;
if (!bhv["eat"]) return `You can't eat the ${foundObject.name}.`;
if (bhv) {
if (!bhv["eat"]) return `You can't eat the ${foundObject.name}.`;
const res = await runBehavior(thingy, "eat", foundObject, props);
shouldRemove = res.shouldRemove;
const res = await runBehavior(thingy, "eat", foundObject, props);
shouldRemove = res.shouldRemove;
} else {
shouldRemove = true;
}
if (shouldRemove) {
if (foundObject.objtype == "fish") {

View File

@ -2,6 +2,7 @@ import { addBack } from "@server/backs";
import Command from "@server/commands/Command";
import { logger } from "@server/commands/handler";
import { getInventory, updateInventory } from "@server/data/inventory";
import prisma from "@server/data/prisma";
import { getUser } from "@server/data/user";
import { getSizeString } from "@server/fish/fish";
import { fishers, getFishing } from "@server/fish/fishers";