Snayff / nqp3

1 stars 2 forks source link

Actor Can Target Dead Actors #27

Closed Snayff closed 1 year ago

Snayff commented 1 year ago

Describe the bug Actor can target and attack dead actors. Dead Actors can receive more damage.

To Reproduce Steps to reproduce the behavior:

  1. Limit to 1 actor per troupe
  2. start combat
  3. wait for actor to die
  4. See error

Expected behavior Dead Actor is ignored as a target and doesnt respond to new damage.

Screenshots image

Additional context Suggests is_targetable is either not being set or is being ignored.

eh-jogos commented 1 year ago

I think this was fixed somewhere along the way, but I think is_targetable is still not being set. Or rather, it is being set to false in the function _on_health_depleted() but it is not being read anywhere else: image

The way this got "accidentaly" fixed was that at some point I added this function to validate targets in actor_ai.gd which checks if the target is alive:

https://github.com/Snayff/nqp3/blob/6cc536758856a2d3c776c728d953f1d4243201b9/scripts/components/actor_ai.gd#L99C1-L102

Is there any other use cases for is_targetable? Or do you want me to change the check to use is_targetable rather than checking if the enemy is alive?

Snayff commented 1 year ago

I think we should probably scrap is_targetable and check for the actual parameters we want such as not being dead.