90 lines
2.6 KiB
Python
90 lines
2.6 KiB
Python
|
from pathlib import Path
|
||
|
from typing import Any
|
||
|
|
||
|
from lmm.profile import Profile
|
||
|
from lmm.overlayfs import OverlayFSMount
|
||
|
from lmm.games.game import ProtonGame
|
||
|
|
||
|
GAME_NAME = "ReadyOrNot"
|
||
|
|
||
|
class ReadyOrNotProfile(Profile):
|
||
|
# Names of directories inside the game's mods directory.
|
||
|
mods: list[str]
|
||
|
|
||
|
def __init__(self, name: str, mods: list[str], **kwargs):
|
||
|
super().__init__(GAME_NAME, name, **kwargs)
|
||
|
self.mods = mods
|
||
|
|
||
|
def get_mod_names(self) -> list[str]:
|
||
|
return self.mods
|
||
|
|
||
|
class ReadyOrNotGame(ProtonGame):
|
||
|
def __init__(self, profiles: list[ReadyOrNotProfile], **kwargs):
|
||
|
super().__init__(GAME_NAME, "1144200", profiles, **kwargs)
|
||
|
|
||
|
@property
|
||
|
def installation_path(self) -> Path:
|
||
|
return self.steam_library / "steamapps" / "common" / "Ready Or Not"
|
||
|
|
||
|
@property
|
||
|
def compat_path(self) -> Path:
|
||
|
return self.steam_library / "steamapps" / "compatdata" / self.appid
|
||
|
|
||
|
def can_start(self) -> bool:
|
||
|
return self.steam_library is not None
|
||
|
|
||
|
def prepare_overlays(self, profile: Profile) -> list[OverlayFSMount]:
|
||
|
return [
|
||
|
OverlayFSMount(
|
||
|
self.installation_path,
|
||
|
profile.mod_paths,
|
||
|
mount=self.installation_path,
|
||
|
workdir=profile.workdir,
|
||
|
),
|
||
|
]
|
||
|
|
||
|
@property
|
||
|
def game_executable(self) -> Path:
|
||
|
return self.installation_path / "ReadyOrNot.exe"
|
||
|
|
||
|
def to_dict(self) -> dict[str, Any]:
|
||
|
return {
|
||
|
"profiles": [
|
||
|
{
|
||
|
"name": profile.name,
|
||
|
"mods": [
|
||
|
{
|
||
|
"name": mod,
|
||
|
} for mod in profile.mods
|
||
|
]
|
||
|
} for profile in self.profiles
|
||
|
]
|
||
|
}
|
||
|
|
||
|
@classmethod
|
||
|
def from_dict(cls, data: dict[str, Any]) -> "ReadyOrNotGame":
|
||
|
profiles = []
|
||
|
for profile in data["profiles"]:
|
||
|
mods = [
|
||
|
mod["name"] for mod in profile["mods"]
|
||
|
]
|
||
|
|
||
|
if "runner" in profile:
|
||
|
runner = runner_from_config(profile["runner"])
|
||
|
else:
|
||
|
runner = None
|
||
|
|
||
|
profiles.append(
|
||
|
ReadyOrNotProfile(
|
||
|
profile["name"],
|
||
|
mods,
|
||
|
runner=runner,
|
||
|
),
|
||
|
)
|
||
|
|
||
|
if "default_runner" in data:
|
||
|
default_runner = runner_from_config(data["default_runner"])
|
||
|
else:
|
||
|
default_runner = None
|
||
|
|
||
|
return ReadyOrNotGame(profiles, default_runner=default_runner)
|