Skip to content

Commit

Permalink
fix: HP HUD updating for everyone when one player takes damage
Browse files Browse the repository at this point in the history
  • Loading branch information
TisRyno committed Apr 11, 2024
1 parent d6d97dc commit 0ea240e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions LethalProgression/Skills/HPRegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ internal class HPRegen
[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
private static void HPRegenUpdate(PlayerControllerB __instance)
{
if (__instance.health >= 100)
if (!__instance.IsOwner || (__instance.IsServer && !__instance.isHostPlayerObject))
return;

if (!__instance.isPlayerControlled || __instance.health >= 100 || __instance.isPlayerDead)
return;

if (!LP_NetworkManager.xpInstance.skillList.IsSkillListValid())
Expand All @@ -35,12 +38,13 @@ private static void HPRegenUpdate(PlayerControllerB __instance)
{
__instance.MakeCriticallyInjured(false);
}

HUDManager.Instance.UpdateHealthUI(__instance.health, false);

return;
}
else
{
__instance.healthRegenerateTimer -= Time.deltaTime;
}

__instance.healthRegenerateTimer -= Time.deltaTime;
}
}
}

0 comments on commit 0ea240e

Please sign in to comment.