I forgot I ran into trouble with abilities having Cooldown = 0 but the client not allowing to switch “due to reason [Cooldown Not Expired]”. This for me was an interesting one but I just tweaked ablAbilityComponent.h:
bool IsComplete() const { return CurrentTime > CooldownTime; }
To:
bool IsComplete() const { return CooldownTime == 0 || CurrentTime > CooldownTime; }
With a small change to ablAbilityComponent.cpp (though this might be an incorrect approach but it is a hack that works for now):
void UAblAbilityComponent::AddCooldownForAbility(const UAblAbility& Ability, const UAblAbilityContext& Context)
{
m_ActiveCooldowns.Add(Ability.GetAbilityNameHash(), FAblAbilityCooldown(Ability, Context));
}
To:
void UAblAbilityComponent::AddCooldownForAbility(const UAblAbility& Ability, const UAblAbilityContext& Context)
{
FAblAbilityCooldown abilityCooldown(Ability, Context);
if (!abilityCooldown.IsComplete()) {
m_ActiveCooldowns.Add(Ability.GetAbilityNameHash(), abilityCooldown);
}
}
This way it makes sure the cooldown doesn’t get added in cases where there is no cooldown to add.