Jump to content

Recommended Posts

Hello, this is my first time working with Spriter. When I try to place my item on the meat rack, it becomes invisible, and even after it dries, it remains invisible even when I try to generate dried meat that's already in the game. I've also tried adding an existing file to the code, but that didn't work either. Any clues or help on how to solve this problem would be greatly appreciated.

image.png.0401ece1d765517e2b2d2f6972185688.pngimage.png.0894613d025694ce5302975fd05ac11b.png

You could look at my leaf jerky mod, although that's more to modify an existing prefab (which happened to already have an unused animation).

The important part should be something like this:

local assets =
{
    Asset("ANIM", "anim/rack_large_bird_meat.zip"),
}

and this:

inst.components.dryable:SetBuildFile("rack_large_bird_meat")
inst.components.dryable:SetDriedBuildFile("your_jerky_build_here")

in your prefab.

I'm also reasonably certain you don't need a separate anim file for the rack version? It's usually in with the same file that makes the raw meat visible when dropped on the ground.

Edited by Bumber64
  • Like 1

Thank you! I know your mod, I think it's very well done. 

I also think that two separate files aren't necessary too, but I haven't quite figured out how to do that yet. Is it just a matter of putting both images in the same folder before creating the project?

Like: exported > large_bird_meat > large_bird_meat > then inside that folder, I put the default images and the one that will be displayed on the drying rack? Or does the first folder need a separate folder for each image?

Like this (imagining it's raw meat):

jerky.jpg.5ef37764cf8e30fca823f6284ed91f17.jpg

And the prefab has:

inst.AnimState:SetBank("plantmeat_dried")
inst.AnimState:SetBuild("plantmeat_dried")
inst.AnimState:PlayAnimation("idle_dried_plant")
inst.scrapbook_anim = "idle_dried_plant"

I'm not entirely sure how it knows to use "dried_plant" for the rack animation. Perhaps it defaults to the first animation?

Edited by Bumber64

I imagine there's still a lot of room for improvement, but the important thing is that I learned how to do it. Thank you very much for your help @Bumber64 ❤️
I'll leave some files here, maybe they'll help someone else too.
 

local assets = {
	Asset("ANIM", "anim/large_bird_meat.zip"),
}

local function fn()
	local inst = CreateEntity()

	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddNetwork()

	MakeInventoryPhysics(inst)

	inst.AnimState:SetBank("large_bird_meat")
    inst.AnimState:SetBuild("large_bird_meat")
    inst.AnimState:PlayAnimation("idle")

    MakeInventoryFloatable(inst)

    inst:AddTag("dryable")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/large_bird_meat.xml"
    inst.components.inventoryitem.imagename = "large_bird_meat"

    inst:AddComponent("dryable")
    inst.components.dryable:SetProduct("meat_dried")
    inst.components.dryable:SetDryTime(TUNING.DRY_FAST)
    inst.components.dryable:SetBuildFile("large_bird_meat")
    inst.components.dryable:SetDriedBuildFile("meat_rack_food")

    MakeHauntableLaunch(inst)
    return inst
end

return Prefab("common/inventory/large_bird_meat", fn, assets)


image.png.5ab1c71bceb0b4c7f7c3c732518ea09d.png
image.png.97a5a66d08c34feaf28434c6b4cba4dc.png

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