Files
test/Docs/ApplySkillShortcut-AntiSpam.md
T
2026-04-07 16:48:54 +07:00

1.6 KiB
Raw Blame History

ApplySkillShortcut Anti-spam

What it is

CECHostPlayer.ApplySkillShortcut(...) has a small client-side anti-spam gate to prevent input floods (touch/mouse spam, key repeat, UI double-fire) from generating excessive trace/cast work.

This is not a replacement for server cooldowns or validation. Its client-side hygiene to keep the client stable and reduce redundant requests.

How it works

The gate is implemented inside Assets/Scripts/CECHostPlayer.Skill.cs:

  • Global minimum interval (ANY): blocks ultra-high-frequency bursts across all skills.
  • Per-skill minimum interval (PER_SKILL): blocks rapidly pressing the same skill repeatedly.
  • Charge exception: if the player is charging a skill and presses the same skill again to release immediately, that press is allowed (so charging remains responsive).

The timing source is Time.unscaledTime so the throttle stays consistent even if Time.timeScale changes.

Tunables

In CECHostPlayer.Skill.cs:

  • APPLY_SKILL_SHORTCUT_MIN_INTERVAL_ANY (default 0.05s)
  • APPLY_SKILL_SHORTCUT_MIN_INTERVAL_PER_SKILL (default 0.12s)

If you need to tweak feel:

  • Lower ANY carefully; it protects against accidental double-fire from UI/input systems.
  • Lower PER_SKILL if skills feel “eaten” during fast tapping, but keep it high enough to block spam.

Why the charge exception exists

Chargeable skills commonly use a second press to “cast now”. Blocking that second press makes charging feel broken, so the anti-spam explicitly does not block it.