v1.2.2.b6
Performance & stability pass (issue #34 + audit) General: - DisableAll resets only skills active in the previous round instead of all loaded skills (~89ms -> ~5ms) - Removed per-tick LINQ/allocations, O(1) HUD skill lookups, translation substitutions moved to load time - ForceFullUpdate creates the network service once per broadcast; view-angle guard only skips a genuine (0,0,0) placeholder - Debug hooks/logging only active when DebugMode is enabled (single reused writer) - Player skill state unified to a single collection (fixes a rare disconnect race) - Gamedata signatures resolved lazily/isolated; hardened tick/transmit paths against invalid handles - Description HUD honours always-show / -1 duration consistently across all assignment paths Skills: - Jester: fixed the no-damage effect leaking after a mid-round skill change (Thief/Deactivator) - Jackal: fixed trail entities accumulating over a round - Falcon Eye / Third Eye / Spectator: camera state cleared on disable Also: added missing translation keys as untranslated markers across language files. Fixes #34
This commit is contained in:
parent
a0f37ba1a1
commit
25cd8eb989
31 changed files with 202 additions and 79 deletions
|
|
@ -19,16 +19,18 @@ namespace src
|
|||
#pragma warning disable CS8618
|
||||
public static jRandomSkills Instance { get; private set; }
|
||||
#pragma warning restore CS8618
|
||||
public ConcurrentBag<jSkill_PlayerInfo> SkillPlayer { get; set; } = [];
|
||||
public IEnumerable<jSkill_PlayerInfo> SkillPlayer => PlayerManager.GetAllPlayers();
|
||||
public Random Random { get; } = new Random();
|
||||
public CCSGameRules? GameRules { get; set; }
|
||||
private ConcurrentBag<string> ManifestResources { get; set; } = ["models/sprays/spray_plane.vmdl"];
|
||||
public IWasdMenuManager? MenuManager;
|
||||
// Skills that were enabled at least once this round; used to reset only those on round change (not all 124).
|
||||
public static readonly ConcurrentDictionary<string, byte> ActiveSkillsThisRound = new();
|
||||
|
||||
public override string ModuleName => "[CS2] [ jRandomSkills ]";
|
||||
public override string ModuleAuthor => "D3X, Juzlus";
|
||||
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
|
||||
public override string ModuleVersion => "1.2.2.b5";
|
||||
public override string ModuleVersion => "1.2.2.b6";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
|
@ -85,6 +87,9 @@ namespace src
|
|||
if (string.IsNullOrEmpty(skill))
|
||||
return null;
|
||||
|
||||
if (methodName == "EnableSkill")
|
||||
ActiveSkillsThisRound.TryAdd(skill, 0);
|
||||
|
||||
var method = _skillMethodCache.GetOrAdd((skill, methodName), key =>
|
||||
{
|
||||
string className = $"src.player.skills.{key.Skill}";
|
||||
|
|
@ -292,12 +297,9 @@ namespace src
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a player info by index. O(n) lookup - consider caching if called frequently.
|
||||
/// </summary>
|
||||
internal jSkill_PlayerInfo? GetPlayerInfoByIndex(uint playerIndex)
|
||||
{
|
||||
return SkillPlayer.FirstOrDefault(p => p.PlayerIndex == playerIndex);
|
||||
return PlayerManager.GetPlayerByIndex(playerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -329,6 +331,23 @@ namespace src
|
|||
public static class SkillData
|
||||
{
|
||||
public static ConcurrentBag<jSkill_SkillInfo> Skills { get; } = [];
|
||||
|
||||
private static Dictionary<Skills, jSkill_SkillInfo>? _bySkill;
|
||||
|
||||
public static jSkill_SkillInfo? GetInfo(Skills skill)
|
||||
{
|
||||
var map = _bySkill;
|
||||
if (map == null)
|
||||
{
|
||||
map = new Dictionary<Skills, jSkill_SkillInfo>();
|
||||
foreach (var s in Skills)
|
||||
map[s.Skill] = s;
|
||||
_bySkill = map;
|
||||
}
|
||||
return map.TryGetValue(skill, out var info) ? info : null;
|
||||
}
|
||||
|
||||
public static void Invalidate() => _bySkill = null;
|
||||
}
|
||||
|
||||
public enum CS2ConsoleColors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue