linter: varios

This commit is contained in:
2025-10-24 13:45:56 +02:00
parent 5362c5b022
commit fd4136a882
13 changed files with 232 additions and 201 deletions

View File

@@ -2,23 +2,23 @@
class Cooldown {
public:
Cooldown(float first_delay_s = 0.0f, float repeat_delay_s = 0.0f)
Cooldown(float first_delay_s = 0.0F, float repeat_delay_s = 0.0F)
: first_delay_s_(first_delay_s), repeat_delay_s_(repeat_delay_s),
remaining_s_(0.0f), held_before_(false) {}
remaining_s_(0.0F), held_before_(false) {}
// Llamar cada frame con delta en segundos (float)
void update(float delta_s) {
if (remaining_s_ <= 0.0f) {
remaining_s_ = 0.0f;
if (remaining_s_ <= 0.0F) {
remaining_s_ = 0.0F;
return;
}
remaining_s_ -= delta_s;
if (remaining_s_ < 0.0f) remaining_s_ = 0.0f;
if (remaining_s_ < 0.0F) remaining_s_ = 0.0F;
}
// Llamar cuando el input está activo. Devuelve true si debe ejecutarse la acción ahora.
bool tryConsumeOnHeld() {
if (remaining_s_ > 0.0f) return false;
if (remaining_s_ > 0.0F) return false;
float delay = held_before_ ? repeat_delay_s_ : first_delay_s_;
remaining_s_ = delay;
@@ -29,13 +29,13 @@ public:
// Llamar cuando el input se suelta
void onReleased() {
held_before_ = false;
remaining_s_ = 0.0f;
remaining_s_ = 0.0F;
}
bool empty() const { return remaining_s_ == 0.0f; }
bool empty() const { return remaining_s_ == 0.0F; }
// Fuerza un valor en segundos (útil para tests o resets)
void forceSet(float seconds) { remaining_s_ = seconds > 0.0f ? seconds : 0.0f; }
void forceSet(float seconds) { remaining_s_ = seconds > 0.0F ? seconds : 0.0F; }
private:
float first_delay_s_;