Jump to content

Recommended Posts

I'm trying to make a mod for an item that can be created with a crockpot. I've successfully made it work and even made it appear in a crockpot after cooking in the game, but only when its recipe doesn't conflict with existing ones. For instance, it always turns into meatballs instead of my item if any meat/fish is involved. I've tried increasing its priority value to something ridiculously high (99999) to always favor my item, yet it still favors meatballs with a value of -1! Below is the code:

local Action = GLOBAL.Action
local ActionHandler = GLOBAL.ActionHandler 

PrefabFiles = {"myfood",}

local myfood =
{
    name = "myfood",
    
    test = function(cooker, names, tags)
    return names.berries
    and names.carrot
    and names.butter
    and tags.fish
    end,
    
    priority = 99999,


    weight = 1,
    foodtype = "GENERIC",
    temperature = TUNING.HOT_FOOD_BONUS_TEMP,
    temperatureduration = TUNING.FOOD_TEMP_AVERAGE,
    
    cooktime = 1,
    tags = {"myfood"},
}
AddCookerRecipe("cookpot", myfood)

Is it possible to solve this?

Edited by Raxxo

Instead of

AddCookerRecipe("cookpot", myfood)

use this

        for k,v in pairs(myfood) do
            v.name = k
            v.weight = v.weight or 1
            v.priority = v.priority or 0
        end

        for k,recipe in pairs(myfood) do
            AddCookerRecipe("cookpot", recipe)
        end

=-=-

That's what I have in my mod and it works fine.

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