@@ -55,7 +55,7 @@ def handleTargetAbilityEvent(self, event, replay):
5555 # Often when the target_unit_id is not in replay.objects it is 0 because it
5656 # is a target building/destructable hidden by fog of war. Perhaps we can match
5757 # it through the fog using location?
58- unit = replay .datapack .create_unit (event .target_unit_id , event .target_unit_type , 0x00 , event .frame )
58+ unit = replay .datapack .create_unit (event .target_unit_id , event .target_unit_type , event .frame )
5959 event .target = unit
6060 replay .objects [event .target_unit_id ] = unit
6161
@@ -64,7 +64,8 @@ def handleSelectionEvent(self, event, replay):
6464 return
6565
6666 units = list ()
67- for (unit_id , unit_type , subgroup , intra_subgroup ) in event .new_unit_info :
67+ # TODO: Blizzard calls these subgroup flags but that doesn't make sense right now
68+ for (unit_id , unit_type , subgroup_flags , intra_subgroup_flags ) in event .new_unit_info :
6869 # If we don't have access to tracker events, use selection events to create
6970 # new units and track unit type changes. It won't be perfect, but it is better
7071 # than nothing.
@@ -79,14 +80,17 @@ def handleSelectionEvent(self, event, replay):
7980 if not unit .is_type (unit_type ):
8081 replay .datapack .change_type (unit , unit_type , event .frame )
8182 else :
82- unit = replay .datapack .create_unit (unit_id , unit_type , 0x00 , event .frame )
83+ unit = replay .datapack .create_unit (unit_id , unit_type , event .frame )
8384 replay .objects [unit_id ] = unit
8485
8586 # If we have tracker events, the unit must already exist and must already
8687 # have the correct unit type.
8788 else :
8889 unit = replay .objects [unit_id ]
8990
91+ # Selection events hold flags on units (like hallucination)
92+ unit .apply_flags (intra_subgroup_flags )
93+
9094 units .append (unit )
9195
9296 event .new_units = event .objects = units
@@ -110,7 +114,7 @@ def handleUnitBornEvent(self, event, replay):
110114 event .unit = replay .objects [event .unit_id ]
111115 else :
112116 # TODO: How to tell if something is hallucination?
113- event .unit = replay .datapack .create_unit (event .unit_id , event .unit_type_name , 0 , event .frame )
117+ event .unit = replay .datapack .create_unit (event .unit_id , event .unit_type_name , event .frame )
114118 replay .objects [event .unit_id ] = event .unit
115119
116120 replay .active_units [event .unit_id_index ] = event .unit
@@ -189,7 +193,7 @@ def handleUnitInitEvent(self, event, replay):
189193 event .unit = replay .objects [event .unit_id ]
190194 else :
191195 # TODO: How to tell if something is hallucination?
192- event .unit = replay .datapack .create_unit (event .unit_id , event .unit_type_name , 0 , event .frame )
196+ event .unit = replay .datapack .create_unit (event .unit_id , event .unit_type_name , event .frame )
193197 replay .objects [event .unit_id ] = event .unit
194198
195199 replay .active_units [event .unit_id_index ] = event .unit
0 commit comments