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:
Astra 2026-09-29 15:52:38 +01:00
parent 5d0cf7ce80
commit 8a514255c1
4 changed files with 33 additions and 11 deletions

View file

@ -68,15 +68,23 @@ namespace src.player.skills
var buttons = player.Buttons;
bool isAttack2 = (buttons & PlayerButtons.Attack2) != 0;
if (skillInfo.CanUse && isAttack2 && !freezeTime)
bool pressed = isAttack2 && !skillInfo.WasAttack2;
skillInfo.WasAttack2 = isAttack2;
// With the cooldown override there's no cooldown, so fire once per press instead of every tick.
bool noCooldown = CooldownOverride.Has(player);
if ((noCooldown ? pressed : skillInfo.CanUse && isAttack2) && !freezeTime)
{
var weapon = playerPawn.WeaponServices?.ActiveWeapon?.Value;
if (weapon == null || !weapon.IsValid) continue;
if (!allowedWeapons.Contains(SkillUtils.GetDesignerName(weapon))) continue;
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
if (!noCooldown)
{
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
}
SpawnExplosion(player);
}
@ -191,6 +199,7 @@ namespace src.player.skills
public ulong SteamID { get; set; }
public bool CanUse { get; set; }
public DateTime Cooldown { get; set; }
public bool WasAttack2 { get; set; }
}
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7740c9", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float? hudDuration = null, float? descriptionHudDuration = null, int maxPerServer = -1, Rarity rarity = Rarity.Common, float explosionRadius = 400.0f, int explosionDamage = 60, float dmgReductionForTeamates = 0.5f, float cooldown = 10f, float force = 1000f, bool friendlyFire = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, hudDuration, descriptionHudDuration, maxPerServer, rarity)

View file

@ -109,11 +109,15 @@ namespace src.player.skills
skillInfo.Jumps = 0;
else if (!isOnGround && jumpPressed && skillInfo.Jumps < 1)
{
if (skillInfo.JumpReleasedTicks >= 3 && skillInfo.CanUse)
bool noCooldown = CooldownOverride.Has(eventPlayer);
if (skillInfo.JumpReleasedTicks >= 3 && (skillInfo.CanUse || noCooldown))
{
skillInfo.Jumps++;
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
if (!noCooldown)
{
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
}
float moveX = 0;
float moveY = 0;