Achievements System Tweaks for Ren'py 8.2.X

This commit is contained in:
LoafyLemon 2024-03-25 14:39:35 +00:00
parent 019ca9e9a9
commit b62b7bcc3a
2 changed files with 5 additions and 37 deletions

View File

@ -208,38 +208,6 @@ init python:
__regen(category_items)
number_unlocked = len(tuple(filter(achievement.has, menu_items)))
class __Filter(Action):
# TODO: in 8.2, replace with CycleVariable("current_filter", (None, "Locked", "Unlocked", "Secret"))
def __call__(self):
global current_filter
global number_unlocked
if current_filter is None:
current_filter = "Locked"
elif current_filter == "Locked":
current_filter = "Unlocked"
elif current_filter == "Unlocked":
current_filter = "Secret"
else:
current_filter = None
__regen()
number_unlocked = len(tuple(filter(achievement.has, menu_items)))
class __Sort(Action):
# TODO: in 8.2, replace with CycleVariable("current_sorting", ("A-z", "z-A", "Unlocked", "Locked"))
def __call__(self):
global current_sorting
if current_sorting == "A-z":
current_sorting = "z-A"
elif current_sorting == "z-A":
current_sorting = "Unlocked"
elif current_sorting == "Unlocked":
current_sorting = "Locked"
else:
current_sorting = "A-z"
__regen()
def __regen(category_items=achievements_db):
global menu_items
global menu_items_length
@ -318,10 +286,10 @@ screen achievement_menu():
style_prefix gui.theme('achievements_filters')
pos (6, 384)
if current_filter is None:
textbutton "Show: All" action __Filter()
textbutton "Show: All" action [CycleVariable("current_filter", (None, "Locked", "Unlocked", "Secret")), __regen]
else:
textbutton "Show: [current_filter]" action __Filter()
textbutton "Sort by: [current_sorting]" action __Sort()
textbutton "Show: [current_filter]" action [CycleVariable("current_filter", (None, "Locked", "Unlocked", "Secret")), __regen]
textbutton "Sort by: [current_sorting]" action [CycleVariable("current_sorting", ("A-z", "z-A", "Unlocked", "Locked")), __regen]
screen achievement_menuitem():
window:

View File

@ -211,6 +211,8 @@ init python:
doll.body.matrix = IdentityMatrix()
delattr(store, "achievements_dict")
if current > latest:
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))
@ -219,8 +221,6 @@ init python:
setattr(store, "_savecompat", True)
message = "Have fun!"
achievements.attempt_repair()
renpy.call_in_new_context("modal_popup", "Update Successful", "\nYour save file has been successfully updated to version {{b}}{}{{/b}}.\n\n{}".format(config.version, message), None, "Hurray!")
renpy.block_rollback()