Skip to content

Commit 24c0acf

Browse files
committed
Flesh out the ping class.
1 parent dda41fb commit 24c0acf

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ CHANGELOG
1010
* GetFromHotkeyEvent is now GetControlGroupEvent.
1111
* PlayerAbilityEvent is no longer part of the event hierarchy.
1212
* event.name is no longer a class property; it can only be accessed from an event instance.
13-
13+
* PingEvents now have new attributes:
14+
* event.to_all - true if ping seen by all
15+
* event.to_allies - true if ping seen by allies
16+
* event.to_observers - true if ping seen by observers
17+
* event.location - tuple of (event.x, event.y)
1418

1519

1620
0.6.4 - September 22nd 2013

sc2reader/events/message.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,24 @@ class PingEvent(MessageEvent):
6060
"""
6161
def __init__(self, frame, pid, target, x, y):
6262
super(PingEvent, self).__init__(frame, pid)
63+
64+
#: The numerical target type. 0 = to all; 2 = to allies; 4 = to observers.
6365
self.target = target
64-
self.x, self.y = x, y
66+
67+
#: Flag marked true of message was to all.
68+
self.to_all = (self.target == 0)
69+
70+
#: Flag marked true of message was to allies.
71+
self.to_allies = (self.target == 2)
72+
73+
#: Flag marked true of message was to observers.
74+
self.to_observers = (self.target == 4)
75+
76+
#: The x coordinate of the target location
77+
self.x = x
78+
79+
#: The y coordinate of the target location
80+
self.y = y
81+
82+
#: The (x,y) coordinate of the target location
83+
self.location = (self.x, self.y)

0 commit comments

Comments
 (0)