def ap_tag_modifications(vmf: VMF): """Perform modifications for Aperture Tag. * Paint is always present in every map! * Suppress ATLAS's Portalgun in coop. * In singleplayer, override the transition ent instance to have the Gel Gun. * Create subdirectories with the user's steam ID to fix a workshop compile bug. """ if vbsp_options.get(str, 'game_id') != utils.STEAM_IDS['APTAG']: return # Wrong game! LOGGER.info('Performing Aperture Tag modifications...') has = vbsp.settings['has_attr'] # This will enable the PaintInMap property. has['Gel'] = True # Set as if the player spawned with no pgun has['spawn_dual'] = False has['spawn_single'] = False has['spawn_nogun'] = True transition_ents = instanceLocs.get_special_inst('transitionents') for inst in vmf.by_class['func_instance']: if inst['file'].casefold() not in transition_ents: continue inst['file'] = 'instances/bee2/transition_ents_tag.vmf' # Because of a bug in P2, these folders aren't created automatically. # We need a folder with the user's ID in portal2/maps/puzzlemaker. try: puzz_folders = os.listdir('../aperturetag/puzzles') except FileNotFoundError: LOGGER.warning("Aperturetag/puzzles/ doesn't exist??") else: for puzz_folder in puzz_folders: new_folder = os.path.abspath( os.path.join( '../portal2/maps/puzzlemaker', puzz_folder, )) LOGGER.info('Creating puzzle folder "{}"', new_folder) os.makedirs( new_folder, exist_ok=True, )
def ap_tag_modifications(vmf: VMF): """Perform modifications for Aperture Tag. * Paint is always present in every map! * Suppress ATLAS's Portalgun in coop. * In singleplayer, override the transition ent instance to have the Gel Gun. * Create subdirectories with the user's steam ID to fix a workshop compile bug. """ if vbsp_options.get(str, 'game_id') != utils.STEAM_IDS['APTAG']: return # Wrong game! LOGGER.info('Performing Aperture Tag modifications...') has = vbsp.settings['has_attr'] # This will enable the PaintInMap property. has['Gel'] = True # Set as if the player spawned with no pgun has['spawn_dual'] = False has['spawn_single'] = False has['spawn_nogun'] = True transition_ents = instanceLocs.get_special_inst('transitionents') for inst in vmf.by_class['func_instance']: if inst['file'].casefold() not in transition_ents: continue inst['file'] = 'instances/bee2/transition_ents_tag.vmf' # Because of a bug in P2, these folders aren't created automatically. # We need a folder with the user's ID in portal2/maps/puzzlemaker. try: puzz_folders = os.listdir('../aperturetag/puzzles') except FileNotFoundError: LOGGER.warning("Aperturetag/puzzles/ doesn't exist??") else: for puzz_folder in puzz_folders: new_folder = os.path.abspath(os.path.join( '../portal2/maps/puzzlemaker', puzz_folder, )) LOGGER.info('Creating puzzle folder "{}"', new_folder) os.makedirs( new_folder, exist_ok=True, )
def ap_tag_modifications(vmf: VMF): """Perform modifications for Aperture Tag. * All fizzlers will be combined with a trigger_paint_cleanser * Paint is always present in every map! * Suppress ATLAS's Portalgun in coop * Override the transition ent instance to have the Gel Gun * Create subdirectories with the user's steam ID """ if vbsp_options.get(str, 'game_id') != utils.STEAM_IDS['APTAG']: return # Wrong game! LOGGER.info('Performing Aperture Tag modifications...') has = vbsp.settings['has_attr'] # This will enable the PaintInMap property. has['Gel'] = True # Set as if the player spawned with no pgun has['spawn_dual'] = False has['spawn_single'] = False has['spawn_nogun'] = True # Add paint fizzlers to all normal fizzlers for fizz in vmf.by_class['trigger_portal_cleanser']: p_fizz = fizz.copy() p_fizz['classname'] = 'trigger_paint_cleanser' vmf.add_ent(p_fizz) if p_fizz['targetname'].endswith('_brush'): p_fizz['targetname'] = p_fizz['targetname'][:-6] + '-br_fizz' del p_fizz['drawinfastreflection'] del p_fizz['visible'] del p_fizz['useScanline'] for side in p_fizz.sides(): side.mat = 'tools/toolstrigger' side.scale = 0.25 transition_ents = get_special_inst('transitionents') for inst in vmf.by_class['func_instance']: if inst['file'].casefold() not in transition_ents: continue inst['file'] = 'instances/bee2/transition_ents_tag.vmf' # Because of a bug in P2, these folders aren't created automatically. # We need a folder with the user's ID in portal2/maps/puzzlemaker. try: puzz_folders = os.listdir('../aperturetag/puzzles') except FileNotFoundError: LOGGER.warning("Aperturetag/puzzles/ doesn't exist??") else: for puzz_folder in puzz_folders: new_folder = os.path.abspath(os.path.join( '../portal2/maps/puzzlemaker', puzz_folder, )) LOGGER.info('Creating', new_folder) os.makedirs( new_folder, exist_ok=True, )
def ap_tag_modifications(vmf: VMF): """Perform modifications for Aperture Tag. * All fizzlers will be combined with a trigger_paint_cleanser * Paint is always present in every map! * Suppress ATLAS's Portalgun in coop * Override the transition ent instance to have the Gel Gun * Create subdirectories with the user's steam ID """ if vbsp_options.get(str, 'game_id') != utils.STEAM_IDS['APTAG']: return # Wrong game! LOGGER.info('Performing Aperture Tag modifications...') has = vbsp.settings['has_attr'] # This will enable the PaintInMap property. has['Gel'] = True # Set as if the player spawned with no pgun has['spawn_dual'] = False has['spawn_single'] = False has['spawn_nogun'] = True # Add paint fizzlers to all normal fizzlers for fizz in vmf.by_class['trigger_portal_cleanser']: p_fizz = fizz.copy() p_fizz['classname'] = 'trigger_paint_cleanser' vmf.add_ent(p_fizz) if p_fizz['targetname'].endswith('_brush'): p_fizz['targetname'] = p_fizz['targetname'][:-6] + '-br_fizz' del p_fizz['drawinfastreflection'] del p_fizz['visible'] del p_fizz['useScanline'] for side in p_fizz.sides(): side.mat = 'tools/toolstrigger' side.scale = 0.25 transition_ents = instanceLocs.get_special_inst('transitionents') for inst in vmf.by_class['func_instance']: if inst['file'].casefold() not in transition_ents: continue inst['file'] = 'instances/bee2/transition_ents_tag.vmf' # Because of a bug in P2, these folders aren't created automatically. # We need a folder with the user's ID in portal2/maps/puzzlemaker. try: puzz_folders = os.listdir('../aperturetag/puzzles') except FileNotFoundError: LOGGER.warning("Aperturetag/puzzles/ doesn't exist??") else: for puzz_folder in puzz_folders: new_folder = os.path.abspath( os.path.join( '../portal2/maps/puzzlemaker', puzz_folder, )) LOGGER.info('Creating', new_folder) os.makedirs( new_folder, exist_ok=True, )