Jump to content
Undefined

How do I check whether an item is a spice?

Recommended Posts

Posted (edited)

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

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.

Guest
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.

Loading...


×
×
  • Create New...