Jump to content

Recommended Posts

I have a custom character with some custom crockpot recipes, but if I have her mod enabled anyone is able to cook them.

How do I make it so only she can cook them? (I think it has to do with tags, but I don't know how to apply that to a crockpot recipe like you can to a regular crafting recipe). I've looked at Warly and his exclusive recipes. They all have the tag "masterfood", and he has three tags, one of which is "masterchef", but I don't see where the two are connected. Like, I don't see any code that says "masterfood" can only be cooked by "masterchef".

Edited by AmyJane

The recipes are kept exclusive by only being able to be cooked/created on the portable crockpot which I believe only warly can use because of some sort of action restrictions. The masterchef tag is used here for items with the mastercookware tag to decide whether a character can use them or not.

The masterfood tag is literally only used for the wisecracker component for saying something special about them.

When you create your own crockpot recipes you have to add them to crockpots via AddCookerRecipe(crockpot, recipe) function

If you want to make the recipes exclusive to your character exactly like warly you'll need a custom crockpot that only she can use otherwise you'll need to modify the core cooking code to make your recipes valid only if cooked by you. A simple solution is to make a secret ingredient that only your character can obtain and use that as part of your unique recipes. If you don't want to do the secret ingredient or exclusive crockpot options then you'll need to modify some core code for how crockpot cooking works to check additional requirements for a recipe to be valid.

One interesting parameter that is tested for the valid recipe function is the cooker parameter, you should be able to check if the cooker.components.container is valid and if it is check the openlist table and see if a player is using your character as part of the recipe condition.

  • Thanks 1
4 hours ago, AmyJane said:

So Warly isn't able to cook his special foods in a normal crockpot?

--from cooking.lua
local foods = require("preparedfoods")
for k,recipe in pairs (foods) do
	AddCookerRecipe("cookpot", recipe)
	AddCookerRecipe("portablecookpot", recipe)
	AddCookerRecipe("archive_cookpot", recipe)
end

local portable_foods = require("preparedfoods_warly")
for k,recipe in pairs (portable_foods) do
	AddCookerRecipe("portablecookpot", recipe)
end

local spicedfoods = require("spicedfoods")
for k, recipe in pairs(spicedfoods) do
    AddCookerRecipe("portablespicer", recipe)
end

local nonfoods = require("preparednonfoods")
for k, recipe in pairs(nonfoods) do
    AddCookerRecipe("cookpot", recipe)
    AddCookerRecipe("portablecookpot", recipe)
    AddCookerRecipe("archive_cookpot", recipe)
end

That is correct Warly cannot cook his special foods in a normal crockpot

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