Skip to content

Commit 63b2f02

Browse files
authored
Merge pull request #42 from apple1417/master
new config system fixups
2 parents 2447339 + 77edf48 commit 63b2f02

File tree

3 files changed

+13
-30
lines changed

3 files changed

+13
-30
lines changed

changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
> - Renamed the `unrealsdk.locking_process_event` (previously `UNREALSDK_LOCKING_PROCESS_EVENT`)
5858
> setting to `unrealsdk.locking_function_calls`, and expanded it's scope to cover all function
5959
> calls. This fixes a few more possibilities for lockups.
60+
>
61+
> - Trying to set a struct, array, or multicast delegate to itself is now a no-op, and prints a
62+
> warning.
63+
>
64+
> - The console key will now also be overwritten if it was previously set to `Undefine`.
6065
6166
## v1.5: Time Skip
6267

libs/pyunrealsdk

src/__main__.py

+7-29
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import contextlib
1717
import importlib
1818
import json
19-
import os
2019
import re
2120
import sys
2221
import traceback
@@ -42,9 +41,6 @@
4241
# happen at import time
4342
WAIT_FOR_CLIENT: bool = False
4443

45-
# A json list of paths to also to import mods from - you can add your repo to keep it separated
46-
EXTRA_FOLDERS_ENV_VAR: str = "MOD_MANAGER_EXTRA_FOLDERS"
47-
4844

4945
@dataclass
5046
class ModInfo:
@@ -67,10 +63,10 @@ def init_debugpy() -> None:
6763
debugpy.wait_for_client() # pyright: ignore[reportUnknownMemberType] # noqa: T100
6864
debugpy.breakpoint() # pyright: ignore[reportUnknownMemberType] # noqa: T100
6965

70-
if "PYUNREALSDK_DEBUGPY" not in os.environ:
66+
if not unrealsdk.config.get("pyunrealsdk", {}).get("debugpy", False):
7167
logging.dev_warning(
72-
"Was able to start debugpy, but the `PYUNREALSDK_DEBUGPY` environment variable is"
73-
" not set. This may prevent breakpoints from working properly.",
68+
"Was able to start debugpy, but the `pyunrealsdk.debugpy` config variable is not"
69+
" set to true. This may prevent breakpoints from working properly.",
7470
)
7571

7672
# Make WrappedArrays resolve the same as lists
@@ -94,15 +90,17 @@ def init_debugpy() -> None:
9490

9591
def get_all_mod_folders() -> Sequence[Path]:
9692
"""
97-
Gets all mod folders to try import from, including extra folders defined via env var.
93+
Gets all mod folders to try import from, including extra folders defined via config file.
9894
9995
Returns:
10096
A sequence of mod folder paths.
10197
"""
10298

10399
extra_folders = []
104100
with contextlib.suppress(json.JSONDecodeError, TypeError):
105-
extra_folders = [Path(x) for x in json.loads(os.environ.get(EXTRA_FOLDERS_ENV_VAR, ""))]
101+
extra_folders = [
102+
Path(x) for x in unrealsdk.config.get("mod_manager", {}).get("extra_folders", [])
103+
]
106104

107105
return [Path(__file__).parent, *extra_folders]
108106

@@ -335,24 +333,6 @@ def check_proton_bugs() -> None:
335333
"===============================================================================",
336334
)
337335

338-
"""
339-
Env vars not propagating
340-
------------------------
341-
We set various env vars in `unrealsdk.env`, which unrealsdk sets via `SetEnvironmentVariableA`.
342-
On some proton versions this does not get propagated through to Python - despite clearly having
343-
worked for pyunrealsdk, if we're able to run this script. Some of these are used by Python, and
344-
may cause issues if we cannot find them.
345-
"""
346-
if "PYUNREALSDK_INIT_SCRIPT" not in os.environ:
347-
logging.error(
348-
"===============================================================================\n"
349-
"Some environment variables don't seem to have propagated into Python. This may\n"
350-
"cause issues in parts of the mod manager or individual mods which expect them.\n"
351-
"\n"
352-
"Some particular Proton versions cause this, try switch to another one.\n"
353-
"===============================================================================",
354-
)
355-
356336

357337
# Don't really want to put a `__name__` check here, since it's currently just `builtins`, and that
358338
# seems a bit unstable, like something that pybind might eventually change
@@ -401,5 +381,3 @@ def check_proton_bugs() -> None:
401381

402382
# After importing everything, register the base mod
403383
register_base_mod()
404-
405-
del mod_folders, mods_to_import

0 commit comments

Comments
 (0)