You are viewing a potentially older version of this package. View all versions.
Dafini-Manger-1.0.2 icon

Manger

A feeding trough for tames. Put a stack of feed on it and animals come and eat, using the game's own feeding - so it fills hunger, keeps them breeding, and tames wild ones that wander in.

Date uploaded 2 weeks ago
Version 1.0.2
Download link Dafini-Manger-1.0.2.zip
Downloads 280
Dependency string Dafini-Manger-1.0.2

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2350 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2350

README

Manger

A feeding trough for your animals.

Build one, use a stack of feed on it, and the feed sits there where tames can get at it. They come over, eat from it one at a time, and the stack goes down. When it is empty, it is empty.

It uses the game's own feeding

This is the whole design and it is why the trough does what you would expect rather than an approximation of it. Valheim already walks hungry tames to food on the ground, already checks whether that particular creature eats that particular thing, already takes exactly one, already plays the eating animation, and already counts it toward taming.

So the trough does not feed anything. It holds a real item where animals can reach it, and gets out of the way. Nothing about feeding is patched.

What falls out of that for free:

  • Hunger and breeding work exactly as they do with food thrown on the ground.
  • Taming works too. Feeding a wild tameable is how taming happens, so a stocked trough tames boar — and wolves, which are also tameable — that wander in and eat. That is on purpose. TamesWild = false if you would rather it did not.
  • Modded creatures are handled without this mod knowing they exist. What counts as feed is read off the animals in your install, not from a list written here, so a mod that adds a tameable that eats mushrooms makes mushrooms trough feed on that install.

Using it

Use stocks it — finds the feed for you
modifier + Use takes everything back
use an item on it stocks with that specific item

Pressing Use without choosing anything looks for the next viable feed: your own bag first, then chests within 8m (Reach, set to 0 for bag-only). It will not touch a chest somebody is using, one set to anything but public, or one inside a ward you are not admitted to.

A stocked trough only takes more of what it already holds, so this tops up and never swaps.

One food per trough — it holds a visible stack, and a mixed trough would have to lie about what is in it. manger in the console lists everything the animals on your install will eat.

What it will not do

  • It will not take feed into a ward you are not admitted to. No baiting or taming things into somebody else's base.
  • It cannot duplicate anything. The item on the trough is the contents — there is no second store to drift out of sync with it.
  • It will not feed anything untameable. Not a rule this mod enforces; the game checks for a Tameable before it ever looks for food, so a hostile never enters the path at all.

A warning worth reading

A permanently stocked trough will breed a pen unsupervised. That is what it is for, and Valheim handles very large herds badly. BreedingCap stops feeding once there are that many tames near the trough; it is 0 (no cap) by default, because it is your pen.

Settings

BepInEx/config/dafini.manger.cfg

Setting Default What it does
Capacity 50 How much one trough holds
TamesWild on Wild animals that eat from it get tamed
BreedingCap 0 Stop feeding past this many nearby tames. 0 is no cap
Reach 8m How far into nearby chests Use will look. 0 = your bag only

Multiplayer

Client-side. The trough's contents live in the world, so everyone already agrees about them. Everyone who wants to build one needs the mod; nobody else has to.

CHANGELOG

Changelog

1.0.2 — two QOL fixes, and a third thing they uncovered

$KEY_Use was showing raw

Hover text is not localized for you, and this is worth writing down because the strings vanilla pieces return look identical to the ones a mod writes, so it is natural to assume the game does it. It does not: Hud.UpdateCrosshair takes whatever Hoverable.GetHoverText() returns, does two gamepad sprite swaps, and puts it straight onto the label. Every vanilla piece calls Localization.instance.Localize(...) on its own text first.

Two things fell out of fixing it. Localization lives in assembly_guiutils, not assembly_valheim — so the csproj now references it, and the API lint (which only indexes assembly_valheim) had to be told that is a real type rather than a missing one. And the modifier is now the $KEY_AltPlace token rather than a typed-out "L Shift", which was the same bug wearing different clothes.

The trough told you one thing and did another

