sc2reader icon indicating copy to clipboard operation
sc2reader copied to clipboard

Context.py event attribute fixes

Open Andrene opened this issue 3 years ago • 2 comments

Should fix issue #176

Andrene avatar Aug 07 '22 19:08 Andrene

Why not UnitDiedEvent.killing_player_id as mentioned in CHANGELOG.rst?

cclauss avatar Aug 07 '22 20:08 cclauss

The changes I made were to handleUnitPositionsEvent and handleUnitDoneEvent, neither of the associated events processed by those have either attribute. In the above commit I fixed the reference here https://github.com/ggtracker/sc2reader/blob/c17bd35de0361bd82480213c8a8cf66dc3570ca4/sc2reader/engine/plugins/context.py#L201 I dont think that killing_player_id or killer_pid would be a good fit there, as the error that is logged references being unable to delete a unit index, and the if condition above checks if the unit_id_index is in the list of active units, so to me it'd make sense to use the unit_id_index

Further down in the handleUnitDiedEvent function an error for unknown killing player id exists and uses the appropriate non-deprecated attribute https://github.com/ggtracker/sc2reader/blob/c17bd35de0361bd82480213c8a8cf66dc3570ca4/sc2reader/engine/plugins/context.py#L219

Andrene avatar Aug 07 '22 21:08 Andrene