Cooldown override: follow bot takeovers, cover BlastShot and Dash
css_setoverride only reset cooldowns before UseSkill, checked against the controller the skill ran on. After a bot takeover that's the bot (SteamID 0), so the human's override was ignored; it now resolves to the controlling human. Bots are keyed by slot, so overriding one bot no longer toggles all of them. BlastShot and Dash trigger from OnTick, not UseSkill, so they never saw the override. They check it now; BlastShot fires once per right-click press while overridden instead of every tick.
This commit is contained in:
parent
5d0cf7ce80
commit
8a514255c1
4 changed files with 33 additions and 11 deletions
|
|
@ -8,7 +8,8 @@ namespace src.utils
|
|||
// Per-player cooldown bypass (css_setoverride). Skills keep their cooldown in their own static
|
||||
// per-player state, so instead of touching every skill this clears that state just before the
|
||||
// skill's UseSkill runs. Resetting only at use time (not every tick) matters: AimLock and Noclip
|
||||
// reuse their Cooldown timestamp as the start of the active effect.
|
||||
// reuse their Cooldown timestamp as the start of the active effect. Skills that trigger from
|
||||
// OnTick rather than UseSkill (BlastShot, Dash) check Has themselves.
|
||||
public static class CooldownOverride
|
||||
{
|
||||
private static readonly HashSet<ulong> _players = [];
|
||||
|
|
@ -17,12 +18,20 @@ namespace src.utils
|
|||
// Toggles the override and returns the new state.
|
||||
public static bool Toggle(CCSPlayerController player)
|
||||
{
|
||||
if (_players.Remove(player.SteamID)) return false;
|
||||
_players.Add(player.SteamID);
|
||||
if (_players.Remove(Key(player))) return false;
|
||||
_players.Add(Key(player));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Has(CCSPlayerController player) => _players.Contains(player.SteamID);
|
||||
// A bot a human has taken over counts as that human, since skills run on the bot's controller.
|
||||
public static bool Has(CCSPlayerController? player)
|
||||
{
|
||||
player = PlayerManager.GetPlayerFromEvent(player);
|
||||
return player != null && _players.Contains(Key(player));
|
||||
}
|
||||
|
||||
// Bots all have SteamID 0, so key them by slot instead (a SteamID64 is never that small).
|
||||
private static ulong Key(CCSPlayerController player) => player.IsBot ? player.Index : player.SteamID;
|
||||
|
||||
public static void ResetBeforeUse(Type skillType, CCSPlayerController player)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue