Split out a separate wad-only base class from WadMap. Load the wad-specific config when using it. Support overriding settings during fabricate.
This commit is contained in:
parent
057ac98843
commit
970e63e19b
3 changed files with 37 additions and 11 deletions
|
@ -22,7 +22,7 @@ class Base(Command):
|
|||
parser.add_argument('--config-name', default='config.toml')
|
||||
return parser
|
||||
|
||||
def run(self, parsed_args):
|
||||
def init_base(self, parsed_args):
|
||||
self._doom = pathlib.Path(parsed_args.doom)
|
||||
self._config_name = parsed_args.config_name
|
||||
self._config = tomlkit.toml_file.TOMLFile(self.doom.joinpath(self.config_name)).read()
|
||||
|
@ -32,8 +32,6 @@ class Base(Command):
|
|||
for d in ("iwads", "pwads", "demos", "fabricate"):
|
||||
self._init_path(d)
|
||||
|
||||
self.take_action(parsed_args)
|
||||
|
||||
def _init_path(self, what):
|
||||
setattr(self, f"_{what}", self.doom.joinpath(self._config.get(what, what)))
|
||||
setattr(type(self), what, property(lambda self: getattr(self, f"_{what}")))
|
||||
|
@ -52,7 +50,7 @@ class Base(Command):
|
|||
|
||||
def iwad_path(self, wad):
|
||||
iwad = self.iwads.joinpath(self._config.get("default_iwad"))
|
||||
iwadpath = self.pwads.joinpath("iwad")
|
||||
iwadpath = self.pwads.joinpath(wad).joinpath("iwad")
|
||||
if iwadpath.exists():
|
||||
with io.open(iwadpath) as f:
|
||||
iwad = self.iwads.joinpath(f.read().strip() + ".WAD")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue