def _init_scene(self, debug=False): # # To gather mask data, enable this. # self.write_samples = False # Load mask files. self._masks = MultiClassIkaMatcher() for special_weapon in special_weapons.keys(): try: mask = IkaMatcher( 0, 0, 150, 24, img_file='special_%s.png' % special_weapon, threshold=0.90, orig_threshold=0.20, bg_method=matcher.MM_NOT_WHITE(), fg_method=matcher.MM_WHITE(), label='special/%s' % special_weapon, call_plugins=self._call_plugins, debug=debug, ) mask._id = special_weapon self._masks.add_mask(mask) except: IkaUtils.dprint('%s: Failed to load mask for %s' % (self, special_weapon)) pass
def _init_scene(self, debug=False): self.my_team = [] self.counter_team = [] # # To gather mask data, enable this. # self.write_samples = False # Load mask files. self.masks = [] for special_weapon in special_weapons.keys(): try: mask = IkaMatcher( 0, 0, 150, 24, img_file='special_%s.png' % special_weapon, threshold=0.90, orig_threshold=0.20, bg_method=matcher.MM_NOT_WHITE(), fg_method=matcher.MM_WHITE(), label='special/%s' % special_weapon, debug=debug, ) mask._id = special_weapon self.masks.append(mask) except: IkaUtils.dprint('%s: Failed to load mask for %s' % (self, special_weapon)) pass
def on_game_special_weapon(self, context): if not self.track_special_weapon_enabled: return special_weapon = context['game'].get('special_weapon', None) if not (special_weapon in special_weapons.keys()): IkaUtils.dprint('%s: special_weapon %s is invalid.' % (self, special_weapon)) return event_msec = self._get_offset_msec(context) if event_msec: self._add_event(context, { 'type': 'special_weapon', 'special_weapon': special_weapon, 'me': context['game'].get('special_weapon_is_mine', False), })
def on_game_special_weapon(self, context): if not self.track_special_weapon_enabled: return special_weapon = context['game'].get('special_weapon', None) if not (special_weapon in special_weapons.keys()): IkaUtils.dprint('%s: special_weapon %s is invalid.' % (self, special_weapon)) return if ('msec' in context['engine']) and (self.time_start_at_msec is not None): event_msec = context['engine']['msec'] - self.time_start_at_msec self._add_event(context, { 'type': 'special_weapon', 'special_weapon': special_weapon, 'me': context['game'].get('special_weapon_is_mine', False), })
def on_game_special_weapon(self, context): if not self.track_special_weapon_enabled: return special_weapon = context["game"].get("special_weapon", None) if not (special_weapon in special_weapons.keys()): IkaUtils.dprint("%s: special_weapon %s is invalid." % (self, special_weapon)) return event_msec = self._get_offset_msec(context) if event_msec: self._add_event( context, { "type": "special_weapon", "special_weapon": special_weapon, "me": context["game"].get("special_weapon_is_mine", False), }, )