From c04ed062f710fa35639bbd7db35ab0089bf65ae9 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Tue, 5 Mar 2024 17:33:14 -0500 Subject: [PATCH] Now able to eat things without eat behavior --- src/api/commands/groups/inventory/eat.ts | 11 +++++++---- src/api/commands/groups/inventory/yeet.ts | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/commands/groups/inventory/eat.ts b/src/api/commands/groups/inventory/eat.ts index b6dbe6d..0fc2cea 100644 --- a/src/api/commands/groups/inventory/eat.ts +++ b/src/api/commands/groups/inventory/eat.ts @@ -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") { diff --git a/src/api/commands/groups/inventory/yeet.ts b/src/api/commands/groups/inventory/yeet.ts index 987ec65..49b9993 100644 --- a/src/api/commands/groups/inventory/yeet.ts +++ b/src/api/commands/groups/inventory/yeet.ts @@ -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";