Jump to content

Recommended Posts

So. I used to be able to do this in Don't Starve, but here we are again. The old way of limiting food items does not work in DST!

I've looked all over the forums without much success-- nothing seems to be working so far. This is what I use ( and what used to work in DS ):

 

local forbidden_foodset = {        berries = true,	berries_cooked = true,	pomegranate = true,	pomegranate_cooked = true,	dragonfruit = true,	dragonfruit_cooked = true,	durian = true,	durian_cooked = true,	cave_banana = true,	cave_banana_cooked = true,	carrot = true,	carrot_cooked = true,	pumpkin = true,	pumpkin_cooked = true,	corn = true,	corn_cooked = true,	eggplant = true,	eggplant_cooked = true,	mandrake = true,	cookedmandrake = true,	mandrakesoup = true,	lichen = true,	dragonpie = true,	red_cap = true,	red_cap_cooked = true,	green_cap = true,	green_cap_cooked = true,	blue_cap = true,	blue_cap_cooked = true,	jammypreserves = true,	pumpkincookie = true,	} function pickyeater(inst)    if inst.prefab == "sannom" then        inst.components.eater:SetCanEatTestFn(function(inst, food)            return not food.prefab or not forbidden_foodset[food.prefab]        end)    endendAddPlayerPostInit(pickyeater)

That is in the modmain.lua.

Here's what I have in my prefab:

 

	inst.components.eater.foodprefs = { "MEAT", "VEGGIE", "GENERIC", "INSECT" }	inst.components.eater.strongstomach = true

Again, I'm very aware things are a bit different around DST, and alas I am @#!%-poor at scripts and the like.

As you can see, I'm trying to make the character an anti-veggie/fruit freak, while leaving things like seeds and butterfly wings in. I only need to remove -some- items from -some- food categories.

Anyone wants to lend a hand?

Would be greatly appreciated.

Link to comment
Share on other sites

@Sannom, In DST, it uses the edible_MEAT, etc, tags to determine whether something can be eaten or not. This is because CanEat only runs on the server. You can use the approach that I posted on here: http://forums.kleientertainment.com/topic/48308-how-do-i-make-my-character-able-to-eat-grass/?p=596545

 

Edit: Since you want to clear everything else out, you probably want to set foodprefs to just { FOODTYPE.BIRDFOOD } or whatever you rename it to.

Edited by rezecib
Link to comment
Share on other sites

Thanks! I'll give it a shot. So many little things have changed, it's hard to keep track of what's outdated and what isn't!

EDIT:

Before I do anything stupid, I take it that this bit ( albeit with every edible piece of food added into it )
 

GLOBAL.FOODTYPE.BIRDFOOD = "BIRDFOOD"local bird_food = {"insert_food_items_here","and_here","etc"}local function AddBirdFood(inst)    inst:AddTag("edible_"..GLOBAL.FOODTYPE.BIRDFOOD)endfor k,v in pairs(bird_food) do    AddPrefabPostInit(v, AddBirdFood)end

would go in modmain.lua?

EDIT #2:

Call me blind but I cannot find a list of all items if my life depended on it. Such a list would be useful, since names vary from the actual in-game names at times.

Edited by Sannom
Link to comment
Share on other sites

I'm using the speech.lua files to get item names... I think that should do the trick. I'll let you know in a few moments.

EDIT!!!!

YOU ARE AMAZING. Everything works SPLENDID, just like it should! I don't think I've ever solved a modding problem so quickly before, and it's all thanks to you. I hope this helps anyone who comes across this obstacle.

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