warvulture

This commit is contained in:
Ferdinando 2026-08-24 19:17:47 +02:00
commit ee5a2e2e7b
12 changed files with 314 additions and 76 deletions

View file

@ -252,4 +252,22 @@ namespace RacesOfValheim
return true;
}
}
// m_customData only reaches the disk through Player.Save, and TrolFood_Time / TrolFood5_Time
// were only ever written at the moment of eating - always as 0. Both extra stomachs therefore
// came back from every reload with a full burn time ahead of them, digesting from scratch,
// while the three vanilla slots kept whatever they had left. Refreshing the two timestamps
// just before the package is packed puts all five on the same footing.
//
// A prefix, so the two keys are already in m_customData when Save packs it. SaveFoodTimes only
// updates keys that already exist and never removes one - see its comment for why that
// distinction matters here.
[HarmonyPatch(typeof(Player), nameof(Player.Save))]
public static class Trol_PlayerSave_Patch
{
public static void Prefix(Player __instance)
{
TrolFoodManager.SaveFoodTimes(__instance);
}
}
}