mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-24 10:38:56 +01:00
Storyline optimizations and fixes
This commit is contained in:
parent
4a2a62478d
commit
14b7d1a6ea
1 changed files with 28 additions and 10 deletions
|
@ -19,9 +19,12 @@ default chapters_array_length = len(general_chapters) - 1
|
|||
|
||||
default chapter_index = 0 # Index number for the current position of the general chapters array
|
||||
|
||||
default current_chapter = general_chapters[chapter_index] # This stores the name of the label as a string
|
||||
# This stores the name of the label as a string
|
||||
# When starting a new game, it takes the first element of the general_chapters array
|
||||
default current_general_chapter = general_chapters[chapter_index]
|
||||
|
||||
default ending_route_number = None
|
||||
default current_ending_chapter = None
|
||||
default ending_chapter_index = 0
|
||||
|
||||
|
||||
|
@ -42,18 +45,18 @@ init python:
|
|||
|
||||
def next_story_chapter():
|
||||
global chapter_index
|
||||
global current_chapter
|
||||
global current_general_chapter
|
||||
global ending_route_number
|
||||
|
||||
if is_end_of_chapters():
|
||||
ending_route_number = get_ending()
|
||||
next_ending_chapter()
|
||||
return
|
||||
# return
|
||||
|
||||
chapter_index += 1
|
||||
current_chapter = general_chapters[chapter_index]
|
||||
current_general_chapter = general_chapters[chapter_index]
|
||||
|
||||
renpy.call(current_chapter)
|
||||
renpy.call(current_general_chapter)
|
||||
|
||||
|
||||
def is_end_of_chapters():
|
||||
|
@ -61,27 +64,42 @@ init python:
|
|||
|
||||
|
||||
def next_ending_chapter():
|
||||
global ending_route_number, ending_chapter_index
|
||||
global ending_route_number
|
||||
global ending_chapter_index
|
||||
global current_ending_chapter
|
||||
|
||||
if ending_route_number in ending_routes:
|
||||
# Save the ending chapters array from
|
||||
# the ending_routes dictionary
|
||||
current_ending_list = ending_routes[ending_route_number]
|
||||
current_ending_list: list[str] = ending_routes[ending_route_number]
|
||||
|
||||
reset_debug_scores()
|
||||
|
||||
if ending_chapter_index < len(current_ending_list):
|
||||
# Stores the label name from the current_ending_list array in the item variable
|
||||
item = current_ending_list[ending_chapter_index]
|
||||
current_ending_chapter = current_ending_list[ending_chapter_index]
|
||||
# The item is assigned first and then increase the ending_chapter_index as it can't be done after using renpy.jump()
|
||||
|
||||
# Increases the index and jumps to the label
|
||||
ending_chapter_index += 1
|
||||
renpy.jump(item)
|
||||
renpy.jump(current_ending_chapter)
|
||||
else: # We've reached the end of the final chapters
|
||||
ending_image()
|
||||
renpy.call("lending")
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
def reset_debug_scores():
|
||||
global current_general_chapter
|
||||
|
||||
current_general_chapter = None
|
||||
|
||||
if config.developer and persistent.enable_debug_scores:
|
||||
debug_story_variables(False)
|
||||
debug_story_variables(True, True)
|
||||
|
||||
|
||||
# label storyline:
|
||||
# call chapter_1 from _call_chapter_1
|
||||
# call chapter_2 from _call_chapter_2
|
||||
|
|
Loading…
Reference in a new issue