|
|
@ -7,7 +7,7 @@ from typing import Dict |
|
|
|
|
|
|
|
|
from git import Repo |
|
|
from git import Repo |
|
|
|
|
|
|
|
|
from pyenliven import MODS_STOPGAP_DIR, echo0 |
|
|
from pyenliven import MODS_STOPGAP_DIR, PATCHES_SUBGAME_DIR, echo0 |
|
|
from pyenliven.metadata import ( |
|
|
from pyenliven.metadata import ( |
|
|
BASE_ENLIVEN_CONF_SETTINGS, |
|
|
BASE_ENLIVEN_CONF_SETTINGS, |
|
|
gamespec, |
|
|
gamespec, |
|
|
@ -190,6 +190,31 @@ class GameBuilder: |
|
|
update_conf(path, new_settings) |
|
|
update_conf(path, new_settings) |
|
|
# desired_set = {line.strip() for line in desired_lines if line.strip()} |
|
|
# desired_set = {line.strip() for line in desired_lines if line.strip()} |
|
|
|
|
|
|
|
|
|
|
|
def apply_subgame_patch(self, name, src_parent=None, level=0): |
|
|
|
|
|
if src_parent is None: |
|
|
|
|
|
src_parent = os.path.join(PATCHES_SUBGAME_DIR, name) |
|
|
|
|
|
dst_parent = os.path.join(self.target_game, name) |
|
|
|
|
|
if os.path.isdir(src_parent): |
|
|
|
|
|
for sub in os.listdir(src_parent): |
|
|
|
|
|
src = os.path.join(src_parent, sub) |
|
|
|
|
|
dst = os.path.join(dst_parent, sub) |
|
|
|
|
|
if os.path.isdir(src): |
|
|
|
|
|
if not os.path.isdir(dst): |
|
|
|
|
|
os.makedirs(dst) |
|
|
|
|
|
self.apply_subgame_patch( |
|
|
|
|
|
os.path.join(name, sub), |
|
|
|
|
|
src_parent=src, |
|
|
|
|
|
level=level+1) |
|
|
|
|
|
continue |
|
|
|
|
|
if os.path.isfile(dst): |
|
|
|
|
|
os.remove(dst) |
|
|
|
|
|
shutil.copy(src, dst) |
|
|
|
|
|
else: |
|
|
|
|
|
logger.warning(f"There is no {src_parent}," |
|
|
|
|
|
" so the icon and header will not be patched.") |
|
|
|
|
|
# if level == 0: |
|
|
|
|
|
echo0(f"Applied overwrite-based patch:\n-{dst_parent}\n+{src_parent}") |
|
|
|
|
|
|
|
|
def build(self, conf_path: str = None): |
|
|
def build(self, conf_path: str = None): |
|
|
self.prepare_target() |
|
|
self.prepare_target() |
|
|
self.apply_remove_list() |
|
|
self.apply_remove_list() |
|
|
@ -201,6 +226,7 @@ class GameBuilder: |
|
|
conf_path = os.path.join(self.target_game, "minetest.conf.enliven") |
|
|
conf_path = os.path.join(self.target_game, "minetest.conf.enliven") |
|
|
|
|
|
|
|
|
self.update_conf(conf_path) |
|
|
self.update_conf(conf_path) |
|
|
|
|
|
self.apply_subgame_patch("menu") |
|
|
|
|
|
|
|
|
echo0("\nBuild finished.") |
|
|
echo0("\nBuild finished.") |
|
|
echo0(f"Game location: {self.target_game}") |
|
|
echo0(f"Game location: {self.target_game}") |
|
|
|