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.

Link to comment
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"

Link to comment
Share on other sites

31 minutes ago, Tchernobill said:

on Food you can call whatever you want:

getFoodType()
isPoison()
isSpice()
getThirstChange()
getHungerChange()

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...