Fix GeoLite crash, add PerfMode profiling, reload cache invalidation

- GeoLite/MaxMind lookup wrapped in try/catch and disabled for the session on failure
  (stops the per-tick exception spam when the assembly cannot load during hot-reload)
- New PerfMode config option: writes performance logs to logs/perf_<date>.txt
  (DisableAll/SetSkill/PlayerDeath totals, per-skill SkillAction timings,
  aggregated OnTick/CheckTransmit avg-max summaries)
- css_reload now invalidates the skill-info and freeze-time caches
- Removed the last null-forgiving player lookups (Command, Armored, Baseball,
  FriendlyFire, OneShot)
This commit is contained in:
ByDexter 2026-07-06 02:50:56 +03:00
parent 25cd8eb989
commit b68a033b4c
14 changed files with 157 additions and 10 deletions

View file

@ -47,7 +47,7 @@ namespace src.player.skills
var victim = victimController.As<CCSPlayerController>();
if (victim == null || !victim.IsValid) return;
var playerInfo = PlayerManager.GetPlayerByIndex(PlayerManager.GetPlayerEvent(victim)!.Index);
var playerInfo = PlayerManager.GetPlayerByIndex((PlayerManager.GetPlayerEvent(victim)?.Index ?? victim.Index));
if (playerInfo == null) return;
if (playerInfo.Skill == skillName && victim.PawnIsAlive)

View file

@ -36,7 +36,7 @@ namespace src.player.skills
if (victim.Index == attacker.Index || victim.Team == attacker.Team)
return;
var attackerInfo = PlayerManager.GetPlayerByIndex(PlayerManager.GetPlayerEvent(attacker)!.Index);
var attackerInfo = PlayerManager.GetPlayerByIndex((PlayerManager.GetPlayerEvent(attacker)?.Index ?? attacker.Index));
if (attackerInfo?.Skill != skillName) return;
SkillUtils.TakeHealth(victim!.PlayerPawn.Value, SkillsInfo.GetValue<int>(skillName, "damageDeal"));

View file

@ -50,7 +50,7 @@ namespace src.player.skills
var victim = victimController.As<CCSPlayerController>();
if (victim == null || !victim.IsValid) return;
var playerInfo = PlayerManager.GetPlayerByIndex(PlayerManager.GetPlayerEvent(attacker)!.Index);
var playerInfo = PlayerManager.GetPlayerByIndex((PlayerManager.GetPlayerEvent(attacker)?.Index ?? attacker.Index));
if (playerInfo?.Skill != skillName || attacker!.Team != victim!.Team) return;
float damage = param2.Damage;

View file

@ -32,9 +32,10 @@ namespace src.player.skills
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
return;
CCSPlayerController attacker = PlayerManager.GetPlayerEvent(attackerPawn.Controller.Value.As<CCSPlayerController>())!;
var attacker = PlayerManager.GetPlayerEvent(attackerPawn.Controller.Value.As<CCSPlayerController>());
if (attacker == null || !attacker.IsValid) return;
var playerInfo = PlayerManager.GetPlayerByIndex(PlayerManager.GetPlayerEvent(attacker)!.Index);
var playerInfo = PlayerManager.GetPlayerByIndex(attacker.Index);
if (playerInfo == null) return;
if (playerInfo.Skill == skillName)