Jump to content

[HELP] Custom food disappearing from the crockpot!


Recommended Posts

In my mod, I recently added Poutine as a crockpot item that can be cooked with a custom crop that my friends and I also added. After like, a month of struggling and almost resorting to poutine being a drop from a mob (how silly would that've been?), we finally got it to work in the crockpot.

Except... If the person cooking it isn't the server host, the poutine disappears in their inventory. In a sense.

It's still there in their inventory! But they can't see it or interact with it. That's an issue, considering that we added a temperature increase to it. It's almost essential to the character we modded in, aside from its health decrease (because honestly, french fries drenched in gravy and cheese is not good for you. Sorry, Canadians.)

Since finding this bug, I feel a bit bad. I wanted to get this update out asap so people knew that the mod was still being worked on, but we came across this major issue.


The only thing we could think to do to fix the issue was move inst.entity:SetPristine() above the "if not/then" conditional branch for TheWorld.ismastersim

Surely someone can help us?

Link to comment
Share on other sites

Will do. I'll put the code in a spoiler because it's huge.

 

Update: I made it a veggie so that the vegetarian character we modded in can eat it.

Spoiler

assets =
{
	Asset("ANIM", "anim/poutine.zip"),
		Asset("IMAGE", "images/inventoryimages/poutine.tex"),
    	Asset("ATLAS", "images/inventoryimages/poutine.xml"),
}


local function fn(Sim)
	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
	local anim = inst.entity:AddAnimState()
     MakeInventoryPhysics(inst)	
	
	inst.AnimState:SetBank("poutine")
     inst.AnimState:SetBuild("poutine")
     inst.AnimState:PlayAnimation("idle")
			
	inst.entity:SetPristine()
	
	if not TheWorld.ismastersim then
     return inst
  end	
		

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

     inst:AddComponent("stackable")
	inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM

     inst:AddComponent("edible")
     inst.components.edible.healthvalue = -TUNING.HEALING_SMALL
     inst.components.edible.hungervalue = TUNING.CALORIES_HUGE
	 inst.components.edible.sanityvalue = TUNING.SANITY_SMALL
	 inst.components.edible.foodtype = "VEGGIE"

     inst:AddComponent("perishable")

	inst.components.perishable:SetPerishTime(TUNING.PERISH_PRESERVED)
	inst.components.perishable:StartPerishing()
	inst.components.perishable.onperishreplacement = "spoiled_food"


		
   return inst
end

STRINGS.NAMES.POUTINE = "Poutine"

-- Randomizes the inspection line upon inspection.
STRINGS.CHARACTERS.GENERIC.DESCRIBE.POUTINE = {	
	"A hearty, heart stopping meal!", 
	"Wouldn't this block your arteries?", 
	"It tastes funny.", 
	 
}

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

 

 

Edited by DextersComicLaboratory
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...