aswig and multiplayer fixes

This commit is contained in:
Ferdinando 2026-08-02 17:54:39 +02:00
commit 1bdf77e8d6
6 changed files with 102 additions and 49 deletions

View file

@ -804,4 +804,24 @@ namespace RacesOfValheim
}
}
}
[HarmonyPatch(typeof(Player), "ClearFood")]
public static class Aswid_Player_ClearFood_Patch
{
public static bool Prefix(Player __instance)
{
if (__instance == Player.m_localPlayer && AswidRace.IsAswid())
{
// Retain food if the player is dead/dying.
// Allows Bukeperries to still clear food normally.
if (__instance.IsDead() || __instance.GetHealth() <= 0f)
{
Jotunn.Logger.LogInfo("[AswidRace] Preserving food buffs through death (Aswid racial trait).");
return false;
}
}
return true;
}
}
}

View file

@ -56,7 +56,9 @@ namespace RacesOfValheim
{ "Ulv", "BloodPudding" },
{ "Seeker", "CookedBugMeat" },
{ "SeekerBrute", "CookedBugMeat" },
{ "SeekerBrood", "CookedBugMeat" }
{ "SeekerBrood", "CookedBugMeat" },
{ "Surtling", "BloodPudding" },
{ "Bear", "CookedBearMeat" }
};
public static bool BypassAswidFoodCheck = false;
@ -139,11 +141,16 @@ namespace RacesOfValheim
{
burnTime = 1200f; // 20 minutes
}
else if (mobName == "Greyling") { foodHp = 20f; burnTime = 1200f; }
else if (mobName == "Greydwarf") { foodHp = 25f; burnTime = 1200f; }
else if (mobName == "Greydwarf_Shaman") { foodHp = 30f; burnTime = 1200f; }
else if (mobName == "Greydwarf_Elite") { foodHp = 60f; burnTime = 1800f; }
customItem.ItemDrop.m_itemData.m_shared.m_food = foodHp;
customItem.ItemDrop.m_itemData.m_shared.m_foodStamina = 0f;
customItem.ItemDrop.m_itemData.m_shared.m_foodEitr = 0f;
customItem.ItemDrop.m_itemData.m_shared.m_foodBurnTime = burnTime;
customItem.ItemDrop.m_itemData.m_shared.m_foodRegen = 1f;
customItem.ItemDrop.m_itemData.m_shared.m_foodRegen = Mathf.Max(1f, foodHp / 15f);
}
}
}
@ -579,6 +586,11 @@ namespace RacesOfValheim
if (playerVisual != null)
{
playerVisual.gameObject.SetActive(true);
ZSyncAnimation zanim = Player.m_localPlayer.GetComponent<ZSyncAnimation>();
if (zanim != null) zanim.SetBool("sit", false);
Animator anim = playerVisual.GetComponent<Animator>();
if (anim != null) anim.SetBool("sit", false);
}
Player.m_localPlayer.GetSEMan().RemoveStatusEffect("SE_BatForm".GetStableHashCode(), true);
@ -690,6 +702,11 @@ namespace RacesOfValheim
if (playerVisual != null)
{
playerVisual.gameObject.SetActive(true);
ZSyncAnimation zanim = Player.m_localPlayer.GetComponent<ZSyncAnimation>();
if (zanim != null) zanim.SetBool("sit", false);
Animator anim = playerVisual.GetComponent<Animator>();
if (anim != null) anim.SetBool("sit", false);
}
float elapsed = 0f;
@ -1092,3 +1109,5 @@ namespace RacesOfValheim