Valheim
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
last month
Downloads
663
Size
25KB
ADDatHost Valheim hosting
30% off

Nishinku's SmelterLink

Mark a specific input, fuel and output chest per smelter, kiln, blast furnace, windmill or spinning wheel. Linked smelters keep running while you are away from them.

Built against Valheim 1.0.12 (network version 40, Unity 6000.0.75), BepInEx 5.4.2350.

Using it

Marking hangs off the switches the smelter already has, so what you are looking at decides what you are about to set:

Looking at Press G to set
the ore / item slot input chest
the fuel slot fuel chest
the empty / output slot output chest

The hover text on each switch says which one it is and what is currently linked. Once selection has started, a panel appears at the top of the screen showing all three slots, and every chest you look at says what it would become.

Key While selecting
G on a chest Bind it to the active slot
1 / 2 / 3 Switch to input / fuel / output
X Clear the active slot
Esc Cancel

The 1 / 2 / 3 fallback exists because not every piece has all three switches — a charcoal kiln has no separate fuel slot, for instance.

Lines are drawn to whatever is already linked while you are marking. Several smelters can point at the same chest, and distance does not matter.

The linker rod

A craftable rod that makes the whole network visible at once. Workbench, 5 wood, 1 surtling core, 2 resin.

While it is in hand:

  • every link within Range (default 64m) is drawn, colour-coded per slot
  • looking at a chest fades all links except the ones touching it
  • a chest's hover text says what it feeds — Feeds: 3 input 1 fuel, or that it is unused

Marking still works without the rod; the rod is for reading a base rather than editing one.

The rod is registered through Jotunn and reuses the club model, so it looks like a wooden stick. Change the second argument of the CustomItem call in src/LinkerTool.cs to clone something else. Because it is a modded item, any rod sitting in an inventory will be dropped from the save if this mod is ever uninstalled.

Why a marked chest is better than a radius

Vanilla picks the first item in m_conversion that it can find — there is no notion of preferring one fuel over another. A charcoal kiln will happily eat core wood and fine wood. Radius-based feeder mods inherit the same problem from the other side: they pull from whatever chest happens to be nearby.

Linking makes the chest itself the filter. A kiln pointed at a wood-only chest burns wood and nothing else, and when that chest runs dry the kiln stops instead of moving on to your building material.

Running while unloaded

Valheim only instantiates objects in loaded zones, but all of a smelter's state — fuel, the ore queue, the bake timer, the pending output — lives in its ZDO, and a chest's contents live in its ZDO as a serialised ZPackage under items. In singleplayer the whole ZDO database is resident in memory, so this mod runs the conversion loop directly on that data. No zones are kept alive and no physics or AI is simulated.

Offline production requires a linked output chest, because there is nowhere to put the result otherwise — the vanilla code path instantiates an ItemDrop at the smelter, which needs the object to exist.

Two things the simulation cannot observe without the object: the roof check and windmill wind. Both are cached in the ZDO on every vanilla tick, so they reflect the last time you were standing there.

The vanilla 1-hour cliff

Vanilla smelters do advance while unloaded — Smelter.UpdateSmelter computes elapsed time from StartTime in the ZDO — but the accumulator is clamped to 3600f. Being away for five hours yields one hour of smelting and discards the rest. This mod ticks continuously, so the clamp never comes into play. MaxCatchupSeconds sets the mod's own limit (default 24h).

World time only advances while the world is loaded, so closing the game does not bank production.

Config

BepInEx/config/nishinku.smelterlink.cfg

Setting Default
LinkKey G Marking hotkey
TickInterval 2 Seconds between background passes
OfflineSmelting true Run unloaded smelters
MaxCatchupSeconds 86400 Cap on catch-up per smelter
Range 64 How far the linker rod reveals links
Verbose false Log every transfer

Known conflicts

Any mod that feeds smelters from nearby containers by radius will fight the explicit links. AutoFuel is the common one: set SmelterOreRange and SmelterFuelRange to 0 in aedenthorn.AutoFuel.cfg to keep its torch and firepit refuelling while taking it off smelters. It is not in the active Thunderstore profile, so this does not currently apply.

Building

Requires the .NET SDK.

dotnet build NishinkusSmelterLink.csproj -c Release

The build copies the DLL into the live BepInEx profile. Two paths in NishinkusSmelterLink.csproj control this:

  • ValheimDir — the Steam install, used only for the assembly references
  • ProfileDir — the Thunderstore Mod Manager profile the game actually launches with

The game is started through Thunderstore Mod Manager, which loads BepInEx from the profile folder rather than from the Steam directory; the BepInEx tree inside the Steam folder is a separate, unused Vortex deployment. Update ProfileDir when switching profiles.

Because the plugin is dropped into the profile by hand it does not appear in the mod manager's list, and a profile repair or reinstall may remove it. Re-running the build puts it back.

Packaging

powershell -File tools\pack.ps1

Builds, validates and writes dist/NishinkusSmelterLink-<version>.zip ready for Thunderstore. Validation covers the things the upload form rejects: package name characters, semver, the 250-character description limit, a 256×256 icon, and the version matching across manifest.json, Plugin.cs and the csproj.

Bump the version in all three of those before packaging. tools\make-icon.ps1 regenerates the icon.

Status

Built and tested for singleplayer.

Links live in the ZDO so they replicate on their own, and clients get feeding and output routing for loaded smelters. But only the host simulates unloaded smelters — two peers running the conversion loop over the same smelter would produce the same bar twice — and none of the multiplayer paths have been tested. Treat shared worlds as unproven.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.