Skip to content

Commit 4048c8d

Browse files
authored
Merge pull request #36 from apple1417/master
add coop support field, update check, tutorial message helper
2 parents 0e157a6 + 8b1a69f commit 4048c8d

File tree

17 files changed

+585
-122
lines changed

17 files changed

+585
-122
lines changed

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "[email protected]:bl-sdk/common_dotfiles.git",
3-
"commit": "5404cb2bf2c71c7572667468d58f7518d6e340ef",
3+
"commit": "6b31480199099e9957b18918373a75d979951919",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ extend-exclude = [
77
".typos.toml"
88
]
99

10+
[default]
11+
extend-ignore-re = [
12+
# Ignore markdown links to github commits/trees
13+
"\\[[0-9a-fA-F]+?\\]\\(https://github.com/.+?/.+?/(commit|tree)/.+?\\)",
14+
]
15+
1016
[default.extend-identifiers]
1117
llibgcc_s_seh = "llibgcc_s_seh"
1218

changelog.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,58 @@
55
Also see the unrealsdk v1.3.0 changelog [here](https://github.com/bl-sdk/unrealsdk/blob/master/changelog.md#v130)
66
and the pyunrealsdk v1.3.0 changelog [here](https://github.com/bl-sdk/pyunrealsdk/blob/master/changelog.md#v130).
77

8-
## General
8+
### General
99
- Fixed that in some cases a mod couldn't be disabled, or wouldn't enable actively, due to hooks not
1010
getting added/removed properly.
1111

1212
[unrealsdk@227a93d2](https://github.com/bl-sdk/unrealsdk/commit/227a93d2)
13+
14+
- Mods now show how well they support coop. This is unknown by default, developers need to set it.
15+
16+
[db89e4b3](https://github.com/bl-sdk/oak-mod-manager/commit/db89e4b3)
17+
18+
- The mod manager now occasionally checks for updates. These will appear on the "Python SDK" mod
19+
menu entry.
20+
21+
[9bf295b0](https://github.com/bl-sdk/oak-mod-manager/commit/9bf295b0)
22+
23+
### General - Developer
24+
- Set `PYUNREALSDK_PYEXEC_ROOT` to the sdk mods folder by default.
25+
26+
[2f15c5ba](https://github.com/bl-sdk/oak-mod-manager/commit/2f15c5ba)
27+
28+
- Fixed that pyright would always error on creating a HiddenOption (due to mismatching generics).
29+
30+
[9bf295b0](https://github.com/bl-sdk/oak-mod-manager/commit/9bf295b0)
31+
32+
### BL3 Mod Menu v1.3
33+
- Display mods' coop support.
34+
35+
[db89e4b3](https://github.com/bl-sdk/oak-mod-manager/commit/db89e4b3)
36+
37+
### Console Mod Menu v1.3
38+
- Display mods' coop support.
39+
40+
[db89e4b3](https://github.com/bl-sdk/oak-mod-manager/commit/db89e4b3)
41+
42+
### Mods Base v1.4
43+
- Added the "Coop Support" field.
44+
45+
[db89e4b3](https://github.com/bl-sdk/oak-mod-manager/commit/db89e4b3)
46+
47+
- Automatically check for mod manager updates.
48+
49+
[9bf295b0](https://github.com/bl-sdk/oak-mod-manager/commit/9bf295b0)
50+
51+
### UI Utils v1.2
52+
53+
- Added a helper to show a tutorial dialog, `show_modal_tutorial_dialog`.
54+
55+
[51d3c872](https://github.com/bl-sdk/oak-mod-manager/commit/51d3c872)
56+
57+
- Fixed an attribute error when calling `show_hud_message` during a load screen (from a thread).
58+
59+
[51d3c872](https://github.com/bl-sdk/oak-mod-manager/commit/51d3c872)
1360

1461
## v1.3
1562

manager_pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ authors = [{ name = "bl-sdk" }]
1212
name = "BL3 / WL Mod Manager"
1313
license = {name = "LGPL3", url = "https://choosealicense.com/licenses/lgpl-3.0/" }
1414
download = "https://github.com/bl-sdk/oak-mod-manager/releases/latest"
15+
coop_support = "ClientSide"

src/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ def check_proton_bugs() -> None:
395395
# Most modules are fine to get imported as a mod/by another mod, but we need to do a few manually.
396396
# Prefer to import these after console is ready so we can show errors
397397
import keybinds # noqa: F401, E402 # pyright: ignore[reportUnusedImport]
398+
from mods_base.mod_list import register_base_mod # noqa: E402
398399

399400
import_mods(mods_to_import)
400401

402+
# After importing everything, register the base mod
403+
register_base_mod()
404+
401405
del mod_folders, mods_to_import

src/bl3_mod_menu/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"__version_info__",
88
]
99

10-
__version_info__: tuple[int, int] = (1, 2)
10+
__version_info__: tuple[int, int] = (1, 3)
1111
__version__: str = f"{__version_info__[0]}.{__version_info__[1]}"
1212
__author__: str = "bl-sdk"
1313

@@ -42,6 +42,5 @@
4242
),
4343
),
4444
)
45-
base_mod.load_settings()
4645

4746
base_mod.components.append(base_mod.ComponentInfo("BL3 Mod Menu", __version__))

src/bl3_mod_menu/options_setup.py

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
BaseOption,
1313
BoolOption,
1414
ButtonOption,
15+
CoopSupport,
1516
DropdownOption,
1617
Game,
1718
GroupedOption,
@@ -189,6 +190,64 @@ def get_option_header() -> str:
189190
)
190191

191192

193+
def create_description_title(mod: Mod) -> str:
194+
"""
195+
Creates the description title to use for a mod's description option.
196+
197+
Args:
198+
mod: The mod to create the title for.
199+
Returns:
200+
The description title.
201+
"""
202+
description_title = ""
203+
if mod.author:
204+
description_title += f"By {mod.author}"
205+
if mod.author and mod.version:
206+
description_title += " - "
207+
if mod.version:
208+
description_title += mod.version
209+
return description_title or "Description"
210+
211+
212+
def create_description_text(mod: Mod) -> str:
213+
"""
214+
Creates the text to use for a mod's description option.
215+
216+
Args:
217+
mod: The mod to create the title for.
218+
Returns:
219+
The description text.
220+
"""
221+
blocks: list[str] = []
222+
223+
if Game.get_current() not in mod.supported_games:
224+
supported = [g.name for g in Game if g in mod.supported_games and g.name is not None]
225+
blocks.append(
226+
"<font color='#ffff00'>Incompatible Game!</font>\n"
227+
"This mod supports: " + ", ".join(supported),
228+
)
229+
230+
if mod.description:
231+
blocks.append(mod.description)
232+
233+
match mod.coop_support:
234+
case CoopSupport.Unknown:
235+
blocks.append("<font color='#e0e0e0'>Coop Support: Unknown</font>")
236+
case CoopSupport.Incompatible:
237+
blocks.append(
238+
"<font color='#e0e0e0'>Coop Support:</font>"
239+
" <font color='#ffff00'>Incompatible</font>",
240+
)
241+
case CoopSupport.RequiresAllPlayers:
242+
blocks.append(
243+
"<font color='#e0e0e0'>Coop Support: Requires All Players</font>",
244+
)
245+
case CoopSupport.ClientSide:
246+
blocks.append("<font color='#e0e0e0'>Coop Support: Client Side</font>")
247+
248+
return "\n\n".join(blocks)
249+
250+
192251
def get_mod_options(mod: Mod) -> tuple[BaseOption, ...]:
193252
"""
194253
Gets the full list of mod options to display, including our custom header.
@@ -201,27 +260,11 @@ def get_mod_options(mod: Mod) -> tuple[BaseOption, ...]:
201260

202261
def inner() -> Iterator[BaseOption]:
203262
# Display the author and version in the title, if they're not the empty string
204-
description_title = ""
205-
if mod.author:
206-
description_title += f"By {mod.author}"
207-
if mod.author and mod.version:
208-
description_title += " - "
209-
if mod.version:
210-
description_title += mod.version
211-
description_title = description_title or "Description"
212-
213-
description = mod.description
214-
if Game.get_current() not in mod.supported_games:
215-
supported = [g.name for g in Game if g in mod.supported_games and g.name is not None]
216-
description = (
217-
"<font color='#ffff00'>Incompatible Game!</font>\r"
218-
"This mod supports: " + ", ".join(supported) + "\n\n" + description
219-
)
220263

221264
yield ButtonOption(
222265
"Description",
223-
description=description,
224-
description_title=description_title,
266+
description=create_description_text(mod),
267+
description_title=create_description_title(mod),
225268
)
226269

227270
if not mod.enabling_locked:

src/console_mod_menu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"__version_info__",
1212
)
1313

14-
__version_info__: tuple[int, int] = (1, 2)
14+
__version_info__: tuple[int, int] = (1, 3)
1515
__version__: str = f"{__version_info__[0]}.{__version_info__[1]}"
1616
__author__: str = "bl-sdk"
1717

src/console_mod_menu/screens/mod.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
BaseOption,
1111
BoolOption,
1212
ButtonOption,
13+
CoopSupport,
1314
DropdownOption,
1415
GroupedOption,
1516
KeybindOption,
@@ -124,7 +125,8 @@ class ModScreen(OptionListScreen):
124125
def __post_init__(self) -> None:
125126
self.name = self.mod.name
126127

127-
def draw(self) -> None: # noqa: D102
128+
def draw_mod_header(self) -> None:
129+
"""Draws the header for the mod, everything before the options."""
128130
draw_stack_header()
129131

130132
header = ""
@@ -137,12 +139,26 @@ def draw(self) -> None: # noqa: D102
137139
draw(header)
138140

139141
draw(self.mod.get_status())
142+
143+
match self.mod.coop_support:
144+
case CoopSupport.Unknown:
145+
draw("Coop Support: Unknown")
146+
case CoopSupport.Incompatible:
147+
draw("Coop Support: Incompatible")
148+
case CoopSupport.RequiresAllPlayers:
149+
draw("Coop Support: Requires All Players")
150+
case CoopSupport.ClientSide:
151+
draw("Coop Support: Client Side")
152+
140153
draw("")
141154

142155
if self.mod.description:
143156
draw_description(self.mod.description)
144157
draw("")
145158

159+
def draw(self) -> None: # noqa: D102
160+
self.draw_mod_header()
161+
146162
if not self.mod.enabling_locked:
147163
if self.mod.is_enabled:
148164
draw("[D] Disable")

src/mods_base/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .dot_sdkmod import open_in_mod_dir
99

1010
# Need to define a few things first to avoid circular imports
11-
__version_info__: tuple[int, int] = (1, 3)
11+
__version_info__: tuple[int, int] = (1, 4)
1212
__version__: str = f"{__version_info__[0]}.{__version_info__[1]}"
1313
__author__: str = "bl-sdk"
1414

@@ -31,7 +31,7 @@
3131
from .hook import HookProtocol, hook
3232
from .html_to_plain_text import html_to_plain_text
3333
from .keybinds import EInputEvent, KeybindType, keybind
34-
from .mod import Game, Library, Mod, ModType
34+
from .mod import CoopSupport, Game, Library, Mod, ModType
3535
from .mod_factory import build_mod
3636
from .mod_list import (
3737
deregister_mod,
@@ -65,6 +65,7 @@
6565
"ButtonOption",
6666
"capture_next_console_line",
6767
"command",
68+
"CoopSupport",
6869
"deregister_mod",
6970
"DropdownOption",
7071
"EInputEvent",
@@ -106,7 +107,7 @@ def get_pc() -> UObject: ...
106107
def get_pc(*, possibly_loading: Literal[True] = True) -> UObject | None: ...
107108

108109

109-
def get_pc(*, possibly_loading: bool = False) -> UObject | None: # noqa: ARG001
110+
def get_pc(*, possibly_loading: bool = False) -> UObject | None:
110111
"""
111112
Gets the main (local) player controller object.
112113

0 commit comments

Comments
 (0)