Skip to content

ApplicationTracker ​

Inherits: RefCounted

Tracks applications of a status effect for diminishing returns

Variables ​

intstatus_effect_id
intapplication_count0
floatlast_application_time0.0
ChronoManagerchrono_manager
Timerreset_timer

Methods ​

intadd_application( reset_time: float )
voidreset_applications()
floatget_time_since_last_application()
floatget_reset_time_remaining()
boolhas_reset_timer()
Stringget_display_string()
Dictionaryget_state_info()
Dictionaryto_save_data()
voidfrom_save_data( data: Dictionary, reset_time: float = 0.0 )
voidcleanup()

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