The hover advertised modifier + Use to take the feed back, while plain Use actually did it — and there was no way at all to stock without picking an item first.

Now, and the hover says exactly this:

Use stock it
modifier + Use take it all back
use an item on it stock with that specific item

Both come from Wording, which is the only place either is written down, so they cannot drift apart again.

Use now finds the feed for you

Press Use with nothing chosen and the trough looks for the next viable feed: your own bag first, always, then chests standing within Reach (default 8m, set it to 0 for bag-only).

This reaches further than the Smoke Hook does on purpose. The hook takes from your bag and nothing else, and its own note argues for that — what goes on the hook is what you are carrying, same as a cooking spit. A trough is different: it is farm infrastructure, it lives among the chests that feed it, and topping it up from the chest two metres away is the thing you were going to do anyway.

What it will not take from: a chest somebody is using, a chest set to anything other than public, one inside a ward you are not admitted to, or one with nothing in it. Container.CheckAccess is private, so the judgement is made from the public privacy setting plus the ward check — conservative on purpose. "My mod emptied my friend's chest" is the worst report a convenience feature can produce.

A stocked trough only ever takes more of what it already holds, so scrounging can top up but never silently swaps the feed.

1.0.1 — the trough was never in the build menu

Reported plainly and it was three bugs stacked, the first of which hid the other two.

One flag standing in for three jobs

Registration is three separate achievements — a prefab ZNetScene can instantiate, an entry in the hammer, and reading what this install's animals eat — and 1.0.0 tracked all three with a single Built flag that was set after the hammer step ran, whether or not it had worked.

So a failure there was permanent (nothing retried) and invisible (manger reported "in the build menu" about a menu the trough was not in). A readout that cannot report a fault is worse than no readout, because it spends somebody's evening.

The three now succeed, fail and retry independently, and the console reports each on its own line.

ObjectDB was not up yet

That hammer step needed ObjectDB.instance, and the only moment it ever looked was inside a ZNetScene.Awake prefix. ObjectDB is a different object with no guaranteed Awake order, so it was almost certainly null — one look, at the wrong time, with the failure swallowed by the bug above.

Every stage is now attempted from every hook that might be the one where its prerequisite is finally up — ZNetScene.Awake, ObjectDB.Awake, ObjectDB.CopyOtherDB (the one that runs when joining a world) and Player.OnSpawned as a last chance. Each is idempotent. There is also a fallback that finds the hammer's table through Resources without ObjectDB at all, by looking for the table containing the workbench.

The feed list was never read

LearnMenu was written and called from nowhere. Nobody hit it because nobody could build a trough, but it was next: an empty feed list means every item is refused, and a trough that rejects carrots looks broken rather than uninformed.

Smaller

  • The donor is now a list of candidates rather than one prefab name, so a renamed or absent prefab costs the trough its looks rather than its existence. manger says which was used.
  • manger reports prefab / build menu / diets separately, plus the last thing it was waiting for.

On the tests

The first re-break of this fix passed all 50 assertions — the suite did not cover the exact failure that shipped, because a pure predicate cannot catch a sequencing bug. The seating step now returns whether it succeeded, and there is a regression test that drives the real path with no hammer table available and insists the flag stays down. Re-confirmed by re-introducing the original bug: it fails two assertions.

1.0.0 — first release

A feeding trough for tames.

  • Uses the game's own feeding, unpatched. The trough holds a real item where animals can reach it and does nothing else. Hunger, breeding, taming, the eating animation and per-creature diets all work because none of them were reimplemented.
  • Tames wild animals that wander in and eat, because feeding a wild tameable is how taming works. TamesWild = false to stop it. Note wolves are tameable.
  • Feed is read off your install's animals, not a list written into the mod, so modded creatures' diets work without this mod knowing they exist.
  • Cannot duplicate. The item on the trough is the contents — there is no second store.
  • Will not stock inside a ward you are not admitted to.
  • No dependencies. No Jötunn, no asset bundle.
  • manger in the console says whether the piece registered and lists what animals will eat.