โ† All examples

godot components

Threat table with taunts and switch margin

Track threat per attacker for an enemy, decay it over time, force the target with taunts, and change targets only when another attacker passes the current one by a margin.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_threat_table.gd
  • threat_table.gd
  • verification/native.json

How it works

Class
BaltorThreatTable, extends RefCounted
Methods
add_threat(source: StringName, amount: float) -> void; get_threat(source: StringName) -> float; remove_source(source: StringName) -> void; taunt(source: StringName, seconds: float) -> void; update(delta: float) -> void; get_target() -> StringName; get_sorted_sources() -> Array[StringName]; get_taunt_time_left() -> float; and 1 more
Signals
target_changed
Placement
res://baltor/godot_components/threat_table/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

Target selection uses threat only (no range or line of sight rules). Decay is exponential per second and applied in update(). Attacker ids are StringNames. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.