Fix nil crash: int(null) on currentHealth in damage animations

unit.get("currentHealth", 0) returns null when the key exists with a
null value; int(null) has no valid constructor in GDScript 4.
Use explicit null check before casting.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-28 12:05:57 -04:00
co-authored by Claude Happy
parent 04ad45d0f7
commit 450c71544d
@@ -1709,7 +1709,8 @@ func _play_damage_animations(state: Dictionary) -> bool:
for unit: Dictionary in (_arch_list + player.get("field", [])):
if unit.is_empty(): continue
var iid := str(unit.get("instanceId", ""))
var new_hp := int(unit.get("currentHealth", 0))
var _hp_v = unit.get("currentHealth")
var new_hp := 0 if _hp_v == null else int(_hp_v)
var old_hp : int = _prev_unit_hp.get(iid, new_hp)
seen_iids[iid] = true
if new_hp < old_hp: