Ludeon Forums

RimWorld => Bugs => Topic started by: Cloud_ on March 28, 2020, 04:27:25 PM

Title: [1.1 2581 Van] TakeFoodForAnimalInteractJob fails to find usable food
Post by: Cloud_ on March 28, 2020, 04:27:25 PM
I had 14 berries and 1000+ hay in a stockpile. They were not reserved by any other colonist or disallowed.

My Handler could not tame a wild Bison or train my own Bisons/Muffaloes, because of "no usable food".
Yet making a caravan where the handler has hay in their inventory works.
Spawning in hundreds of corn or hundreds of berries also made me able to train.

I tried looking into the code about the whole animal taming foods thing. Looks like requirements for whether or not a colonist has acceptable food in its inventory to interact are:
• that the animal basically has the thing listed in its diet (a Bison is a VegetarianRoughAnimal which does eat stuff like hay & meals under normal circumstances)
• that the food has a preferability of <= RawTasty (which only excludes all 4 types of meals)
• that the food is not a drug

Stuff like rice is RawBad (TIL rice are the only thing that fall under "seeds" in the diet list), and hay is DesperateOnlyForHumanlikes, and these are "below" RawTasty. Also found out that taming & training have the exact same required food conditions.

Then, the colonist also needs to have in its inventory (not just carrying) at least enough nutrition for a feeding. This is 15% of the animal's max food amount, but can go no lower than 0.3 nutrition. Max food amount is calculated using the animal's current body size (scaled by generic life cycle stage) as well as the food factor of its generic life cycle stage.

Or if all this isn't the case (fails to HasFoodToInteractAnimal), it can try to TakeFoodForAnimalInteractJob, which will find the "best" food on the entire map that is <= RawTasty. It'll try to take just enough food for up to 8 feedings. This part is complex af. But there's definitely something wrong in there, I think it's a bug, as I expect my colonist to go pick up hay for taming in the screenshot scenario above, when they didn't have it in their "inner container".

I am not entirely sure how big the scope of the bug is. Whether it's limited to large quantities of hay in many stacks (eg 1000+ hay), whether it's limited to tiny quantities of berries that aren't enough to hit 8 feedings (JobDriver_InteractAnimal.RequiredNutritionPerFeed(tamee) * 2f * 4f) worth of total nutrition amount but are enough for at least a single feeding (eg 14 berries), whether it's limited to VegetarianRoughAnimals etc. But steps to make this particular instance of the issue happen would involve attempting to interact (train/tame) with animals such as Bisons & Muffaloes with 1000+ hay &/or 14 berries in a stockpile.
Title: Re: [1.1 2581 Van] TakeFoodForAnimalInteractJob fails to find usable food
Post by: Cloud_ on May 05, 2020, 06:52:36 AM
Giving this a bump, hope that's okay.
Title: Re: [1.1 2581 Van] TakeFoodForAnimalInteractJob fails to find usable food
Post by: ison on May 21, 2020, 09:08:44 AM
It's hard to say what happened here, maybe the food was unreachable or outside of the allowed area? A savefile would help here.