Choosing Health potions

I`m into business with the herbalist and designed some new healing potions. As i did so i tried to find out which function is controlling the choosing.

I couldnt find any. *Its not driven by item level like equipment
*it`s not the heal target.lua (which is only giving the need of healing back and the usability by the herbalist, right?)

So the question is:
Is there a function which compares the needed healing of the hearthling to the potential healing of a potion or bandage ?
I would like to have more control over the used consumables if possible or a hearthling will drink a potion for regenerating 1 health which was awfully hard to produce.

Explanation or a hint where to find that would be nice.

I thought they always got the strongest healing item. But it seems they grab a random healing item.

Checking the herbalist abilities, he has “stonehearth:ai_pack:healing”

At the pack, there is:

  "stonehearth:actions:health:heal_entity",
  "stonehearth:actions:health:heal_entity_adjacent",
  "stonehearth:actions:health:heal_self"

And looking at those there is nothing besides “check a stockpile with a healing item”, which is heavily based on having the correct filter in the stockpile and correct tags in the item.

Thanks @BrunoSupremo
i red the luas you pointed to.

It`s a bit sad that it works like that, but anyway than my new healing potions are just produced for the fun of it or because of an overdose of resources.

Maybe in the future there will be some compare health needed to health provided by healing item function.