fix(food): race foods replace a worn-down meal when the stomach is full
Trenta seeds, Draugh raw flesh and Aswid meals each go through an EatFood prefix that, with three slots full and none holding the same food, answered false. Vanilla would replace the most depleted meal past half its time. The UseItem callers also never showed why: EatFood says nothing on a refusal, so the click did nothing at all. That is the Reddit report of a Trenta who could not eat any seeds. The prefixes now hand that case to native EatFood, the Aswid's CanConsumeItem postfix keeps vanilla's answer instead of forcing false, and the Trenta and Draugh callers ask CanEat(item, true) for vanilla's own message when a meal is refused.
This commit is contained in:
parent
557664c41f
commit
eba537fa07
3 changed files with 28 additions and 16 deletions
|
|
@ -341,14 +341,11 @@ namespace RacesOfValheim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canRefresh)
|
// Otherwise vanilla's answer stands: it already allows replacing the
|
||||||
{
|
// most depleted meal past half its time, and already showed its "too
|
||||||
__result = true;
|
// full" message when it refused. Forcing false here used to block
|
||||||
}
|
// that replacement, silently.
|
||||||
else
|
if (canRefresh) __result = true;
|
||||||
{
|
|
||||||
__result = false; // Nessuno spazio disponibile, cibo si disintegra
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -426,9 +423,9 @@ namespace RacesOfValheim
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se pieno e senza 4° slot disponibile, fallisce e disintegra
|
// Full, no fourth slot free, no slot holding this meal. Native EatFood
|
||||||
__result = false;
|
// replaces the most depleted meal past half its time, or refuses.
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,11 @@ namespace RacesOfValheim
|
||||||
var zanim = Traverse.Create(player).Field("m_zanim").GetValue<ZSyncAnimation>();
|
var zanim = Traverse.Create(player).Field("m_zanim").GetValue<ZSyncAnimation>();
|
||||||
if (zanim != null) zanim.SetTrigger("eat");
|
if (zanim != null) zanim.SetTrigger("eat");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Vanilla's refusal message, which EatFood never shows by itself
|
||||||
|
player.CanEat(customItemDrop.m_itemData, true);
|
||||||
|
}
|
||||||
return false; // Skip native UseItem
|
return false; // Skip native UseItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,9 +159,10 @@ namespace RacesOfValheim
|
||||||
return false; // Skip native EatFood
|
return false; // Skip native EatFood
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inventory full
|
// Full, and no slot holds this flesh. Native EatFood replaces the most
|
||||||
__result = false;
|
// depleted meal past half its time, or refuses - vanilla's own rule. This
|
||||||
return false;
|
// used to refuse outright, with no message.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,12 @@ namespace RacesOfValheim
|
||||||
var zanim = Traverse.Create(player).Field("m_zanim").GetValue<ZSyncAnimation>();
|
var zanim = Traverse.Create(player).Field("m_zanim").GetValue<ZSyncAnimation>();
|
||||||
if (zanim != null) zanim.SetTrigger("eat");
|
if (zanim != null) zanim.SetTrigger("eat");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Vanilla's "can't eat more" / "too full" message, from vanilla's own
|
||||||
|
// check. EatFood itself never says why it refused.
|
||||||
|
player.CanEat(customDrop.m_itemData, true);
|
||||||
|
}
|
||||||
return false; // Skip native UseItem either way
|
return false; // Skip native UseItem either way
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,8 +178,11 @@ namespace RacesOfValheim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__result = false; // Full, and nothing in it worth topping up: the seed stays.
|
// Full, and no slot holds this seed. Native EatFood takes it from here with
|
||||||
return false;
|
// vanilla's own rule: it replaces the most depleted meal past half its time,
|
||||||
|
// or refuses. This used to refuse outright, so a Trenta with three meals going
|
||||||
|
// could not eat a seed at all, and saw no message saying why.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily hide any existing slot with the same name to force native EatFood
|
// Temporarily hide any existing slot with the same name to force native EatFood
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue