Jump to content

Custom item Does not appear in crafting


Recommended Posts

This is a mod item being an ingredient of another mod item and i don't know what's happening but I can't get the icon for this item to show up, the atlas and Txt are already added in mod main and in ghost_jar.lua

This is the recipe

Recipe("viviana", {Ingredient("ghost_jar", 1), Ingredient("reviver", 1), Ingredient("boards", 5), Ingredient("marble", 3)}, RECIPETABS.SURVIVAL, TECH.SCIENCE_TWO, 
{no_deconstruction = false}, nil, nil, 1, nil,
"images/inventoryimages/viviana.xml",
"viviana.tex")

image.png.edecd7703a55da5ef9059433478e2247.png

and this is that part of  ghost_jar.lua

local function fn()
    local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

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

    inst:AddTag("ghost_jar")
    inst:AddTag("nonpotatable")
 

    MakeInventoryFloatable(inst, "med", nil, 0.7)

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("leader")
    inst.components.leader.onremovefollower = OnLoseChild

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

	inst:AddComponent("spellcaster")
	inst.components.spellcaster:SetSpellFn(ghost)
    inst.components.spellcaster.CanCast = canuse
    inst.components.spellcaster.veryquickcast = true
    inst.components.spellcaster.canusefrominventory = true

    inst:AddComponent("timer")

    inst:ListenForEvent("timerdone", ontimedone)
    inst:ListenForEvent("onremove", killghost)

    MakeHauntableLaunch(inst)

    inst.OnPreLoad = OnPreLoad
    inst.OnSave = OnSave

    inst:DoTaskInTime(0, OnInit)

    inst.ghost = nil

    return inst
end

return Prefab("ghost_jar", fn, assets)

This is something I had not done before and im may also be blocked but I can't find the solution.

Edited by Terry_Rosario
  • Like 1
Link to comment
Share on other sites

Don't worry anymore
I already discovered how to do it and I hope this helps those who have the same problem in the future, I had to specify in the recipe where the atlas is located I also updated the recipe.

AddRecipe2(
	'viviana',
{Ingredient("ghost_jar", 1, "images/inventoryimages/ghost_jar.xml"),Ingredient("reviver", 1),Ingredient("boards", 5),Ingredient("marble", 3)}, 
    TECH.NONE,
    {
        
        atlas = 'images/inventoryimages/viviana.xml',
        image = 'viviana.tex',
        
    },
    {'MAGIC'}
)

image.png.1e3b4335cea8f5397f617b1bdb60d88b.png

  • Like 1
Link to comment
Share on other sites

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
 Share

×
  • Create New...