Skip to content

Commit aa5a5ab

Browse files
committed
Document the origin of unit.id=0. closes #112.
1 parent 3bf4783 commit aa5a5ab

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sc2reader/data/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def __init__(self, unit_id, flags):
4444
#: A reference to the player that killed this unit. Not always available.
4545
self.killed_by = None
4646

47-
#: The unique in-game id for this unit
47+
#: The unique in-game id for this unit. The id can sometimes be zero because
48+
#: TargetAbilityEvents will create a new unit with id zero when a unit
49+
#: behind the fog of war is targetted.
4850
self.id = unit_id
4951

5052
self.flags = flags

sc2reader/events/game.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def __init__(self, frame, pid, data):
155155
self.target_unit_type = ability_type_data.get('unit_link',None)
156156

157157
#: Integer player id of the controlling player. Available for TargetUnit type events starting in 19595.
158+
#: When the targetted unit is under fog of war this id is zero.
158159
self.control_player_id = ability_type_data.get('control_player_id',None)
159160

160161
#: Integer player id of the player paying upkeep. Available for TargetUnit type events.

0 commit comments

Comments
 (0)