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;