From 5f74c57e72718ef3a3682eca4a2a43c3a80fdf7c Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Fri, 18 Sep 2026 17:13:16 +0200 Subject: [PATCH] fix: race buildings keep their own message when an item is used on them Humanoid.UseItem shows the generic $msg_cantuseon whenever the interactable's UseItem returns false, covering the refusal message the building had just shown. Same fix as the Trol totem in v1.4.18, applied to the Servant table, Dvergar barrel and bank, Fenrir trough, Draugr and Skeleton piles, Blood Refinery, Grove and Composter: an item in hand always counts as handled. Empty-handed interactions are unchanged. Co-Authored-By: Claude Opus 5 --- JotunnModStub/Aswid/BloodRefineryBehaviour.cs | 6 ++++-- JotunnModStub/Butler/ServantTableBehaviour.cs | 3 ++- JotunnModStub/Draugh/DraughSpawnerBehaviour.cs | 7 +++++++ JotunnModStub/Dvergar/DvergarBancoBehaviour.cs | 12 ++++++++---- JotunnModStub/Dvergar/DvergarBotteBehaviour.cs | 7 +++++-- JotunnModStub/Fenrir/FenrirMangiatoiaBehaviour.cs | 7 +++++++ JotunnModStub/Skeleton/SkeletonBonePileBehaviour.cs | 7 +++++++ JotunnModStub/Trenta/ComposterBehaviour.cs | 7 +++++++ JotunnModStub/Trenta/GroveBehaviour.cs | 7 +++++++ README.md | 1 + 10 files changed, 55 insertions(+), 9 deletions(-) diff --git a/JotunnModStub/Aswid/BloodRefineryBehaviour.cs b/JotunnModStub/Aswid/BloodRefineryBehaviour.cs index f64e983..d06b47b 100644 --- a/JotunnModStub/Aswid/BloodRefineryBehaviour.cs +++ b/JotunnModStub/Aswid/BloodRefineryBehaviour.cs @@ -79,14 +79,16 @@ namespace RacesOfValheim private bool OnAddMeat(Switch caller, Humanoid user, ItemDrop.ItemData item) { - return TryAdd(user, item, isMeat: true); + return TryAdd(user, item, isMeat: true) || item != null; } private bool OnAddBone(Switch caller, Humanoid user, ItemDrop.ItemData item) { - return TryAdd(user, item, isMeat: false); + return TryAdd(user, item, isMeat: false) || item != null; } + // Both switches treat an item in hand as handled whatever TryAdd says: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool TryAdd(Humanoid user, ItemDrop.ItemData item, bool isMeat) { if (user == null) return false; diff --git a/JotunnModStub/Butler/ServantTableBehaviour.cs b/JotunnModStub/Butler/ServantTableBehaviour.cs index 4d70f81..6aab038 100644 --- a/JotunnModStub/Butler/ServantTableBehaviour.cs +++ b/JotunnModStub/Butler/ServantTableBehaviour.cs @@ -64,7 +64,8 @@ namespace RacesOfValheim if (item != null) { player.Message(MessageHud.MessageType.Center, "$msg_wontwork"); - return false; + // True, not false: false makes Humanoid.UseItem cover the message with $msg_cantuseon. + return true; } if (Servant() != null) diff --git a/JotunnModStub/Draugh/DraughSpawnerBehaviour.cs b/JotunnModStub/Draugh/DraughSpawnerBehaviour.cs index 98c760d..faf40ee 100644 --- a/JotunnModStub/Draugh/DraughSpawnerBehaviour.cs +++ b/JotunnModStub/Draugh/DraughSpawnerBehaviour.cs @@ -65,7 +65,14 @@ namespace RacesOfValheim /// Raw flesh feeds it, a Draugr trophy is a whole batch, an Elite trophy is an officer, and a /// Greater Cursed Bone upgrades it. Empty hands just report. /// + // With an item in hand every outcome counts as handled, refusals included: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool OnUse(Switch caller, Humanoid user, ItemDrop.ItemData item) + { + return Use(user, item) || item != null; + } + + private bool Use(Humanoid user, ItemDrop.ItemData item) { if (user == null) return false; diff --git a/JotunnModStub/Dvergar/DvergarBancoBehaviour.cs b/JotunnModStub/Dvergar/DvergarBancoBehaviour.cs index dbbfa6e..a0646a7 100644 --- a/JotunnModStub/Dvergar/DvergarBancoBehaviour.cs +++ b/JotunnModStub/Dvergar/DvergarBancoBehaviour.cs @@ -67,7 +67,9 @@ namespace RacesOfValheim if (!DvergarRace.IsDvergar()) { player.Message(MessageHud.MessageType.Center, "The ledger is not written for you."); - return false; + // With an item in hand, false makes Humanoid.UseItem cover this message with its + // generic "$msg_cantuseon"; true tells it the use was handled here. + return item != null; } // The Queen's drop in hand rewrites the ledger: coin on the table, and two more crews. @@ -79,24 +81,26 @@ namespace RacesOfValheim if (item != null) { player.Message(MessageHud.MessageType.Center, "$msg_wontwork"); - return false; + return true; } return OpenStore(player); } + // Every refusal still returns true: this only runs from an item use, where false would + // make Humanoid.UseItem replace our message with the generic "$msg_cantuseon". private bool TryUpgrade(Player player, ItemDrop.ItemData item) { if (IsUpgraded()) { player.Message(MessageHud.MessageType.Center, "It has already had one."); - return false; + return true; } if (BossProgressionManager.GetCurrentProgressionState() < DvergarBanco.UpgradeProgressionState) { player.Message(MessageHud.MessageType.Center, "Not while she still sits under the mist."); - return false; + return true; } player.GetInventory().RemoveItem(item, 1); diff --git a/JotunnModStub/Dvergar/DvergarBotteBehaviour.cs b/JotunnModStub/Dvergar/DvergarBotteBehaviour.cs index 829f94f..84b810c 100644 --- a/JotunnModStub/Dvergar/DvergarBotteBehaviour.cs +++ b/JotunnModStub/Dvergar/DvergarBotteBehaviour.cs @@ -63,9 +63,12 @@ namespace RacesOfValheim if (!DvergarBotte.IsBrew(prefabName)) { player.Message(MessageHud.MessageType.Center, "$msg_wontwork"); - return false; + return true; } - return Fill(player, inventory, item, prefabName); + // Always true from an item use, refusals included: false makes Humanoid.UseItem + // cover Fill's own message with the generic $msg_cantuseon. + Fill(player, inventory, item, prefabName); + return true; } // Bare hands: pour a round if there is one, otherwise go looking for something to pour. diff --git a/JotunnModStub/Fenrir/FenrirMangiatoiaBehaviour.cs b/JotunnModStub/Fenrir/FenrirMangiatoiaBehaviour.cs index 0929e64..a7e2bfb 100644 --- a/JotunnModStub/Fenrir/FenrirMangiatoiaBehaviour.cs +++ b/JotunnModStub/Fenrir/FenrirMangiatoiaBehaviour.cs @@ -272,7 +272,14 @@ namespace RacesOfValheim // ---------------------------------------------------------------- interaction + // With an item in hand every outcome counts as handled, refusals included: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool OnUse(Switch caller, Humanoid user, ItemDrop.ItemData item) + { + return Use(user, item) || item != null; + } + + private bool Use(Humanoid user, ItemDrop.ItemData item) { if (user == null) return false; diff --git a/JotunnModStub/Skeleton/SkeletonBonePileBehaviour.cs b/JotunnModStub/Skeleton/SkeletonBonePileBehaviour.cs index 83c6046..002e2a4 100644 --- a/JotunnModStub/Skeleton/SkeletonBonePileBehaviour.cs +++ b/JotunnModStub/Skeleton/SkeletonBonePileBehaviour.cs @@ -68,7 +68,14 @@ namespace RacesOfValheim /// Empty hands were free to use for this because the pile's own hover already carries the /// status the Draugh needs an empty-handed click to report. /// + // With an item in hand every outcome counts as handled, refusals included: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool OnUse(Switch caller, Humanoid user, ItemDrop.ItemData item) + { + return Use(user, item) || item != null; + } + + private bool Use(Humanoid user, ItemDrop.ItemData item) { Player player = user as Player; if (player == null) return false; diff --git a/JotunnModStub/Trenta/ComposterBehaviour.cs b/JotunnModStub/Trenta/ComposterBehaviour.cs index f59dbe8..4dd7524 100644 --- a/JotunnModStub/Trenta/ComposterBehaviour.cs +++ b/JotunnModStub/Trenta/ComposterBehaviour.cs @@ -77,7 +77,14 @@ namespace RacesOfValheim /// click means. Holding flesh feeds it; empty hands tap it when it is ready and otherwise /// just report what it is doing. /// + // With an item in hand every outcome counts as handled, refusals included: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool OnUse(Switch caller, Humanoid user, ItemDrop.ItemData item) + { + return Use(user, item) || item != null; + } + + private bool Use(Humanoid user, ItemDrop.ItemData item) { if (user == null) return false; diff --git a/JotunnModStub/Trenta/GroveBehaviour.cs b/JotunnModStub/Trenta/GroveBehaviour.cs index 39388e4..0d0fde3 100644 --- a/JotunnModStub/Trenta/GroveBehaviour.cs +++ b/JotunnModStub/Trenta/GroveBehaviour.cs @@ -257,7 +257,14 @@ namespace RacesOfValheim /// doing. Loading a tank before the tree has grown is allowed on purpose - there is no reason /// to make the player come back twice. /// + // With an item in hand every outcome counts as handled, refusals included: false makes + // Humanoid.UseItem cover our own message with the generic "$msg_cantuseon". private bool OnUse(Switch caller, Humanoid user, ItemDrop.ItemData item) + { + return Use(user, item) || item != null; + } + + private bool Use(Humanoid user, ItemDrop.ItemData item) { if (user == null) return false; diff --git a/README.md b/README.md index 56c3a61..11e2bba 100644 --- a/README.md +++ b/README.md @@ -415,6 +415,7 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact - **Fix - Faction merchants would not open their shop:** Valheim 1.0 added a name, tooltip, buy effects and unlock keys to every shop item, and the shop window reads some of them without checking they are there. The merchants' goods were missing them, so pressing E threw a `NullReferenceException` and nothing opened. Buying is covered too — it would have hit the same wall on the buy effects. Thanks to the tester who tracked this down. - **Fix - Haldor and Hildir's Dvergar discount broke their shops:** the discounted copies of their goods were rebuilt with only the old fields, so a Dvergar hit the same shop error, and items that unlock something when bought (like Haldor's extra inventory row) lost what they unlock. The discount now copies the whole item and changes only the price. - **Fix - The Trol totem's own messages were replaced by "Can't use X on Y":** using Yagluth's drop on a totem that already has one, or before Yagluth has fallen, or using any other item on it, now shows the totem's message instead of the generic one. Thanks to the tester who spotted it. +- **Fix - The same "Can't use X on Y" was covering the messages of nine other race buildings:** using an item on the Bone Servant table, the Dvergar barrel and contract bank, the Fenrir trough, the Draugr and Skeleton piles, the Aswid Blood Refinery, the Trenta Grove and Composter now shows their own answer — "It's full", "It has already had one.", "Still rotting.", the boss gates and the rest — instead of the generic one. - **Fix - The Fenrir was 100% faster than intended:** the curse's speed bonus was applied as a multiplier on top of normal speed instead of as a bonus, so every Fenrir moved at double speed plus the bonus (103% faster after one boss instead of 3%). It is now the +3% per boss the race has always listed. - **Changed - New Discord link:** [https://discord.gg/jJzuKBZNC](https://discord.gg/jJzuKBZNC). - 1.4.17 was 1.4.16 republished on Thunderstore with only the version number changed; there is no separate 1.4.17 changelog.