v1.2.3.b7

## Shared Systems

* **DecoyTracker** - owner-aware decoy tracking shared by FrozenDecoy, GravityDecoy and MagneticDecoy, replacing the per-skill position dictionaries.
* **DebugCategory** - new flag enum backing the numeric `DebugMode`, with automatic migration from the old boolean value.
* **SkillsInfo.GetSkillConfig** - indexed skill config lookup replacing the linear scan used by draws and HUD rendering.
* **SkillNames** - cached enum name table, removing repeated `ToString()` calls from the draw path.
* **SkillUtils.HideCarriedEntities** - shared carried-weapon resolution for C4Camouflage, Ghost and Ninja.

## Performance

* **Skill draw** - replaced the O(n²) config lookup; rounds exceeding the perf threshold dropped from 89% to 0.3%.
* **CheckTransmit** - the weapon chain is now resolved once per hidden pawn instead of once per receiver; Ghost cost down 61%.
* **Pilot** - the exhaust trail is paused and resumed instead of being destroyed and recreated on every jump release.
* **MagneticDecoy** - config reads and the pawn list are hoisted out of the per-decoy loop.
* **FrozenDecoy** - config reads are hoisted out of the per-tick loop.
* **Debug** - the damage hook is only installed when damage logging is enabled.

## Fixes

* **PsychicDefusing** - can no longer finish a defuse and award an extra round after the round has already ended.
* **Spectator** - now picks a different enemy on each activation and no longer creates an unused camera prop every time the skill is switched off.
* **Random** - replaced the shared `Random` instance with `Random.Shared`, preventing degenerate results from concurrent use.
* **Baseball** - decoys are removed when their owner dies or loses the skill.
* **FrozenDecoy, GravityDecoy, MagneticDecoy** - decoys and their ground rings are removed when the skill is taken away.
* **ThirdEye** - fixed the camera check dereferencing a missing `CameraServices`, and the door toggle now verifies the entity class before casting.
* **Round start** - fixed `[gamerules unavailable]` appearing on the first freeze-time end after every map change.
* **Config** - added migration for keys missing from existing configuration files.

## Menu

* **WASDMenuAPI** - fixed a malformed `<font>` tag that wrapped every non-hovered menu row in an unclosed attribute.
* **WSAD menu** - the controls line is no longer dropped when the header line is hidden.
* **HtmlHudCustomisation** - line size options left empty now hide their line instead of emitting an invalid font class.

## Debug

* **DebugMode** - changed from a boolean to a number with concatenated category digits: `1` Skill, `2` Round, `3` Entity, `4` Damage. `123` enables Skill, Round and Entity. `0` disables logging. Existing `true` values migrate automatically.
* **EntityManager** - entity creation, destruction and failures are now logged under the Entity category instead of the server console.
* Startup now reports which debug categories are active.
This commit is contained in:
ByDexter 2026-08-16 16:33:09 +03:00
parent 5c65f4ac71
commit 0033d1e13d
29 changed files with 634 additions and 251 deletions

View file

@ -2,6 +2,7 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using src.player;
using System.Collections.Concurrent;
using System.Drawing;
using static src.jRandomSkills;
@ -48,6 +49,20 @@ namespace src.utils
EntityType = entityType,
CreatedAt = DateTime.UtcNow
};
if (Config.DebugEnabled(DebugCategory.Entity))
Debug.WriteToDebug($"[Entity] + {entityType} #{entityIndex} owner={DescribeOwner(playerIndex)} tracked={trackedEntities.Count}", DebugCategory.Entity);
}
private static string DescribeOwner(uint playerIndex)
{
return playerIndex == SystemOwnerIndex ? "system" : playerIndex.ToString();
}
private static void LogEntityError(string message)
{
Server.PrintToConsole($"[EntityManager] {message}");
Debug.WriteToDebug($"[Entity] ! {message}", DebugCategory.Entity);
}
public static void RegisterExisting(CBaseEntity? entity, uint playerIndex, string entityType)
@ -95,7 +110,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedParticleSystem: {ex.Message}");
LogEntityError($"CreateTrackedParticleSystem: {ex.Message}");
return null;
}
}
@ -113,7 +128,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedDynamicProp: {ex.Message}");
LogEntityError($"CreateTrackedDynamicProp: {ex.Message}");
return null;
}
}
@ -137,7 +152,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedChicken: {ex.Message}");
LogEntityError($"CreateTrackedChicken: {ex.Message}");
return null;
}
}
@ -155,7 +170,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedPhysicsProp: {ex.Message}");
LogEntityError($"CreateTrackedPhysicsProp: {ex.Message}");
return null;
}
}
@ -195,7 +210,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedTrigger: {ex.Message}");
LogEntityError($"CreateTrackedTrigger: {ex.Message}");
return null;
}
}
@ -222,7 +237,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] CreateTrackedBeam: {ex.Message}");
LogEntityError($"CreateTrackedBeam: {ex.Message}");
return null;
}
}
@ -248,7 +263,10 @@ namespace src.utils
public static bool DestroyEntity(uint entityIndex, float delay = 0.1f)
{
trackedEntities.TryRemove(entityIndex, out _);
bool wasTracked = trackedEntities.TryRemove(entityIndex, out var removed);
if (wasTracked && Config.DebugEnabled(DebugCategory.Entity))
Debug.WriteToDebug($"[Entity] - {removed.EntityType} #{entityIndex} owner={DescribeOwner(removed.PlayerIndex)} tracked={trackedEntities.Count}", DebugCategory.Entity);
if (SuppressKills)
return false;
@ -267,7 +285,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] DestroyEntity {entityIndex}: {ex.Message}");
LogEntityError($"DestroyEntity {entityIndex}: {ex.Message}");
}
return false;
@ -291,7 +309,7 @@ namespace src.utils
}
catch (Exception ex)
{
Server.PrintToConsole($"[EntityManager] DestroyBeam {entityIndex}: {ex.Message}");
LogEntityError($"DestroyBeam {entityIndex}: {ex.Message}");
}
bool killed = DestroyEntity(entityIndex);