OctoD / godot-gameplay-systems

⚔️ A plugin for Godot to create your gameplay systems in a Godot way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple instances of the same Node share tags during activation [bug]

Hairic95 opened this issue · comments

Describe the bug
While using GGS, I created a Scene for a enemy entity with a ShootBullet Ability. This requires two tags to start ('alive' and 'triple_shoot') and is blocked if the tag 'triple_shooting' is present, which is given on activation. This works fine when there's only 1 of these enemies, however when multiple are added to the scene, only one of them seems to performing the ability.
I noticed that the tag 'triple_shooting' is added to all entities of the same type when the Ability, instead of that specific entity. This happens within the AbilityContainer function "_handle_ability_activated".

Currently I wrote the following quick fix to avoid to add the tag to all instances by confronting who that tag is for. Probably it would be cool if the function gets called only on the target object.

immagine

Here's the ability configuration, for reference (in the chance I set something wrong):

immagine

Desktop:

  • OS: Windows 10
  • Godot version [e.g. 4.0.3]

Hi, thank you for reporting this!

May I ask you how are you activating the ability?

If possible, may I also ask you for a minimum repr project? Thank you!

Sure thing, I set the ability like this in the _process() function
immagine

I set momentarly the repo public, to give you access to the project I'm currently working on
https://github.com/Hairic95/Grelz

Thank you in advance for the help.

I am debugging it (you should close your source asap). Btw, you can simplify that check to

          if activation_event.ability_container != self:
		return

Ok, it's my fault (guess what? Ahaha). I have to add checks, because by design abilities are reference counted, and if you instance one ability by the editor only one instance will exist, leading to one ability connected to multiple ability containers.

Fixing right now, close your source and thank you!

Glad I could have pointed to this problem, thank you for your help! I guess these checks should be made in any of the "handle_ability*".
I take the chance to say that I'm really liking this system so far. It avoids me to do silly manual timeouts around the code and seems really solid. I hope my project can help iron out this tool!

My repo is closed and secured (it's a personal project so it's not too much of a problem opening or closing it out eheh, I kinda want to release the code if the final result is any successfull).