Jump to content

How do I check whether an item is a spice?


Undefined

Recommended Posts

EDIT: the function I was looking for is isSpice.

 

So:

 

item:IsSpice()

 

I found the function using this link: https://projectzomboid.com/modding/

 

------

 

I'm trying to modify the AutoCook mod to exclude spices.

 

Relevant section of code (I think). The last line in particular is where I would add the check to see if the item is a spice, but I don't know the function to call on the item object for checking its spice value.

 

function AutoCook:chooseItem(items,baseItem, recipe)
    if AutoCook.Verbose then print ("AutoCook:chooseItem "..baseItem:getName()) end
    if not items or items:size() == 0 then--if there is no more available items stop auto cook
        return nil
    end

    
--take the one that will become rotten the fastest ?
--take the one that gives most nutrition ?
--take the one that gives most happiness ?
    local evoItem = nil
    local listItemsNotAlreadyUsed = {}
    local listItemsUsedOnce = {}
    for i=1,items:size() do
        local item = items:get(i-1);
        if instanceof(item, "Food") and not self.playerObj:isKnownPoison(item) and (recipe:isCookable() or not item:isbDangerousUncooked() or item:isCooked()) then--do we risk to apply also survivor / carpentry / .. recipes ?

 

Edited by Undefined
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...