Merge pull request #30 from vladimir214sd/codex/issue-29-disable-drop-hook-20260605

Disable stale HandleCommandDrop hook on plugin load
This commit is contained in:
Juzlus 2026-06-10 01:00:50 +02:00 • committed by GitHub
commit cba834e8f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,8 +40,6 @@ namespace src.player
public static readonly ConcurrentDictionary<uint, jSkill_SkillInfo> staticSkills = []; public static readonly ConcurrentDictionary<uint, jSkill_SkillInfo> staticSkills = [];
private static readonly object setLock = new(); private static readonly object setLock = new();
private static readonly MemoryFunctionVoid<CBasePlayerPawn, CBasePlayerWeapon> DropWeaponFunc = new(GameData.GetSignature("CCSPlayerController_HandleCommandDrop"));
public static void Load() public static void Load()
{ {
Instance.RegisterEventHandler<EventPlayerConnectFull>(PlayerConnectFull); Instance.RegisterEventHandler<EventPlayerConnectFull>(PlayerConnectFull);
@ -87,7 +85,9 @@ namespace src.player
VirtualFunctions.CBaseTrigger_EndTouchFunc.Hook(OnTriggerExit, HookMode.Pre); VirtualFunctions.CBaseTrigger_EndTouchFunc.Hook(OnTriggerExit, HookMode.Pre);
VirtualFunctions.CCSPlayer_ItemServices_CanAcquireFunc.Hook(OnWeaponCanAcquire, HookMode.Pre); VirtualFunctions.CCSPlayer_ItemServices_CanAcquireFunc.Hook(OnWeaponCanAcquire, HookMode.Pre);
DropWeaponFunc.Hook(WeaponDrop, HookMode.Pre); // Disabled after CS2 updates started crashing Linux servers on player join.
// The hooked native signature is only used to block weapon drops for Iana clones.
// Keeping the plugin alive is safer than installing a stale global hook at load time.
} }
private static jSkill_SkillInfo ChooseSkillByRarityAndMax(List<jSkill_SkillInfo> candidates, Dictionary<Skills, int> assignmentCounts, Config.GameModes gameMode) private static jSkill_SkillInfo ChooseSkillByRarityAndMax(List<jSkill_SkillInfo> candidates, Dictionary<Skills, int> assignmentCounts, Config.GameModes gameMode)
@ -1267,4 +1267,4 @@ namespace src.player
public static DateTime GetFreezeTimeEnd() => freezeTimeEnd; public static DateTime GetFreezeTimeEnd() => freezeTimeEnd;
} }
} }