Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TargetUnitCommandEvent.target_unit vs target? #148

Open
zimri-leisher opened this issue Jul 28, 2021 Discussed in #147 · 1 comment
Open

TargetUnitCommandEvent.target_unit vs target? #148

zimri-leisher opened this issue Jul 28, 2021 Discussed in #147 · 1 comment

Comments

@zimri-leisher
Copy link

Discussed in #147

Originally posted by zimri-leisher July 28, 2021
I'm relatively new to this library but I think I may have found a small issue: in the TargetUnitCommandEvent class definition, there is a field called target_unit that apparently stores a reference to the unit being targeted. However, in the ContextLoader class, in the handleTargetUnitCommandEvent method, it puts a reference to the target unit into the target field. This caused a small issue for me before I figured it out, and I know it's not a big deal, but I figured I'd better post here.

@StoicLoofah
Copy link
Collaborator

Interesting. Specifically, you're referring to the definition here

self.target_unit = None

and corresponding effort to populate it here

event.target = replay.objects[event.target_unit_id]

and here

Right?

Given that there are references to target in other places like

self.target.name, self.target_unit_id

and I presume that most people are using target, I think probably the right fix is to change the class definition to declare target not target_unit. What do others think?

@zimri-leisher Can you open a pull request updating that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants