Fix reload mods button
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful

This commit is contained in:
Legalo 2024-10-31 20:36:31 -03:00
parent 86e011ed42
commit 2a275c2468

View File

@ -690,7 +690,6 @@ screen mod_menu():
$ main_menu_button_img = "gui/button/menubuttons/template_idle_epilogue.png" if persistent.use_epilogue_menu else "gui/button/menubuttons/template_idle.png"
default mod_metadata = {}
default reload_game = False
default mod_button_enabled = True
default mod_button_alpha = 1.0
default mod_screenshot_list = None
@ -705,14 +704,7 @@ screen mod_menu():
spacing 8
use mod_menu_top_buttons(main_menu_button_img, _("Reload Mods"), SetScreenVariable("reload_game", True)):
# For some reason, Function() will instantly reload the game upon entering the mod menu, and put it in an infinite loop, so doing this python jank
# is the only way
if reload_game:
python:
reload_game = False
persistent.reloading_mods = True
renpy.reload_script()
use mod_menu_top_buttons(main_menu_button_img, _("Reload Mods"), Function(reload_game))
use mod_menu_top_buttons(main_menu_button_img, _("Return"), ShowMenu("extras"))
viewport:
@ -1092,4 +1084,9 @@ screen mod_menu_top_buttons(image, text, action):
action action
activate_sound "audio/ui/snd_ui_click.wav"
transclude
transclude
init python:
def reload_game():
persistent.reloading_mods = True
renpy.reload_script()