mirror of
https://github.com/ModOrganizer2/modorganizer-basic_games.git
synced 2026-07-27 14:07:29 -07:00
Add support for Thunderstore plugin (#199)
This commit is contained in:
@@ -50,6 +50,7 @@ class RegexPatterns:
|
||||
self.move = {
|
||||
key: re.compile(fnmatch.translate(key), re.I) for key in globs.move
|
||||
}
|
||||
self.ignore = OptionalRegexPattern(globs.ignore)
|
||||
|
||||
def move_match(self, value: str) -> str | None:
|
||||
"""
|
||||
@@ -79,6 +80,7 @@ class GlobPatterns:
|
||||
valid: list[str] | None = None
|
||||
delete: list[str] | None = None
|
||||
move: dict[str, str] = field(default_factory=dict[str, str])
|
||||
ignore: list[str] | None = None
|
||||
|
||||
def merge(
|
||||
self, other: GlobPatterns, mode: Literal["merge", "replace"] = "replace"
|
||||
@@ -106,6 +108,7 @@ class GlobPatterns:
|
||||
valid=_merge_list(self.valid, other.valid),
|
||||
delete=_merge_list(self.delete, other.delete),
|
||||
move=self.move | other.move,
|
||||
ignore=_merge_list(self.ignore, other.ignore),
|
||||
)
|
||||
else:
|
||||
return GlobPatterns(
|
||||
@@ -113,6 +116,7 @@ class GlobPatterns:
|
||||
valid=other.valid or self.valid,
|
||||
delete=other.delete or self.delete,
|
||||
move=other.move or self.move,
|
||||
ignore=other.ignore or self.ignore,
|
||||
)
|
||||
|
||||
|
||||
@@ -125,6 +129,8 @@ class BasicModDataChecker(mobase.ModDataChecker):
|
||||
|
||||
Args:
|
||||
file_patterns (optional): A GlobPatterns object, with the following attributes:
|
||||
ignore: [ "list of files and folders to ignore." ]
|
||||
# Check result: unchanged
|
||||
unfold: [ "list of folders to unfold" ],
|
||||
# (remove and move contents to parent), after being checked and
|
||||
# fixed recursively.
|
||||
@@ -175,6 +181,8 @@ class BasicModDataChecker(mobase.ModDataChecker):
|
||||
for entry in filetree:
|
||||
name = entry.name().casefold()
|
||||
|
||||
if rp.ignore.match(name):
|
||||
continue
|
||||
if rp.unfold.match(name):
|
||||
if is_directory(entry):
|
||||
status = self.dataLooksValid(entry)
|
||||
@@ -196,6 +204,8 @@ class BasicModDataChecker(mobase.ModDataChecker):
|
||||
for entry in list(filetree):
|
||||
name = entry.name()
|
||||
|
||||
if rp.ignore.match(name):
|
||||
continue
|
||||
# unfold first - if this match, entry is a directory (checked in
|
||||
# dataLooksValid)
|
||||
if rp.unfold.match(name):
|
||||
|
||||
@@ -199,6 +199,7 @@ class BasicGameMappings:
|
||||
gameName: BasicGameMapping[str]
|
||||
gameShortName: BasicGameMapping[str]
|
||||
gameNexusName: BasicGameMapping[str]
|
||||
gameThunderstoreName: BasicGameMapping[str]
|
||||
validShortNames: BasicGameMapping[list[str]]
|
||||
nexusGameId: BasicGameMapping[int]
|
||||
binaryName: BasicGameMapping[str]
|
||||
@@ -265,6 +266,12 @@ class BasicGameMappings:
|
||||
"gameNexusName",
|
||||
default=lambda g: g.gameShortName(),
|
||||
)
|
||||
self.gameThunderstoreName = BasicGameMapping(
|
||||
game,
|
||||
"GameThunderstoreName",
|
||||
"gameThunderstoreName",
|
||||
default=lambda g: "",
|
||||
)
|
||||
self.validShortNames = BasicGameMapping(
|
||||
game,
|
||||
"GameValidShortNames",
|
||||
@@ -529,6 +536,9 @@ class BasicGame(mobase.IPluginGame):
|
||||
def gameNexusName(self) -> str:
|
||||
return self._mappings.gameNexusName.get()
|
||||
|
||||
def gameThunderstoreName(self) -> str:
|
||||
return self._mappings.gameThunderstoreName.get()
|
||||
|
||||
def nexusModOrganizerID(self) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
@@ -6,22 +6,18 @@ from . import game_subnautica # namespace to not load SubnauticaGame here, too!
|
||||
|
||||
class SubnauticaBelowZeroGame(game_subnautica.SubnauticaGame):
|
||||
Name = "Subnautica Below Zero Support Plugin"
|
||||
Author = "dekart811, Zash"
|
||||
Version = "2.2"
|
||||
|
||||
GameName = "Subnautica: Below Zero"
|
||||
GameShortName = "subnauticabelowzero"
|
||||
GameNexusName = "subnauticabelowzero"
|
||||
GameThunderstoreName = "subnautica-below-zero"
|
||||
GameSteamId = 848450
|
||||
GameEpicId = "foxglove"
|
||||
GameBinary = "SubnauticaZero.exe"
|
||||
GameDataPath = "_ROOT"
|
||||
GameDocumentsDirectory = "%GAME_PATH%"
|
||||
GameSupportURL = (
|
||||
r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/"
|
||||
"Game:-Subnautica:-Below-Zero"
|
||||
)
|
||||
GameSavesDirectory = r"%GAME_PATH%\SNAppData\SavedGames"
|
||||
|
||||
_game_extra_save_paths = [
|
||||
r"%USERPROFILE%\Appdata\LocalLow\Unknown Worlds"
|
||||
|
||||
@@ -37,6 +37,7 @@ class SubnauticaModDataChecker(BasicModDataChecker):
|
||||
"changelog.txt",
|
||||
"libdoorstop.dylib",
|
||||
],
|
||||
ignore=["*.mohidden"],
|
||||
delete=[
|
||||
"*.txt",
|
||||
"*.md",
|
||||
@@ -87,11 +88,12 @@ class SubnauticaModDataChecker(BasicModDataChecker):
|
||||
class SubnauticaGame(BasicGame, mobase.IPluginFileMapper):
|
||||
Name = "Subnautica Support Plugin"
|
||||
Author = "dekart811, Zash"
|
||||
Version = "2.2"
|
||||
Version = "2.3"
|
||||
|
||||
GameName = "Subnautica"
|
||||
GameShortName = "subnautica"
|
||||
GameNexusName = "subnautica"
|
||||
GameThunderstoreName = "subnautica"
|
||||
GameSteamId = 264710
|
||||
GameEpicId = "Jaguar"
|
||||
GameBinary = "Subnautica.exe"
|
||||
|
||||
@@ -290,10 +290,11 @@ class ValheimWorldSaveGame(ValheimSaveGame):
|
||||
class ValheimGame(BasicGame):
|
||||
Name = "Valheim Support Plugin"
|
||||
Author = "Zash"
|
||||
Version = "1.2.2"
|
||||
Version = "1.3"
|
||||
|
||||
GameName = "Valheim"
|
||||
GameShortName = "valheim"
|
||||
GameThunderstoreName = "valheim"
|
||||
GameNexusId = 3667
|
||||
GameSteamId = [892970, 896660, 1223920]
|
||||
GameBinary = "valheim.exe"
|
||||
@@ -333,6 +334,9 @@ class ValheimGame(BasicGame):
|
||||
#
|
||||
"AdvancedBuilder",
|
||||
],
|
||||
ignore=[
|
||||
"*.mohidden",
|
||||
],
|
||||
delete=[
|
||||
"*.txt",
|
||||
"*.md",
|
||||
|
||||
Reference in New Issue
Block a user