[1.1 2581 Van] TakeFoodForAnimalInteractJob fails to find usable food

Started by Cloud_, March 28, 2020, 04:27:25 PM

Previous topic - Next topic

Cloud_

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". https://cdn.discordapp.com/attachments/460441627731689482/693550602265034803/unknown.png
Yet making a caravan where the handler has hay in their inventory works. https://cdn.discordapp.com/attachments/460441627731689482/693550544026992650/unknown.png
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.

Cloud_


ison

It's hard to say what happened here, maybe the food was unreachable or outside of the allowed area? A savefile would help here.