Skip to content

Commit ccef488

Browse files
authored
Merge pull request #187 from dlithio/upstream
Identify all ControlGroupEvent update_types
2 parents b137910 + cba20f2 commit ccef488

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

sc2reader/events/game.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,21 @@ def __str__(self):
521521

522522
def create_control_group_event(frame, pid, data):
523523
update_type = data["control_group_update"]
524-
if update_type == 0:
524+
if update_type in [0, 4]:
525+
# 0 is the normal set command.
526+
# 4 is used when you steal and set. If required, type 4 will be followed by autogenerated
527+
# selection and control group events that remove the units from their other groups.
525528
return SetControlGroupEvent(frame, pid, data)
526-
elif update_type == 1:
529+
elif update_type in [1, 5]:
530+
# 1 is the normal add command.
531+
# 5 is used when you steal and add. If required, type 5 will be followed by autogenerated
532+
# selection and control group events that remove the units from their other groups.
527533
return AddToControlGroupEvent(frame, pid, data)
528534
elif update_type == 2:
529535
return GetControlGroupEvent(frame, pid, data)
530536
elif update_type == 3:
531-
# TODO: What could this be?!?
532-
return ControlGroupEvent(frame, pid, data)
537+
return DeleteControlGroupEvent(frame, pid, data)
533538
else:
534-
# No idea what this is but we're seeing update_types of 4 and 5 in 3.0
535539
return ControlGroupEvent(frame, pid, data)
536540

537541

@@ -589,6 +593,15 @@ class AddToControlGroupEvent(SetControlGroupEvent):
589593
"""
590594

591595

596+
class DeleteControlGroupEvent(ControlGroupEvent):
597+
"""
598+
Extends :class:`ControlGroupEvent`
599+
600+
This event deletes the control group (all units are removed). This happens when all
601+
units are stolen from the event group (alt, alt+shift modifiers by default).
602+
"""
603+
604+
592605
class GetControlGroupEvent(ControlGroupEvent):
593606
"""
594607
Extends :class:`ControlGroupEvent`

0 commit comments

Comments
 (0)