autosave_flow - mzki/erago GitHub Wiki

graph TB
    %% -- Common Template --

    %% nodes
    start(("Start"))
    next_scene_from_common(("Next scene"))
    scene_start_common["goto: scene_start_common()"]

    %% styles
    classDef class_script_call fill:#CAF
    classDef class_routine_call fill:#EE9
 
    %% apply styles
        class scene_start_common class_routine_call

    %% flow
    start --> scene_start_common
    scene_start_common --> |next scene| next_scene_from_common

    %% -- scene specific --

    %% nodes
    next_scene(("Next scene"))
    base_scene(("Base scene"))
    
    next_scene_exist_at_last{"next scene?"}
    prev_scene_is_loadend{"previous scene?"}
    enable_autosave{"config autosave?"}
    autosave_replace_exist{"autosave_replace() ?"}
    autosave_replace("script: autosave_replace()")
    builtin_autosave["auto save game state"]

    %% apply styles
    class autosave_replace class_script_call

    %% flows
    scene_start_common --> |continue current scene| prev_scene_is_loadend

    prev_scene_is_loadend --> |loadend| next_scene_exist_at_last
    prev_scene_is_loadend --> |NOT loadend| enable_autosave

    enable_autosave --> |autosave disable| next_scene_exist_at_last
    enable_autosave --> |autosave enable| autosave_replace_exist

    autosave_replace_exist --> |NOT exist| builtin_autosave
    autosave_replace_exist --> |exist| autosave_replace
    
    builtin_autosave --> next_scene_exist_at_last
    autosave_replace --> next_scene_exist_at_last

    next_scene_exist_at_last --> |next scene exist| next_scene
    next_scene_exist_at_last --> |next scene NOT exist| base_scene    
Loading
⚠️ **GitHub.com Fallback** ⚠️