Jump to content

Recommended Posts

I have some customs foods in my game. Most aren't farm food so i didn't encounter the problem until recently. When on ground the food shows fine, when on farm the food is invisible. I tried the same method i use for food in crockpot (one sub folder with the same name as my item), but this doesn't seem to be enough.

Also, items on drying rack are invisible too.

foodnotshowing.png

 

I know that some mods manage to show both. For drying rack it implies some code i don't understand entirely, but i saw nothing about farm crop. If someone have a clue, i take it. Or even better, a tutorial i could add next to food invisible on crockpot will be even better :D

Edited by Lumina

Yes, "pickle it" this is one of the example of code i'm still trying to understand (it seems to replace the drying rack function), but at least here i have an example.

This mod and waiter 101 both have custom farm plant but i don't see anything special in code related to this. And even with folder with similar names i don't manage to show items in farm. I don't know what i'm missing.

Maybe also test if the animations are okay or not.
Eg. replace some of waiters animations with your ones, and see if they show up. Then you know if animation is the problem or not (I have really no knowledge about this, but I read that animation file could also cause several problems)

local function onmatured(inst)
    inst.SoundEmitter:PlaySound("dontstarve/common/farm_harvestable")
    inst.AnimState:OverrideSymbol("swap_grown", inst.components.crop.product_prefab,inst.components.crop.product_prefab.."01")
end

Game tries to put the "food01" symbol of "food" build to replace "swap_grown" of the farm crop.

For the food, you have a folder with the food frames and a spriter project.

Is the food frames folder (the symbol name) named "food01"? If not, then it's invisible.

You don't need code hacks for farms when you can just use the correct names.

 

For the drying rack you need additional hacks because game calls

inst.AnimState:OverrideSymbol("swap_dried", "meat_rack_food", product)

and you can't append your stuff to the meat_rack_food zip.

What those mods do (maybe) is overwrite the onstartdrying and ondonedrying functions of the drying rack to use the correct builds.

AddPrefabPostInit("meatrack", function(inst)
	if inst.components.dryer then
		local _onstartdrying = inst.components.dryer.onstartdrying
		local _ondonedrying = inst.components.dryer.ondonedrying

		local function onstartdrying(inst, ingredient)
			_onstartdrying(inst, ingredient)

			if ingredient and ingredient.prefab == "mything" then
				inst.AnimState:OverrideSymbol("swap_dried", "mythingbuild", "mythingsymbol")
			end
		end

		local function ondonedrying(inst, product)
			_ondonedrying(inst, product)

			if product and product.prefab == "mything" then
				inst.AnimState:OverrideSymbol("swap_dried", "mythingbuild", "mythingsymbol")
			end
		end

		inst.components.dryer:SetStartDryingFn(onstartdrying)
		inst.components.dryer:SetDoneDryingFn(ondonedrying)
	end
end)

So you can make the rack call the correct builds and symbols.

Thank a lot, DarkXero, happy to see you are still here to help people :) It's a pleasure.

 

3 hours ago, DarkXero said:

 

Is the food frames folder (the symbol name) named "food01"? If not, then it's invisible.

I tried various things. First name was food, because i didn't know if the food01 was a result of decompiling (in the food i used as example, as the "idle90" anim when the 90 is a result of decompiling usually). Then i tested food01 with the food named food01-0, but nothing worked. But i could easily have forgotten something, or sprited doesn't like renaming. I'll try today with a clean spriter.

 

Thanks for the code for drying_rack. I guess that here again i need the correct folder to give the correct symbol name.

Edited by Lumina
1 hour ago, Lumina said:

Thank a lot, DarkXero, happy to see you are still here to help people :) It's a pleasure.

 

I tried various things. First name was food, because i didn't know if the food01 was a result of decompiling (in the food i used as example, as the "idle90" anim when the 90 is a result of decompiling usually). Then i tested food01 with the food named food01-0, but nothing worked. But i could easily have forgotten something, or sprited doesn't like renaming. I'll try today with a clean spriter.

 

Thanks for the code for drying_rack. I guess that here again i need the correct folder to give the correct symbol name.

Did you tried to change default pivot? Maybe it'll help. Can you post your spriters anim and assets, to take a look?

  • Like 1

 

1 hour ago, Lumina said:

Thank a lot, DarkXero, happy to see you are still here to help people :) It's a pleasure.

 

I tried various things. First name was food, because i didn't know if the food01 was a result of decompiling (in the food i used as example, as the "idle90" anim when the 90 is a result of decompiling usually). Then i tested food01 with the food named food01-0, but nothing worked. But i could easily have forgotten something, or sprited doesn't like renaming. I'll try today with a clean spriter.

 

Thanks for the code for drying_rack. I guess that here again i need the correct folder to give the correct symbol name.

Also have a look in cannibalis mod, for drying rack.

  • Like 1

So it's working now for plant in farm. My problem was probably using the same spriter project with the different tries instead of recreating one. I didn't tried the drying rack code now but i don't expect problems here if it works fine for others mods.

Thanks for your help.

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