Skip to content

Commit b941af2

Browse files
committed
Fix new characters inheriting previous save options
1 parent 0e64f76 commit b941af2

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v3.8:
4+
5+
### Save Options v1.3
6+
- Fixed issue with newly created characters inheriting options from previously loaded character.
7+
38
## v3.7: Meteor Shower
49

510
### [Console Mod Menu v1.6](https://github.com/bl-sdk/console_mod_menu/blob/master/Readme.md#v16)

src/save_options/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"register_save_options",
2626
)
2727

28-
__version_info__: tuple[int, int] = (1, 2)
28+
__version_info__: tuple[int, int] = (1, 3)
2929
__version__: str = f"{__version_info__[0]}.{__version_info__[1]}"
3030
__author__: str = "bl-sdk"
3131

src/save_options/hooks.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,19 @@ def save_game(_1: UObject, args: WrappedStruct, _3: Any, _4: BoundFunction) -> N
120120
save_options.options.any_option_changed = False
121121

122122

123-
@hook("WillowGame.WillowSaveGameManager:EndLoadGame", Type.POST, immediately_enable=True)
124-
def end_load_game(_1: UObject, _2: WrappedStruct, ret: Any, _4: BoundFunction) -> None: # noqa: D103
123+
@hook("WillowGame.WillowPlayerController:FinishSaveGameLoad", immediately_enable=True)
124+
def end_load_game(_1: UObject, args: WrappedStruct, _3: Any, _4: BoundFunction) -> None: # noqa: D103
125125
# We hook this to send data back to any registered mod save options. This gets called when
126126
# loading character in main menu also. No callback here because the timing of when this is
127127
# called doesn't make much sense to do anything with it. See hook on LoadPlayerSaveGame.
128128

129129
# Often we'll load a save from a character with no save data. We'll set all save options
130130
# to default first to cover for any missing data.
131-
132131
for mod_save_options in registered_save_options.values():
133132
for save_option in mod_save_options.values():
134133
set_option_to_default(save_option)
135134

136-
# This function returns the new save game object, so use a post hook and grab it from `ret`
137-
save_game = ret
135+
save_game = args.SaveGame
138136
if not save_game:
139137
return
140138
extracted_save_data = _extract_save_data(save_game.UnloadableDlcLockoutList)

0 commit comments

Comments
 (0)