Skip to content

Commit 0dbe561

Browse files
committed
Fix gameheart plugin handling of teams and observers. Closes #174.
1 parent 6580ebb commit 0dbe561

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sc2reader/engine/plugins/gameheart.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def fix_events(self, replay, start_frame):
6969
def fix_entities(self, replay, actual_players):
7070
# Change the players that aren't playing into observers
7171
for p in [p for p in replay.players if p.pid not in actual_players]:
72+
# Fix the slot data to be accurate
73+
p.slot_data['observe'] = 1
74+
p.slot_data['team_id'] = None
7275
obs = Observer(p.sid, p.slot_data, p.uid, p.init_data, p.pid)
7376

7477
# Because these obs start the game as players the client

sc2reader/objects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def __init__(self, sid, slot_data):
101101
self.handicap = slot_data['handicap']
102102

103103
#: The entity's team number. None for observers
104-
self.team_id = slot_data['team_id']+1
104+
self.team_id = None
105+
if slot_data['team_id'] is not None:
106+
self.team_id = slot_data['team_id'] + 1
105107

106108
#: A flag indicating if the person is a human or computer
107109
#: Really just a shortcut for isinstance(entity, User)

0 commit comments

Comments
 (0)