chore(release): v1.4.19 - eye height, remote forms, food refresh, faction retaliation

Race body scale moved the model and not the camera: Character.m_eye hangs
off the unscaled root, so a Trol or a Dvergar changed height for everyone
but themselves. RaceEyeHeight moves the eye by whatever scale the Visual
is wearing, for every player, so aim rays follow too.

Remote copies of a Fenrir form had no one writing to their Animator and
stood in the controller's default state, sliding. RemoteFenrirAnimator
mirrors the four local behaviours off the player's own replicated
animator, the way RemoteSkadiAnimator already did for Skadi.

Player.Food.m_time is time remaining, not time elapsed: the Aswid, Trenta
and Draugh repeat-meal branches all set it to 0 and expired the slot they
meant to renew, and left the nutrition values stale. RaceFoodRefresh does
what vanilla's own branch does, in one place instead of three. The Trenta
prefix now reports __result, or a working refresh would have renewed the
slot without consuming the seed.

Aswid devour was gated by one timestamp shared by every corpse, so a pack
killed at once fed the player once; it is now per corpse, floored at a
second, and a refused meal says $msg_nomore.

MonsterAI.UpdateTarget discards any target IsEnemy refuses, so a truced
mob could not retaliate at all - it stood still or fled. RaceGrudge
records the hit on the AI owner's client and both truce postfixes stand
down for that pair. The Aswid drain and the Skadi frost aura now skip
kin, as the Skeleton's fire aura already did, or an always-on aura would
hold every truce permanently broken.

Faction sets matched exact prefab names with families half-listed:
added Skeleton_NoArcher and Draugr_Ranged to the Swamp, Greyling to the
Black Forest.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-09-20 08:26:22 +02:00
commit 834d6647fd
18 changed files with 525 additions and 56 deletions

View file

@ -137,7 +137,14 @@ namespace RacesOfValheim
[HarmonyPatch(typeof(Player), "EatFood")]
public static class Trenta_Player_EatFood_DuplicateGuard_Patch
{
public static bool Prefix(Player __instance, ItemDrop.ItemData item)
// __result matters here, unlike in a prefix that only ever falls through to vanilla:
// the caller above is TrentaFoodPatches' own UseItem prefix, and it removes the seed
// from the bag only when EatFood answers true. Without this the refresh below would
// renew the slot and leave the seed in the inventory to be eaten again, forever. It
// went unnoticed while the refresh was broken: the old code destroyed the slot instead
// of renewing it, so the free seed had nothing to show for it. The Aswid and the
// Draugh versions of this patch already took __result.
public static bool Prefix(Player __instance, ItemDrop.ItemData item, ref bool __result)
{
hiddenFoods.Clear();
@ -155,22 +162,18 @@ namespace RacesOfValheim
Player.Food f = foodObj as Player.Food;
if (f != null && f.m_item.m_shared.m_name == item.m_shared.m_name && f.CanEatAgain())
{
f.m_time = 0f;
f.m_item = item.Clone();
// Was `f.m_time = 0f`, which expired the seed instead of renewing it -
// this is the "eating a second seed deletes the first" report. See
// RaceFoodRefresh.
RaceFoodRefresh.Refresh(__instance, f, item);
var consumeEffects = Traverse.Create(__instance).Field("m_consumeItemEffects").GetValue<EffectList>();
if (consumeEffects != null) consumeEffects.Create(__instance.transform.position, Quaternion.identity, __instance.transform, 1f, -1);
var zanim = Traverse.Create(__instance).Field("m_zanim").GetValue<ZSyncAnimation>();
if (zanim != null) zanim.SetTrigger("eat");
if (item.m_shared.m_food > 0f) __instance.Heal(item.m_shared.m_food, true);
return false; // Refreshed ourselves - skip native EatFood
__result = true; // Eaten: the caller consumes the seed.
return false; // Refreshed ourselves - skip native EatFood
}
}
return false; // Full, and nothing to refresh
__result = false; // Full, and nothing in it worth topping up: the seed stays.
return false;
}
// Temporarily hide any existing slot with the same name to force native EatFood