Merge branch 'fix-alfar-hair-flicker'
This commit is contained in:
commit
91f2a8bc0a
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>
|
||||
/// 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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue