Jump to content

Recommended Posts

On 1/29/2022 at 5:05 PM, -t- said:

I see. To do that you'll have to add FOODTYPE.SCRAP to your characters diet.


if inst.components.eater ~= nil then
	inst.components.eater:SetDiet({ FOODGROUP.OMNI, FOODTYPE.SCRAP })
end

 

Hey, sorry for late reply, life happened

I tried to put it in, but couldn't get it to work at all, I keep getting error about OnEat not being declared. Mod only went through loading/character selection when I deleted this

    if inst.components.eater ~= nil then --Let em eat scrap
        --inst.components.eater.ignoresspoilage = true
        --inst.components.eater:SetCanEatGears()
        inst.components.eater:SetOnEatFn(oneat)
    end

But it rendered DA unable to consume the item

client_log.txt Daycare Attendant.rar

1 hour ago, -t- said:

Try replacing attendant.lua with this:

attendant.lua 5.33 kB · 0 downloads

Changing lua allowed me to join the server, but rendered DA unable to eat the trinket_16 and when I tried to spawn antliontrinket game crashed

client_log.txt

Ah, I see where's the problem. In modmain.lua you have:

AddPrefabPostInit("antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5", ModTrinkets)

AddPrefabPostInit can change only 1 prefab at a time. That's why "antliontrinket" causes a crash an why the rest of them are not edible.

To edit all those trinkets you should iterate through a table with all of them:

local trinkets_table = {
	"antliontrinket",
	"trinket_16",
	"trinket_31",
	"trinket_29",
	"trinket_22",
	"trinket_14",
	"trinket_24",
	"trinket_18",
	"trinket_19",
	"trinket_15",
	"trinket_30",
	"trinket_28",
	"trinket_7",
	"trinket_2",
	"trinket_11",
	"trinket_1",
	"trinket_5"
}

for i, trinket in ipairs(trinkets_table) do
	AddPrefabPostInit(trinket, ModTrinkets)
end

 

  • Thanks 1
4 minutes ago, -t- said:

Ah, I see where's the problem. In modmain.lua you have:


AddPrefabPostInit("antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5", ModTrinkets)

AddPrefabPostInit can change only 1 prefab at a time. That's why "antliontrinket" causes a crash an why the rest of them are not edible.

To edit all those trinkets you should iterate through a table with all of them:


local trinkets_table = {
	"antliontrinket",
	"trinket_16",
	"trinket_31",
	"trinket_29",
	"trinket_22",
	"trinket_14",
	"trinket_24",
	"trinket_18",
	"trinket_19",
	"trinket_15",
	"trinket_30",
	"trinket_28",
	"trinket_7",
	"trinket_2",
	"trinket_11",
	"trinket_1",
	"trinket_5"
}

for i, trinket in ipairs(trinkets_table) do
	AddPrefabPostInit(trinket, ModTrinkets)
end

 

Worked like a charm! So I thought it was this piece of code failing me, thanks for help, saved me from this hole here

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