From b941af25f930a354b312d1670d79d62914a65a24 Mon Sep 17 00:00:00 2001 From: Justin99x Date: Mon, 7 Jul 2025 18:52:36 -0700 Subject: [PATCH] Fix new characters inheriting previous save options --- changelog.md | 5 +++++ src/save_options/__init__.py | 2 +- src/save_options/hooks.py | 8 +++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 4f3fd56..d0983bf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## v3.8: + +### Save Options v1.3 +- Fixed issue with newly created characters inheriting options from previously loaded character. + ## v3.7: Meteor Shower ### [Console Mod Menu v1.6](https://github.com/bl-sdk/console_mod_menu/blob/master/Readme.md#v16) diff --git a/src/save_options/__init__.py b/src/save_options/__init__.py index 461d837..2d36fd8 100644 --- a/src/save_options/__init__.py +++ b/src/save_options/__init__.py @@ -25,7 +25,7 @@ "register_save_options", ) -__version_info__: tuple[int, int] = (1, 2) +__version_info__: tuple[int, int] = (1, 3) __version__: str = f"{__version_info__[0]}.{__version_info__[1]}" __author__: str = "bl-sdk" diff --git a/src/save_options/hooks.py b/src/save_options/hooks.py index c0b78fb..4457b4a 100644 --- a/src/save_options/hooks.py +++ b/src/save_options/hooks.py @@ -120,21 +120,19 @@ def save_game(_1: UObject, args: WrappedStruct, _3: Any, _4: BoundFunction) -> N save_options.options.any_option_changed = False -@hook("WillowGame.WillowSaveGameManager:EndLoadGame", Type.POST, immediately_enable=True) -def end_load_game(_1: UObject, _2: WrappedStruct, ret: Any, _4: BoundFunction) -> None: # noqa: D103 +@hook("WillowGame.WillowPlayerController:FinishSaveGameLoad", immediately_enable=True) +def end_load_game(_1: UObject, args: WrappedStruct, _3: Any, _4: BoundFunction) -> None: # noqa: D103 # We hook this to send data back to any registered mod save options. This gets called when # loading character in main menu also. No callback here because the timing of when this is # called doesn't make much sense to do anything with it. See hook on LoadPlayerSaveGame. # Often we'll load a save from a character with no save data. We'll set all save options # to default first to cover for any missing data. - for mod_save_options in registered_save_options.values(): for save_option in mod_save_options.values(): set_option_to_default(save_option) - # This function returns the new save game object, so use a post hook and grab it from `ret` - save_game = ret + save_game = args.SaveGame if not save_game: return extracted_save_data = _extract_save_data(save_game.UnloadableDlcLockoutList)