ApplicationTracker ​
Inherits: RefCounted
Tracks applications of a status effect for diminishing returns
Variables ​
int | status_effect_id | |
int | application_count | 0 |
float | last_application_time | 0.0 |
ChronoManager | chrono_manager | |
Timer | reset_timer |
Methods ​
int | add_application( reset_time: float ) |
void | reset_applications() |
float | get_time_since_last_application() |
float | get_reset_time_remaining() |
bool | has_reset_timer() |
String | get_display_string() |
Dictionary | get_state_info() |
Dictionary | to_save_data() |
void | from_save_data( data: Dictionary, reset_time: float = 0.0 ) |
void | cleanup() |
Signals ​
applications_reset( tracker: ApplicationTracker ) ​
========== SIGNALS ==========
application_added( tracker: ApplicationTracker, new_count: int ) ​
Emitted when the status is applied again: the tracker and the new count.
Variable descriptions ​
int status_effect_id ​
========== CORE PROPERTIES ==========
int application_count = 0 ​
How many times the status was applied recently.
float last_application_time = 0.0 ​
The time of the last application.
ChronoManager chrono_manager ​
The manager of timers.
Timer reset_timer ​
The timer that sets the count back to zero when nothing was applied for a while.
Method descriptions ​
int add_application( reset_time: float ) ​
Counts one more application and restarts the reset timer (reset_time seconds; 0 = no reset). Returns the new count
void reset_applications() ​
Sets the count back to 0 and emits applications_reset
float get_time_since_last_application() ​
Seconds since the last application
float get_reset_time_remaining() ​
Seconds until the count resets (0 when no timer runs)
bool has_reset_timer() ​
Is the reset timer running?
String get_display_string() ​
A line for debugging: the id, the count and the time until the reset
Dictionary get_state_info() ​
A dictionary with the id, count, times and whether the reset timer runs, for debugging
Dictionary to_save_data() ​
The id, the count, the time of the last application and the time the reset timer has left
void from_save_data( data: Dictionary, reset_time: float = 0.0 ) ​
Restores the values of to_save_data and restarts the reset timer with the time that was left
void cleanup() ​
Stops and returns the reset timer