dialogic-godot / dialogic

💬 Create Dialogs, Visual Novels, RPGs, and manage Characters with Godot to create your Game!
https://dialogic.pro
MIT License
3.35k stars 206 forks source link

Dialogic shows last the frame of the last timeline that has ended when loading a save with no current timeline #2170

Closed Pheubel closed 3 weeks ago

Pheubel commented 1 month ago

The problem

Describe the bug The layout for dialogic is visible when the state is loaded, even if there is no timeline to follow.

To Reproduce Steps to reproduce the behavior:

  1. set up a scenario where the timeline would stop into a place where there would be no other timeline to follow it up, like a map.
  2. play through the timeline until you reached the scenario
  3. save the state game (including dialogic state)
  4. quit the game
  5. restart the game
  6. load the save
  7. see that the latest frame of the timeline is visible.

Expected behavior Instead of seeing the last state of the timeline, i should not be visible and the scenario it's covering should be instead

System (please complete the following information):

Solutions

Workaround

avoid calling Dialogic.Save.load() until after i load a slot's info and check if it is in dialog.

Possible fixes When a timeline has been wrapped up, it is set to null in the state dictionary. if a load occurs, the layout could be made invisible in the else branch.

DialogicGameHandler.gd

func load_full_state(state_info:Dictionary) -> void:
    ...
    if current_state_info.get('current_timeline', null):
        start_timeline(current_state_info.current_timeline, current_state_info.get('current_event_idx', 0))
    elif scene:
        scene.hide()

The downside with this approach is that it will still attempt to set up the layout node as if it was visible, which will cause dialogic to push an error to the console for the portrait subsystem. [Dialogic] Failed to join character to position 1. Could not find position container. because the layout node is now invisible, it will display that it can't join the character portrait. As this doesn't seem to be a big issue, it could possibly be ignored, but it is not clean.

Jowan-Spooner commented 3 weeks ago

This should be fixed by an addition to the documentation which I've made a PR for.