Jump to content

RemoveItem works fine in Caves, but not Forest in a specific save

Recommended Posts

Basically, I've been playing with a Gorge mod I made, built on top of another gorge mod and reached 270 days on a Caves + Forest world with someone else.

As we were ready to start playing around with the mod itself, it turned out it's not behaving as it did when I was testing it. Problem is that taking pots and casseroles back from the cooking stations doesn't return them.

I investigated a lot and I noticed that when I print out all existing entities, in FOREST, the dish is no longer present as an entity when the dish is placed in the station (they use the shelf component, like bird cage and lureplant). In CAVES, the mod behaves just fine and the dish is present in the entity list when places in the station and is returned just fine.

for k, v in pairs(Ents) do 
	if string.find(tostring(v), "casserole") then 
		print("v="..tostring(v), "k="..tostring(k)) 

I tracked down the problem area to be RemoveItem function in inventory component. But I'm lost on what to do next. I find it mostly weird that the instance is not nil even when removing the dish from the station.

local function SetDish(inst, doer, dish)
    if inst.dish ~= nil and dish == nil then
        local overridebuild = "quagmire_" .. string.sub(inst.dish.prefab, 4)
        inst.dish = nil
        inst.components.shelf.cantakeitem = false
    elseif inst.dish == nil and dish ~= nil then
        local removed_dish
        if doer then
            print("### Removed dish")
            removed_dish = doer.components.inventory:RemoveItem(dish) -- it all goes loose here
        inst.dish = dish
        local overridebuild = "quagmire_" .. string.sub(inst.dish.prefab, 4)
        inst.components.shelf.cantakeitem = true

And SetDish is called here:

		if act.target ~= nil and act.target.components.specialstewer then
			if act.target.dish == nil and act.invobject.components.specialstewer_dish then
				if act.invobject.components.specialstewer_dish:IsDishType(act.target.components.specialstewer.cookertype) then
					act.target:SetDish(act.doer, act.invobject)
					return true


If I try the mod on a new world or regenerate the current one, it works fine. I tried despawning my character, deleting the user instance but nothing works.

I uploaded the world and the mod in question. I setup the oven at the cave entrance and exit for a quick test.


Please help, I don't want to restart the world...

World.7z Gorge Experience.7z

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

  • Create New...