Aura bubbles remain after mob removed from board, until a new tile is clicked

This commit is contained in:
dingo
2026-05-08 15:54:53 -04:00
parent 9f15cf1e74
commit a5e1dde029
@@ -384,6 +384,7 @@ func _on_state_updated(state: Dictionary) -> void:
print("[GameScreen] state_updated phase=", state.get("phase", "?"),
" mode=", _sel_ctrl.mode if _sel_ctrl != null else "n/a")
_unit_reg.rebuild_ownership(state)
_clear_stale_aura_overlay()
var p1_id: String = str(state.get("playerOneAccountId", ""))
if not p1_id.is_empty():
@@ -931,6 +932,21 @@ func _clear_aura_hover_overlay() -> void:
_hovered_aura_unit_id = ""
func _clear_stale_aura_overlay() -> void:
if _hovered_aura_unit_id.is_empty():
return
var unit: Dictionary = Game.get_unit_by_id(_hovered_aura_unit_id)
if unit.is_empty():
_clear_aura_hover_overlay()
return
var pos: Variant = unit.get("position")
if not (pos is Dictionary) or (pos as Dictionary).is_empty():
_clear_aura_hover_overlay()
return
if _aura_ranges_for_unit(unit).is_empty():
_clear_aura_hover_overlay()
func _aura_ranges_for_unit(unit: Dictionary) -> Array[Dictionary]:
var raw_abil: Variant = unit.get("abilitiesJson")
var parsed: Variant = JSON.parse_string("[]" if raw_abil == null else str(raw_abil))