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

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