From a31fa50d8ae3906292710728e9866b607b5d76b6 Mon Sep 17 00:00:00 2001 From: Iggy Date: Fri, 30 Aug 2024 15:02:24 -0300 Subject: [PATCH] Functions refactoring --- game/src/chapter_select.rpy | 4 ++-- game/storyline.rpy | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/game/src/chapter_select.rpy b/game/src/chapter_select.rpy index d9e2398..e442338 100644 --- a/game/src/chapter_select.rpy +++ b/game/src/chapter_select.rpy @@ -58,9 +58,9 @@ init python: find_chapter_in_array() if not is_end_reached: - add_ending_chapters() # From storyline + add_ending_chapters(ending_route_number) - update_ending_variables() # From storyline + update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters def set_scores(anon_score, fang_score): diff --git a/game/storyline.rpy b/game/storyline.rpy index c213c99..2452a39 100644 --- a/game/storyline.rpy +++ b/game/storyline.rpy @@ -13,7 +13,7 @@ init -1 python: init python: def next_story_chapter(): - global chapter_list_index, current_chapter, ending_route_number + global chapter_list_index, current_chapter # Add check "is_end_reached" to have this if statement be executed only once when finishing the general chapters if not is_end_reached and chapter_list_index >= chapter_list_length: @@ -31,15 +31,15 @@ init python: global ending_route_number ending_route_number = get_ending() - add_ending_chapters() - update_ending_variables() + add_ending_chapters(ending_route_number) + update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters - def add_ending_chapters(): + def add_ending_chapters(route_number): global chapter_list - if ending_route_number in ending_routes: - chapter_list.extend(ending_routes[ending_route_number]) + if route_number in ending_routes: + chapter_list.extend(ending_routes[route_number]) def update_ending_variables(): @@ -55,7 +55,6 @@ init python: return len(chapter_list) - 1 - def end_story(): ending_image() renpy.call("lending")