Jump to content

Recommended Posts

Making some more recipes for the crockpot, it's all working and such, except that when cooking its over the food on the crockpot is invisible. I researched all day and couldn't find anything that worked. Its inventory and even on the ground textures are working, just need to know how to make it appear in the crockpot

Thanks for all the help in advance

client_log.txt

13 hours ago, Lumina said:

Mean you have to use spriter for this food, but usually for food it's not too hard since it's just one anim.

It does have the spriter file already, as its a recipe from Shipwreckt, it even shows the recipe when its on the ground. The problem is that it's anim is in the cook_pot_food.zip file, and i found this code:

local function ShowProduct(inst)
    if not inst:HasTag("burnt") then
        local product = inst.components.stewer.product
        if IsModCookingProduct(inst.prefab, product) then
            inst.AnimState:OverrideSymbol("swap_cooked", product, product)
        else
            inst.AnimState:OverrideSymbol("swap_cooked", "cook_pot_food", product)
        end
    end
end

 

then i tried to do the following

local portList = --ports from other gamemodes (ex.: shipwreckt recipes)
    {
        "surfnturf",
    }
local newList = -- things that already are in the game but aren't recipes (ex.: butter)
    {
        "butter",
    }

local function ShowProduct(inst)
    if not inst:HasTag("burnt") then
        local product = inst.components.stewer.product
        local flag = 1
        for i,v in ipairs(portList) do
            if product == v then
                flag = 2
            end
        end
        for j,w in ipairs(newList) do -- i'm pretty sure that I can use i,v but just to be sure :D
            if product == w then
                flag = 3
            end
        end
        
        if IsModCookingProduct(inst.prefab, product) and flag == 1 then --[[ it is a mod and is not on the cook_pot_food list]]
            inst.AnimState:OverrideSymbol("swap_cooked", product, product)
        elseif IsModCookingProduct(inst.prefab, product) and flag == 3 then --[[ it is a mod and is an already existing anim file (butter) ]]
 ***       inst.AnimState:OverrideSymbol("swap_cooked", product, "idle")
            else
                inst.AnimState:OverrideSymbol("swap_cooked", "cook_pot_food", product) --[[ its a default DST recipe]]
            end
        end
    end

and the stuff from shipwreckt works!! But still no luck with the butter one, any help? :D

EDIT: 

I tried changing the *** marked line for
inst.AnimState:OverrideSymbol("swap_cooked", "cook_pot_food", "surfnturf")
and it showed as the surfnturf were in the crockpot, therefore
inst.AnimState:OverrideSymbol("swap_cooked", product, "idle") probably has something wrong with the arguments it haves

Edited by Zardexrlz
11 hours ago, Zardexrlz said:

It does have the spriter file already, as its a recipe from Shipwreckt, it even shows the recipe when its on the ground. The problem is that it's anim is in the cook_pot_food.zip file

Yeah, i know, it's why i gave you a topic about the crockpot problem. I'm sorry i totally don't understand your code, i'm pretty sure that the spriter thing is enough if well done, So, sorry, i can't help.

8 hours ago, Lumina said:

Yeah, i know, it's why i gave you a topic about the crockpot problem. I'm sorry i totally don't understand your code, i'm pretty sure that the spriter thing is enough if well done, So, sorry, i can't help.

Yeah I guess I'll remake the butter anim file so it is inside a path I know how to direct OverrideSymbol function to it. Don't worry, you helped me a lot already :D

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