Jump to content

Recommended Posts

Hello, I've been working on a mod attempting to add Diets to the game. In order to do this I would like to be able to retrieve (or get) the FoodType String from the item object if it is a food. I've been digging around for a while but haven't managed to figure out a way to do it. I was wondering if this is even possible currently?


I managed to adjust the FoodType variable by using ItemTweakerAPI for Build41 which allowed me to adjust only that value instead of overwriting everything. I confirmed that it was indeed working through the Mod Options mod. However, I have not been able to actually retrieve the FoodType variable from any food item object. 


I was wondering if I was missing something or if this just isn't possible to do currently.

Share this post

Link to post
Share on other sites

2 hours ago, Tchernobill said:

instanceof(item, "Food")

returns true if it is Food, and returns false if it is not Food

Will instanceof also work for finding whether or not a food item is "Meat" or "Fish" for example, from the base game? I've already figured out how to test if an item is food by calling item:getCategory(). What I'm looking for is a way to get the "FoodType" not the item "Type"

Share this post

Link to post
Share on other sites

31 minutes ago, Tchernobill said:

on Food you can call whatever you want:


I swear I tried getFoodType() before and it wasn't working so I wrote it off as not being an actual method. Must've been something else I was screwing up. Now it's working though, so thanks a lot for your help! One step closer to making my first mod.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...