TargetSearchState ​
Inherits: ActionState < Resource
TargetSearchState manages the search for valid targets when entity has none. It implements different search logic for NPCs (threat-based) vs Players/Pets (proximity-based).
Description ​
Key features:
- Implements target search with caching to reduce performance impact
- Handles threat table management for NPCs
- Uses encounter-based enemy detection for cleaner combat exit logic
- Handles combat exit when no targets found
Methods ​
void | enter() |
void | update( _delta: float ) |
void | exit() |
void | search_for_target() |
Entity | find_non_threat_target() |
Entity | reset_and_select_threat_target() |
Entity | find_new_threat_target() |
void | start_delayed_combat_exit() |
void | handle_non_threat_combat_exit() |
void | handle_threat_combat_exit() |
void | exit_combat() |
void | return_all_timer() |
Method descriptions ​
void enter() ​
Sets up timers and begins target search
void update( _delta: float ) ​
Checks for target and transitions if found
void exit() ​
Cleans up timers when exiting state
void search_for_target() ​
Initiates search for new targets with cooldown
Entity find_non_threat_target() ​
Finds targets for Players/Pets using proximity
Entity reset_and_select_threat_target() ​
Selects targets for NPCs using threat tables
Entity find_new_threat_target() ​
Searches for new threat targets from encounter enemies or nearby
void start_delayed_combat_exit() ​
Starts delayed combat exit timer
void handle_non_threat_combat_exit() ​
Handles combat exit for Players/Pets
void handle_threat_combat_exit() ​
Handles combat exit for NPCs with encounter-based logic
void exit_combat() ​
Exits combat and returns to inactive
void return_all_timer() ​
Cleanup all timers