Mob fixes.
This commit is contained in:
@@ -641,12 +641,7 @@ func _update_mob_entities():
|
||||
mob_dead = hp <= 0
|
||||
var was_dead = entity_node.get_meta("is_dead", false)
|
||||
|
||||
if mob_dead and not was_dead:
|
||||
# Alive → dead transition
|
||||
entity_node.set_meta("is_dead", true)
|
||||
if entity_node.has_method("play_death_animation"):
|
||||
entity_node.play_death_animation()
|
||||
elif not mob_dead and was_dead:
|
||||
if not mob_dead and was_dead:
|
||||
# Dead → alive transition (respawn / reused ID) — reset stale state
|
||||
entity_node.set_meta("is_dead", false)
|
||||
if entity_node.has_method("reset_state"):
|
||||
@@ -656,9 +651,16 @@ func _update_mob_entities():
|
||||
var has_loot = mob.get("hasLoot", mob.get("HasLoot", false))
|
||||
entity_node.set_meta("has_loot", has_loot)
|
||||
|
||||
# Update visual data BEFORE death transition so play_death_animation() has final say
|
||||
if entity_node.has_method("update_data"):
|
||||
entity_node.update_data(mob)
|
||||
|
||||
if mob_dead and not was_dead:
|
||||
# Alive → dead transition — called AFTER update_data so it overrides animation
|
||||
entity_node.set_meta("is_dead", true)
|
||||
if entity_node.has_method("play_death_animation"):
|
||||
entity_node.play_death_animation()
|
||||
|
||||
# Remove entity nodes that are no longer tracked at all
|
||||
for child in mobs_container.get_children():
|
||||
if child.has_meta("entity_id"):
|
||||
|
||||
Reference in New Issue
Block a user