HornOfCalling
Craft a horn at the Workbench that sounds a blast other players hear out to 64 m. Made for no-map servers where finding each other is part of the game.
模組介紹 作者原文
Horn of Calling
Adds a craftable Horn of Calling to the Workbench. Equip it and left click to sound
a blast. Its volume is a slider on the Audio tab of the game's settings menu.
Status: in progress. The horn looks and sounds right, costs 1 Bronze + 1 Deer
Hide at a level 1 Workbench, and is heard by other players out to 64 m. What is left
is the behaviour: see Not done yet.
Plain BepInEx + Harmony, no extra runtime dependency — install HornOfCalling.dll into
BepInEx/plugins/ and nothing else.
The mod adds an item and a recipe, so it needs to be on every client and on the
dedicated server.
Building
dotnet build HornOfCalling/HornOfCalling.csproj -c Release
Defaults to the Linux Steam install (~/.local/share/Steam/steamapps/common/Valheim),
falling back to the default Windows path. Override it by creating
Directory.Build.user.props next to Directory.Build.props (gitignored):
D:\Games\Valheim
A successful build copies the DLL straight into BepInEx/plugins. There is no hot
reload — restart the game after each build.
The build errors early with a named message if assembly_valheim.dll or BepInEx.dll
can't be found, rather than emitting a wall of CS0246.
How it works
Three registration steps, all idempotent, driven from Harmony postfixes in
src/Patches.cs:
| Step | Where | Why there |
|---|---|---|
| Clone the prefab, add to ObjectDB.m_items | ObjectDB.Awake, ObjectDB.CopyOtherDB | ObjectDB is built twice — a stripped main-menu copy, then the real world one |
| Add the Recipe | any of the three patches | Needs the Workbench, which is a piece and may not exist at the first ObjectDB.Awake |
| Add to ZNetScene.m_prefabs / m_namedPrefabs | ZNetScene.Awake | Lets the item and its sound effect exist as networked objects |
The item is cloned from the vanilla Horn of Celebration (prefab TankardAnniversary),
which supplies the horn model, the icon and the hold pose without an AssetBundle.
The clone needs three things undone. Its m_ammoType is "mead" — vanilla, the horn
drinks a mead from your inventory when you sound it, and refuses to sound at all without
one — so that is cleared. Its inherited weapon stats (knockback, backstab, block, parry)
are zeroed so the tooltip is just the flavour text. And its start effects, a mead splash
and a burp, are replaced by the blast.
The blast is not played by a patch. The clip — a 16-bit PCM WAV embedded in the
assembly, decoded in src/HornSound.cs — is hung off the item's
m_startEffect, which the game fires once per attack after the stamina check. That
also routes it through the SFX mixer group, so the player's volume slider applies.
The clip is peak-normalised to −0.3 dBFS, and that is the whole of the horn's loudness at
100%: Unity clamps AudioSource.volume at 1, so once the mod asks for full volume the
only headroom left is inside the recording.
The volume row in src/VolumeSlider.cs is the vanilla SFX row
cloned: the Slider sits on the row GameObject with its caption and percentage as
children, so one Instantiate copies the whole thing. It is then retitled, spliced into
the tab's navigation chain, and pointed at the config entry.
Settings
Settings → Audio → Horn of Calling, sitting under the three vanilla volume sliders.
It moves live while you drag it, saves on OK and is discarded on Back, the same as
the sliders above it.
The value is stored in BepInEx/config/com.greg.hornofcalling.cfg:
[Audio]
How loud the horn blast is, as a fraction of the recorded level. [...]
Setting type: Single
Default value: 1
Acceptable value range: From 0 to 1
BlastVolume = 1
Editing the file, or the F1 ConfigurationManager overlay if you have it, applies without
a restart — the settings row is a front end for this entry, not a separate setting.
It multiplies Valheim's own sound-effects volume rather than replacing it, and it is
per player: it changes every blast you hear, whoever sounded it, and never what
anyone else hears. That is why it is not synced through MushroomSync — see
docs/CONTEXT.md.
The
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
下面這些內容需要先安裝,否則該模組不會生效: