Skip to content

TargetUnitCommandEvent.target_unit vs target? #148

Open

Description

@zimri-leisher

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.

Activity

  1. StoicLoofah commented on Aug 10, 2021

    @StoicLoofah
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions