Jump to content

Recommended Posts

Greetings.
I have read so many different forum pages of people having invisible custom dishes in their crockpot and there was always the same solution for it (which I also tried like 10 times): Lumina's "[Tutorial] Custom recipe/food visible in crockpot/farm"
Thing is, my mod is merely a reskin of a crockpot dish and not a new custom and self created dish! And it's supposed to be a client only mod.

- Generally, is it even possible to change the texture of a crockpot dish that is still in the crockpot?
It currently always shows me the old texture while on the crockpot but when I harvest it, it's all fine though: Inventory icon works, you drop it on the floor and looks good.

- I have looked into other people's way of doing it and most of them are either
1) server mods that basically add a new custom food which behaves like a reskin with higher priority and which has working crockpot texture
or 2) if it actually is a client mod, it also only changes inventory and dropped-item texture (like what I have right now) but while in the crockpot, it still shows the original texture - which makes me wonder if it is even possible...

- I am also curious if you can change the cookbook / Compendium texture of a crockpot dish since my mod is only supposed to be a reskin.

Thank you in advance!

The crockpot still checks the original anim file if you make a reskin of an existing dish, which is why the texture stays the same.

Take a look at the following functions:

Spoiler

local function ShowProduct(inst)
    if not inst:HasTag("burnt") then
        local product = inst.components.stewer.product
        SetProductSymbol(inst, product, IsModCookingProduct(inst.prefab, product) and product or nil)
    end
end

Here the function shows the product and checks if it's a  mod dish, if yes the third argument is the product.


local function SetProductSymbol(inst, product, overridebuild)
    local recipe = cooking.GetRecipe(inst.prefab, product)
    local potlevel = recipe ~= nil and recipe.potlevel or nil
    local build = (recipe ~= nil and recipe.overridebuild) or overridebuild or "cook_pot_food"
    local overridesymbol = (recipe ~= nil and recipe.overridesymbolname) or product

    if potlevel == "high" then
        inst.AnimState:Show("swap_high")
        inst.AnimState:Hide("swap_mid")
        inst.AnimState:Hide("swap_low")
    elseif potlevel == "low" then
        inst.AnimState:Hide("swap_high")
        inst.AnimState:Hide("swap_mid")
        inst.AnimState:Show("swap_low")
    else
        inst.AnimState:Hide("swap_high")
        inst.AnimState:Show("swap_mid")
        inst.AnimState:Hide("swap_low")
    end

    inst.AnimState:OverrideSymbol("swap_cooked", build, overridesymbol)
end

Here the crockpot sets the product symbol after cooking the meal. The third argument is overridebuild, which is used if the dish is a mod dish.

If it's not a mod dish, it will use either recipe.overridebuild or "cook_pot_food".

I'm not sure if it's possible to do this as a client mod, you will need to test it, but the easiest method seems to be that you change the overridebuild of the recipe of the dish to the build name of the dish that you created. 

 

The cookbook is quite difficult to change:

Spoiler

--from cookbookpage_crockpot.lua in widgets/redux
local cookbook_recipes = cooking.cookbook_recipes[self.category]
	for prefab, recipe_def in pairs(cookbook_recipes) do
		--print("recipe: ", self.category, recipe_def.cookbook_category, prefab)
		local data = {
			prefab = prefab,
			name = STRINGS.NAMES[string.upper(prefab)] or subfmt(STRINGS.UI.COOKBOOK.UNKNOWN_FOOD_NAME, {food = prefab or "SDF"}),
			recipe_def = recipe_def,
			defaultsortkey = hash(prefab),
			food_atlas = "images/quagmire_recipebook.xml",
			food_tex = "cookbook_unknown.tex",
		}
  		local known_data = known_recipe_list[prefab]
		if known_data ~= nil then
			data.unlocked = true
			data.has_eaten = known_data.has_eaten
			data.recipes = (known_data.recipes ~= nil and next(known_data.recipes) ~= nil) and known_data.recipes or nil

			local img_name = recipe_def.cookbook_tex or (prefab..".tex")
			local atlas = recipe_def.cookbook_atlas or GetInventoryItemAtlas(img_name, true)
			if atlas ~= nil then
				data.food_atlas = atlas
				data.food_tex = img_name
			else
				data.food_tex = "cookbook_missing.tex"
			end

As you can see, it takes the recipe atlas and tex from cooking.cookbook_recipes.

Unfortunaly, cookbook_recipes is a local table in cooking.lua, which is why you can't access it to change food_atlas to your atlas.

You may be able to change it by accessing it directly through an AddClassPostConstruct to this widget, where you add a check if this is your item and then change the atlas, but this will be quite complicated. At least I can't really see an easy way to implement this, perhaps somebody else has an idea for this case.

  • Like 1

As someone who understands almost nothing about coding, I have been reading posts / watching videos for a while now. So I definitely want to thank you already for your huge amount of input! I will give it a spin and continue testing, will let you know if I managed to do a thing.

I have been fiddling around with it for like 2 weeks now and it feels like forever... x'P

Edit: I am gonna celebrate when I figure out how to reskin the seasoned versions as well since I cannot really pin point down what is changing them.

Edited by dl11111
addition
  • Like 1

You're welcome! I hope that you get it working! :)

As for the seasoned versions, I'm not sure how exactly you reskinned the originals, but if you did it with a PrefabPostInit, you will also need to do it for the seasoned dishes, as they have a new prefab. If I remember correctly, the name is (prefabname of dish)_spicename .

  • Thanks 1

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