Fix bool crash in _play_damage_animations (GDScript or operator)
GDScript 4's `or` is a logical operator that returns bool, not the
left/right value like Python. `player.get("archSpirit") or {}` was
putting true/false into the iteration array instead of the dict,
causing `is_empty` to fail with 'base bool'.
Replace with an explicit null check:
var _arch_list = [] if arch_raw == null else [arch_raw]
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:
@@ -1704,7 +1704,9 @@ func _play_damage_animations(state: Dictionary) -> bool:
|
||||
var damaged_iids : Dictionary = {}
|
||||
var seen_iids : Dictionary = {}
|
||||
for player: Dictionary in state.get("players", []):
|
||||
for unit: Dictionary in ([player.get("archSpirit") or {}] + player.get("field", [])):
|
||||
var _arch_raw = player.get("archSpirit")
|
||||
var _arch_list : Array = [] if _arch_raw == null else [_arch_raw]
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user