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 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-09-18 17:13:16 +02:00
commit 5f74c57e72
10 changed files with 55 additions and 9 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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.
/// </summary>
// 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;

View file

@ -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);

View file

@ -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.

View file

@ -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;

View file

@ -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.
/// </summary>
// 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;

View file

@ -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.
/// </summary>
// 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;

View file

@ -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.
/// </summary>
// 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;

View file

@ -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.