Sign in to follow this  
Cunning fox

[Solved] FOODGROUP problem

Recommended Posts

Cunning fox    706

Hello everyone! I'm trying to add cannibal character. As far as I know, to set some kind of diet to character, you beed to add:

inst.components.eater:SetDiet({ FOODGROUP.OMNI }, { FOODGROUP.CANNIBAL })

I'm adding a new food group with following code:

FOODGROUP = GLOBAL.FOODGROUP
FOODTYPE = GLOBAL.FOODTYPE
 
FOODGROUP.CANNIBAL = {
    name = "CANNIBAL",
    types = {
        FOODTYPE.HUMAN
    }
}

But if I'm lauching server, character can't eat any food. What i'm doing wrong?

Edited by makar5000
  • Like 1

Share this post


Link to post
Share on other sites
. . .    4059

Put this in your modmain.lua

GLOBAL.FOODTYPE.CANNIBAL = "CANNIBAL"

local cannibal = { "humanmeat", "humanmeat_cooked", "humanmeat_dried", }

local function AddCannibal(inst)
inst:AddTag("edible_"..GLOBAL.FOODTYPE.CANNIBAL)
end

for k,v in pairs(cannibal) do
AddPrefabPostInit(v, AddCannibal)
end

 and then put this in YOURCHARACTER.lua inside master_postinit

inst.components.eater:SetDiet({ FOODTYPE.CANNIBAL }, { FOODTYPE.CANNIBAL })

 

I think this should work,  I think :)!

Edited by SuperDavid

Share this post


Link to post
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
Sign in to follow this