コード例 #1
0
    def _process(self, path: Path, modid: Optional[str]):
        map_name = path.name
        logger.info(f'Processing data of map: {map_name}')

        # Load exported data
        data_biomes = self.load_json_file(path / 'biomes.json')
        data_map_settings = self.load_json_file(path / 'world_settings.json')
        if not data_biomes or not data_map_settings:
            logger.debug(
                f'Data required by the processor is missing or invalid. Skipping.'
            )
            return

        config = get_overrides_for_map(data_map_settings['persistentLevel'],
                                       None).svgs
        bounds = SVGBoundaries(
            size=1024,
            border_top=config.border_top,
            border_left=config.border_left,
            coord_width=config.border_right - config.border_left,
            coord_height=config.border_bottom - config.border_top,
        )
        svg = generate_svg_map(bounds, map_name,
                               data_map_settings['worldSettings'], data_biomes,
                               modid is not None)
        filename = Path(path / f'Regions_{map_name}.svg')
        if svg:
            self.save_raw_file(svg, filename)
        elif filename.is_file():
            filename.unlink()
コード例 #2
0
ファイル: discovery.py プロジェクト: AngellusMortis/Purlovia
    def discover_vanilla_levels(self) -> Iterator[str]:
        config = get_global_config()
        official_modids = set(config.official_mods.ids())
        official_modids -= set(config.settings.SeparateOfficialMods)
        official_mod_prefixes = tuple(f'/Game/Mods/{modid}/'
                                      for modid in official_modids)

        all_cls_names = list(ue.hierarchy.find_sub_classes(WORLD_CLS))
        all_cls_names += ue.hierarchy.find_sub_classes(LEVEL_SCRIPT_ACTOR_CLS)

        for cls_name in all_cls_names:
            assetname = cls_name[:cls_name.rfind('.')]

            # Check if this asset is meant to be skipped
            overrides = get_overrides_for_map(assetname, '')
            if overrides.skip_export:
                continue

            # Skip anything in the mods directory that isn't one of the listed official mods
            if assetname.startswith('/Game/Mods') and not any(
                    assetname.startswith(prefix)
                    for prefix in official_mod_prefixes):
                continue

            yield assetname
コード例 #3
0
def _get_svg_bounds_for_map(persistent_level: str) -> SVGBoundaries:
    config = get_overrides_for_map(persistent_level, None).svgs
    bounds = SVGBoundaries(
        size=300,
        border_top=config.border_top,
        border_left=config.border_left,
        coord_width=config.border_right - config.border_left,
        coord_height=config.border_bottom - config.border_top,
    )
    return bounds
コード例 #4
0
ファイル: discovery.py プロジェクト: AngellusMortis/Purlovia
    def discover_mod_levels(self, modid: str) -> Iterator[str]:
        clean_path = self.loader.clean_asset_name(f'/Game/Mods/{modid}') + '/'

        all_cls_names = list(ue.hierarchy.find_sub_classes(WORLD_CLS))
        all_cls_names += ue.hierarchy.find_sub_classes(LEVEL_SCRIPT_ACTOR_CLS)

        for cls_name in all_cls_names:
            assetname = cls_name[:cls_name.rfind('.')]

            if assetname.startswith(clean_path):
                # Check if this asset is meant to be skipped
                overrides = get_overrides_for_map(assetname, modid)
                if overrides.skip_export:
                    continue

                yield assetname