1010
1111
1212class TrackerEvent (Event ):
13+ """
14+ Parent class for all tracker events.
15+ """
1316 def __init__ (self , frames ):
1417 #: The frame of the game this event was applied
1518 self .frame = frames
19+
20+ #: The second of the game (game time not real time) this event was applied
1621 self .second = frames >> 4
1722
1823 #: Short cut string for event class name
@@ -30,17 +35,15 @@ def __str__(self):
3035
3136class PlayerStatsEvent (TrackerEvent ):
3237 """
33- Player Stats events are generated for all players that were in the game
34- even if they've since left every 10 seconds. An additional set of stats
35- events are generated at the end of the game.
38+ Player Stats events are generated for all players that were in the game even if they've since
39+ left every 10 seconds. An additional set of stats events are generated at the end of the game.
3640
37- When a player leaves the game, a single PlayerStatsEvent is generated
38- for that player and no one else. That player continues to generate
39- PlayerStatsEvents at 10 second intervals until the end of the game.
41+ When a player leaves the game, a single PlayerStatsEvent is generated for that player and no
42+ one else. That player continues to generate PlayerStatsEvents at 10 second intervals until the
43+ end of the game.
4044
41- In 1v1 games, the above behavior can cause the losing player to have 2
42- events generated at the end of the game. One for leaving and one for
43- the end of the game.
45+ In 1v1 games, the above behavior can cause the losing player to have 2 events generated at the
46+ end of the game. One for leaving and one for the end of the game.
4447 """
4548 def __init__ (self , frames , data , build ):
4649 super (PlayerStatsEvent , self ).__init__ (frames )
@@ -213,15 +216,14 @@ def __str__(self):
213216
214217class UnitBornEvent (TrackerEvent ):
215218 """
216- Generated when a unit is created in a finished state in the game. Examples
217- include the Marine, Zergling, and Zealot (when trained from a gateway).
218- Units that enter the game unfinished (all buildings, warped in units) generate
219- a :class:`UnitInitEvent` instead.
220-
221- Unfortunately, units that are born do not have events marking their beginnings
222- like :class:`UnitInitEvent` and :class:`UnitDoneEvent` do. The closest thing to
223- it are the :class:`~sc2reader.event.game.AbilityEvent` game events where the ability
224- is a train unit command.
219+ Generated when a unit is created in a finished state in the game. Examples include the Marine,
220+ Zergling, and Zealot (when trained from a gateway). Units that enter the game unfinished (all
221+ buildings, warped in units) generate a :class:`UnitInitEvent` instead.
222+
223+ Unfortunately, units that are born do not have events marking their beginnings like
224+ :class:`UnitInitEvent` and :class:`UnitDoneEvent` do. The closest thing to it are the
225+ :class:`~sc2reader.event.game.AbilityEvent` game events where the ability is a train unit
226+ command.
225227 """
226228 def __init__ (self , frames , data , build ):
227229 super (UnitBornEvent , self ).__init__ (frames )
@@ -253,10 +255,12 @@ def __init__(self, frames, data, build):
253255 #: The player object that controls this unit. 0 means neutral unit
254256 self .unit_controller = None
255257
256- #: The x coordinate of the location
258+ #: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
259+ #: Location prior to rounding marks the center of the unit footprint.
257260 self .x = data [5 ] * 4
258261
259- #: The y coordinate of the location
262+ #: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
263+ #: Location prior to rounding marks the center of the unit footprint.
260264 self .y = data [6 ] * 4
261265
262266 #: The map location of the unit birth
@@ -292,10 +296,12 @@ def __init__(self, frames, data, build):
292296 #: The player object of the that killed the unit. Not always available.
293297 self .killer = None
294298
295- #: The x coordinate of the location
299+ #: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
300+ #: Location prior to rounding marks the center of the unit footprint.
296301 self .x = data [3 ] * 4
297302
298- #: The y coordinate of the location
303+ #: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
304+ #: Location prior to rounding marks the center of the unit footprint.
299305 self .y = data [4 ] * 4
300306
301307 #: The map location the unit was killed at.
@@ -394,10 +400,9 @@ def __str__(self):
394400
395401class UnitInitEvent (TrackerEvent ):
396402 """
397- The counter part to :class:`UnitDoneEvent`, generated by the game engine
398- when a unit is initiated. This applies only to units which are started
399- in game before they are finished. Primary examples being buildings and
400- warp-in units.
403+ The counter part to :class:`UnitDoneEvent`, generated by the game engine when a unit is
404+ initiated. This applies only to units which are started in game before they are finished.
405+ Primary examples being buildings and warp-in units.
401406 """
402407 def __init__ (self , frames , data , build ):
403408 super (UnitInitEvent , self ).__init__ (frames )
@@ -429,10 +434,12 @@ def __init__(self, frames, data, build):
429434 #: The player object that controls this unit. 0 means neutral unit
430435 self .unit_controller = None
431436
432- #: The x coordinate of the location
437+ #: The x coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
438+ #: Location prior to rounding marks the center of the unit footprint.
433439 self .x = data [5 ] * 4
434440
435- #: The y coordinate of the location
441+ #: The y coordinate of the location with 4 point resolution. E.g. 13.75 recorded as 12.
442+ #: Location prior to rounding marks the center of the unit footprint.
436443 self .y = data [6 ] * 4
437444
438445 #: The map location the unit was started at
@@ -444,9 +451,8 @@ def __str__(self):
444451
445452class UnitDoneEvent (TrackerEvent ):
446453 """
447- The counter part to the :class:`UnitInitEvent`, generated by the game engine
448- when an initiated unit is completed. E.g. warp-in finished, building finished,
449- morph complete.
454+ The counter part to the :class:`UnitInitEvent`, generated by the game engine when an initiated
455+ unit is completed. E.g. warp-in finished, building finished, morph complete.
450456 """
451457 def __init__ (self , frames , data , build ):
452458 super (UnitDoneEvent , self ).__init__ (frames )
@@ -485,7 +491,9 @@ def __init__(self, frames, data, build):
485491 #: A dict mapping of units that had their position updated to their positions
486492 self .units = dict ()
487493
488- #: A list of (unit_index, (x,y)) derived from the first_unit_index and items
494+ #: A list of (unit_index, (x,y)) derived from the first_unit_index and items. Like the other
495+ #: tracker events, these coordinates have 4 point resolution. (15,25) recorded as (12,24).
496+ #: Location prior to rounding marks the center of the unit footprint.
489497 self .positions = list ()
490498
491499 unit_index = self .first_unit_index
0 commit comments