more fixes

This commit is contained in:
Gurge44 committed 2024-12-03 09:09:25 +01:00
1 parent ff3e2a71e7
commit 8c552b1ebf
2 files changed
+10 -8

No files matched your search

+10 -5
View File
@@ -26,6 +26,7 @@ internal static class SoloPVP
private static Dictionary<byte, int> BackCountdown = [];
private static Dictionary<byte, long> LastHurt = [];
private static Dictionary<byte, long> LastRecover = [];
public static bool SoloAlive(this PlayerControl pc)
{
@@ -91,6 +92,7 @@ internal static class SoloPVP
PlayerDF = [];
LastHurt = [];
LastRecover = [];
OriginalSpeed = [];
BackCountdown = [];
KBScore = [];
@@ -107,6 +109,7 @@ internal static class SoloPVP
KBScore.TryAdd(pc.PlayerId, 0);
LastHurt.TryAdd(pc.PlayerId, Utils.TimeStamp);
LastRecover.TryAdd(pc.PlayerId, Utils.TimeStamp);
}
}
@@ -328,11 +331,13 @@ internal static class SoloPVP
float dis = Vector2.Distance(pos, __instance.Pos());
if (dis > 1f) __instance.TP(pos);
}
var notifyRoles = false;
long now = Utils.TimeStamp;
if (LastHurt[id] + KB_RecoverAfterSecond.GetInt() < Utils.TimeStamp && PlayerHP[id] < PlayerHPMax[id] && __instance.SoloAlive() && !__instance.inVent)
if (LastHurt[id] + KB_RecoverAfterSecond.GetInt() < now && LastRecover[id] != now && PlayerHP[id] < PlayerHPMax[id] && __instance.SoloAlive() && !__instance.inVent)
{
LastRecover[id] = now;
PlayerHP[id] += PlayerHPReco[id];
PlayerHP[id] = Math.Min(PlayerHPMax[id], PlayerHP[id]);
notifyRoles = true;
@@ -353,7 +358,7 @@ internal static class SoloPVP
notifyRoles = true;
}
if (NameNotify.ContainsKey(id) && NameNotify[id].TimeStamp < Utils.TimeStamp)
if (NameNotify.ContainsKey(id) && NameNotify[id].TimeStamp < now)
{
NameNotify.Remove(id);
notifyRoles = true;
@@ -362,8 +367,8 @@ internal static class SoloPVP
if (notifyRoles) Utils.NotifyRoles(SpecifySeer: __instance, SpecifyTarget: __instance);
if (LastFixedUpdate == Utils.TimeStamp) return;
LastFixedUpdate = Utils.TimeStamp;
if (LastFixedUpdate == now) return;
LastFixedUpdate = now;
RoundTime--;
}
-3
View File
@@ -282,14 +282,11 @@ public static class Utils
if (HasImpVision)
{
opt.SetFloat(FloatOptionNames.CrewLightMod, opt.GetFloat(FloatOptionNames.ImpostorLightMod));
if (IsActive(SystemTypes.Electrical)) opt.SetFloat(FloatOptionNames.CrewLightMod, opt.GetFloat(FloatOptionNames.CrewLightMod) * 5);
return;
}
opt.SetFloat(FloatOptionNames.ImpostorLightMod, opt.GetFloat(FloatOptionNames.CrewLightMod));
if (IsActive(SystemTypes.Electrical)) opt.SetFloat(FloatOptionNames.ImpostorLightMod, opt.GetFloat(FloatOptionNames.ImpostorLightMod) / 5);
}