Added SPT MO2 Plugin + MO2 INI
This commit is contained in:
parent
404890ecbb
commit
3e8f90cd1a
|
@ -0,0 +1,16 @@
|
|||
[General]
|
||||
selected_profile=@ByteArray(Multiplayer)
|
||||
|
||||
[Settings]
|
||||
style=Dark Bronze.qss
|
||||
|
||||
[customExecutables]
|
||||
size=1
|
||||
1\arguments=
|
||||
1\binary=D:/Games/Singleplayer Tarkov/SPT.Launcher.exe
|
||||
1\hide=false
|
||||
1\ownicon=false
|
||||
1\steamAppID=
|
||||
1\title=Multiplayer
|
||||
1\toolbar=false
|
||||
1\workingDirectory=D:/Games/Singleplayer Tarkov
|
|
@ -0,0 +1,82 @@
|
|||
from typing import List, Tuple
|
||||
from PyQt6.QtCore import QFileInfo
|
||||
import mobase
|
||||
from ..basic_game import BasicGame
|
||||
from ..basic_features import BasicModDataChecker, GlobPatterns
|
||||
|
||||
|
||||
class SPTGame(BasicGame, mobase.IPluginFileMapper):
|
||||
|
||||
Name = "SPT Plugin"
|
||||
Author = "Archon"
|
||||
Version = "1.1.2"
|
||||
GameName = "SPT"
|
||||
GameShortName = "spt"
|
||||
GameBinary = "SPT.Launcher.exe"
|
||||
GameDataPath = "%GAME_PATH%"
|
||||
GameSaveExtension = "json"
|
||||
GameSavesDirectory = "%GAME_PATH%/user/profiles"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
mobase.IPluginFileMapper.__init__(self)
|
||||
|
||||
def init(self, organizer: mobase.IOrganizer) -> bool:
|
||||
super().init(organizer)
|
||||
if hasattr(self, '_featureMap'):
|
||||
self._featureMap[mobase.ModDataChecker] = SPTModDataChecker()
|
||||
else:
|
||||
self._register_feature(SPTModDataChecker())
|
||||
return True
|
||||
|
||||
def executables(self) -> List[mobase.ExecutableInfo]:
|
||||
execs = super().executables()
|
||||
|
||||
"""
|
||||
A bat script file to bridge the environment to server and launcher.
|
||||
"""
|
||||
workaroundPath = self._gamePath + "/sptvfsbridge.bat"
|
||||
|
||||
try:
|
||||
workaround = open(workaroundPath, "rt")
|
||||
except FileNotFoundError:
|
||||
with open(workaroundPath, "wt") as workaround:
|
||||
workaround.write(
|
||||
"""
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "launcher_path=SPT.Launcher.exe"
|
||||
set "server_path=SPT.Server.exe"
|
||||
|
||||
REM Launch the server.exe
|
||||
start "" "%server_path%"
|
||||
|
||||
REM Wait for a moment to ensure the server.exe has started
|
||||
timeout /t 5 /nobreak >nul
|
||||
|
||||
REM Launch the launcher.exe
|
||||
start "" "%launcher_path%"
|
||||
|
||||
endlocal
|
||||
"""
|
||||
)
|
||||
workaround.close()
|
||||
|
||||
execs.append(
|
||||
mobase.ExecutableInfo("Launch SP Tarkov", QFileInfo(workaroundPath))
|
||||
)
|
||||
execs.pop(0)
|
||||
return execs
|
||||
|
||||
def mappings(self) -> list[mobase.Mapping]:
|
||||
return []
|
||||
|
||||
class SPTModDataChecker(BasicModDataChecker):
|
||||
def __init__(self, patterns: GlobPatterns = GlobPatterns()):
|
||||
super().__init__(
|
||||
GlobPatterns(
|
||||
valid=["BepInEx", "User"],
|
||||
move={"plugins": "BepInEx/", "patchers": "BepInEx/", "package.json": "User/Mods/", "*.dll": "BepInEx/plugins/", "*": "User/Mods/"},
|
||||
).merge(patterns),
|
||||
)
|
Loading…
Reference in New Issue