Skip to content

ASTagUtils

PT | EN
Inherits: RefCounted

Utility functions for tag type validation, creation, and historical queries.

Description

ASTagUtils provides comprehensive helper functions for working with Ability System tags. Includes type validation, automatic type detection from naming conventions, factory methods, and powerful historical query APIs for all three tag types.

Features three specialized historical namespaces:

  • NameHistory: Queries for NAME tags (State.Stunned, Class.Warrior)
  • ConditionalHistory: Queries for CONDITIONAL tags (Can.Parried, Immune.Fire)
  • EventHistory: Enhanced queries for EVENT tags (Event.Damage, Event.Ability.Activated)
  • UnifiedHistory: Cross-type queries and debug utilities

These utilities follow the BUSINESS_RULES.md conventions for tag naming and help maintain type safety across the system with full historical tracking.

Methods

ReturnName
intcond_count_additions( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Counts how many times a specific [constant CONDITIONAL] tag was added to the target within the last [param lookback_sec] seconds.
intcond_count_removals( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Counts how many times a specific [constant CONDITIONAL] tag was removed from the target within the last [param lookback_sec] seconds.
Arraycond_get_recent_additions( target: Node, lookback_sec: float = 1.0) static
Returns an array of conditional tag names that were added to the target within the last [param lookback_sec] seconds.
Arraycond_get_recent_changes( target: Node, lookback_sec: float = 1.0) static
Returns an array of all conditional tag events (additions and removals) that occurred within the last [param lookback_sec] seconds.
Arraycond_get_recent_removals( target: Node, lookback_sec: float = 1.0) static
Returns an array of conditional tag names that were removed from the target within the last [param lookback_sec] seconds.
boolcond_had_tag( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the target had the specified conditional tag at any point during the last [param lookback_sec] seconds.
boolcond_was_tag_added( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the specified conditional tag was added to the target within the last [param lookback_sec] seconds.
boolcond_was_tag_removed( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the specified conditional tag was removed from the target within the last [param lookback_sec] seconds.
intdetect_tag_type( tag: StringName) static
Detects tag type from naming convention. Event.* -> EVENT, Can.* or Immune.* -> CONDITIONAL, others -> NAME.
intevent_count_occurrences( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns the number of times the specified event occurred on the target within the last [param lookback_sec] seconds.
boolevent_did_occur( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the specified event occurred on the target within the last [param lookback_sec] seconds.
Arrayevent_get_all_recent_events( target: Node, lookback_sec: float = 1.0) static
Returns a list of all event entries that occurred on the target within the last [param lookback_sec] seconds.
Dictionaryevent_get_last_data( tag: StringName, target: Node) static
Retrieves the data payload from the most recent occurrence of the specified event tag.
Nodeevent_get_last_instigator( tag: StringName, target: Node) static
Retrieves the instigator node from the most recent occurrence of the specified event tag.
floatevent_get_last_magnitude( tag: StringName, target: Node) static
Retrieves the magnitude value from the most recent occurrence of the specified event tag.
Arrayevent_get_recent_events( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns a list of recent entries for a specific event tag on the target.
voidhistory_dump( target: Node, lookback_sec: float = 5.0) static
Prints a formatted debug log of all historical entries for the target to the console.
Arrayhistory_get_all_changes( target: Node, lookback_sec: float = 1.0) static
Returns a combined array of all Name and Conditional tag changes within the last [param lookback_sec] seconds.
Arrayhistory_get_tag_history( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns all historical entries (timeline) for a specific tag on the target.
inthistory_get_total_size( target: Node) static
Returns the combined number of entries across all historical buffers for the target.
boolhistory_was_tag_present( tag: StringName, target: Node, lookback_sec: float = 1.0) static
General purpose query to check if any version of the specified tag was present at any point within the target’s historical buffers.
boolis_can_tag( tag: StringName) static
Returns true if tag name starts with “Can.”.
boolis_class_tag( tag: StringName) static
Returns true if tag name starts with “Class.”.
boolis_event_tag( tag: StringName) static
Returns true if tag name starts with “Event.”.
boolis_immune_tag( tag: StringName) static
Returns true if tag name starts with “Immune.”.
boolis_state_tag( tag: StringName) static
Returns true if tag name starts with “State.”.
boolis_team_tag( tag: StringName) static
Returns true if tag name starts with “Team.”.
intname_count_additions( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Counts how many times a specific [constant NAME] tag was added to the target within the last [param lookback_sec] seconds.
intname_count_removals( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Counts how many times a specific [constant NAME] tag was removed from the target within the last [param lookback_sec] seconds.
Arrayname_get_recent_additions( target: Node, lookback_sec: float = 1.0) static
Returns an array of name tag identifiers that were added to the target within the last [param lookback_sec] seconds.
Arrayname_get_recent_changes( target: Node, lookback_sec: float = 1.0) static
Returns an array of all name tag events (additions and removals) that occurred within the last [param lookback_sec] seconds.
Arrayname_get_recent_removals( target: Node, lookback_sec: float = 1.0) static
Returns an array of name tag identifiers that were removed from the target within the last [param lookback_sec] seconds.
boolname_had_tag( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the target had the specified name tag at any point during the last [param lookback_sec] seconds.
boolname_was_tag_added( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the specified name tag was added to the target within the last [param lookback_sec] seconds.
boolname_was_tag_removed( tag: StringName, target: Node, lookback_sec: float = 1.0) static
Returns true if the specified name tag was removed from the target within the last [param lookback_sec] seconds.
boolvalidate_tag_type( tag: StringName, expected_type: int) static
Validates that a tag exists and matches the expected type. Returns false if tag doesn’t exist or type doesn’t match.

Constants

NameValue
NAME0
A standard identity tag for classes, states, or teams (e.g., State.Stunned).
CONDITIONAL1
A dynamic conditional tag with duration and magnitude support (e.g., Can.Attack).
EVENT2
A high-frequency ephemeral tag with payload support (e.g., Event.Damage).
UNKNOWN255