fix(alfar): hair and beard never attach, no flash on equipment change
This commit is contained in:
parent
2d865f5bb0
commit
842af2fd4f
1 changed files with 31 additions and 0 deletions
|
|
@ -38,6 +38,37 @@ namespace RacesOfValheim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hair and beard never attach to an Alfr. Every equipment change makes the game write the
|
||||||
|
/// profile's hair back (Humanoid.SetupVisEquipment), and ApplyHairless only clears it on its
|
||||||
|
/// 0.5s pass, so players saw the hair flash in for a moment. Zeroing the hash here, where
|
||||||
|
/// VisEquipment spawns the model, means it never appears. Covers remote players too, since
|
||||||
|
/// their visuals go through the same call.
|
||||||
|
/// </summary>
|
||||||
|
[HarmonyPatch(typeof(VisEquipment), "SetHairEquipped")]
|
||||||
|
public static class Alfar_SetHairEquipped_Patch
|
||||||
|
{
|
||||||
|
public static void Prefix(VisEquipment __instance, ref int hash)
|
||||||
|
{
|
||||||
|
if (hash != 0 && IsAlfarVis(__instance)) hash = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(VisEquipment), "SetBeardEquipped")]
|
||||||
|
public static class Alfar_SetBeardEquipped_Patch
|
||||||
|
{
|
||||||
|
public static void Prefix(VisEquipment __instance, ref int hash)
|
||||||
|
{
|
||||||
|
if (hash != 0 && IsAlfarVis(__instance)) hash = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAlfarVis(VisEquipment vis)
|
||||||
|
{
|
||||||
|
Player player = vis.GetComponent<Player>();
|
||||||
|
return player != null && AlfarVisuals.IsAlfarPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The character preview on the main menu is a Player too, with the saved race in its custom data
|
/// The character preview on the main menu is a Player too, with the saved race in its custom data
|
||||||
/// and no ZNetView. Its Update may never run, so a small driver on it keeps the look: skin, hair,
|
/// and no ZNetView. Its Update may never run, so a small driver on it keeps the look: skin, hair,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue