Jump to content

Recommended Posts

I'm completely clueless as to where exactly the crashing is coming from and I'd like to salvage the world I've been playing without ripping out mods. I'll provide the logs and errors if anyone wants to take a look and identify a problem.

kV4ySP9.jpg

It's definitely custom item related as removing the item allows the world to play again. I still need to know why though.

client_log.txt

Edited by Eranthis

 

Try insert this to the end of modmain.lua

local containers = GLOBAL.require("containers")
local oldwidgetsetup = containers.widgetsetup
containers.widgetsetup = function(container, prefab)	
	if not prefab and container.inst.prefab == "healthkit" then		
		prefab = "backpack"	
	end	
	oldwidgetsetup(container, prefab)
end

 

4 minutes ago, Hunger Artist said:

 

Try insert this to the end of modmain.lua


local containers = GLOBAL.require("containers")
local oldwidgetsetup = containers.widgetsetup
containers.widgetsetup = function(container, prefab)	
	if not prefab and container.inst.prefab == "healthkit" then		
		prefab = "backpack"	
	end	
	oldwidgetsetup(container, prefab)
end

 

Still crashing. I'll provide another log file in case it helps.

client_log.txt

 

Instead of this(in healthkit.lua)

    inst:AddComponent("container")
    inst.components.container:WidgetSetup("backpack")

Try another code
 

    inst:AddComponent("container")
    healthkit =	{
        widget =
        {
            slotpos = {},
            animbank = "ui_backpack_2x4",
            animbuild = "ui_backpack_2x4",
            pos = Vector3(-5, -50, 0),
        },
        issidewidget = true,
        type = "pack",
    }
    for y = 0, 3 do
        table.insert(params.backpack.widget.slotpos, Vector3(-162, -75 * y + 114, 0))
        table.insert(params.backpack.widget.slotpos, Vector3(-162 + 75, -75 * y + 114, 0))
    end
    inst.components.container:WidgetSetup("healthkit", healthkit)

I took it from Starter Guide:

 

erbewww.png

Or you can try something like this(paste it to the end of modmain)

-- CONTAINERS:
local containers = GLOBAL.require("containers")
local oldwidgetsetup = containers.widgetsetup
_G=GLOBAL
mods=_G.rawget(_G,"mods")or(function()local m={}_G.rawset(_G,"mods",m)return m end)()
mods.old_widgetsetup = mods.old_widgetsetup or containers.smartercrockpot_old_widgetsetup or oldwidgetsetup
containers.widgetsetup = function(container, prefab, ...)
    if (not prefab and container.inst.prefab == "healthkit") or (prefab and container.inst.prefab == "healthkit") then
		prefab = "backpack"
    end
    return oldwidgetsetup(container, prefab, ...)
end

Source:

 

Edited by Hunger Artist
2 hours ago, Hunger Artist said:

Or you can try something like this(paste it to the end of modmain)


-- CONTAINERS:
local containers = GLOBAL.require("containers")
local oldwidgetsetup = containers.widgetsetup
_G=GLOBAL
mods=_G.rawget(_G,"mods")or(function()local m={}_G.rawset(_G,"mods",m)return m end)()
mods.old_widgetsetup = mods.old_widgetsetup or containers.smartercrockpot_old_widgetsetup or oldwidgetsetup
containers.widgetsetup = function(container, prefab, ...)
    if (not prefab and container.inst.prefab == "healthkit") or (prefab and container.inst.prefab == "healthkit") then
		prefab = "backpack"
    end
    return oldwidgetsetup(container, prefab, ...)
end

Source:

 

No dice with the suggested inst:AddComponent("container") code for the healthkit.lua (although I did still have your first suggested container code for the modmain.lua in case that might be a factor for it) but the good news is that the second container strings for the modmain seemed to work. I can go back into my old world, apply the item and start a new game without crashes.

I'm not sure if I should jot this down as solved just yet just in case another expected error occurs but for now, I think my problem is solved. I really wish I had a better grasp on the code so I didn't have to desperately ask for every problem that occurs. Still you're a life saver, thanks!

3 minutes ago, Eranthis said:

although I did still have your first suggested container code for the modmain.lua in case that might be a factor for it

You should delete it since it doesn't work properly.

Edited by Hunger Artist

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