deep-entertainment / issues

Issue tracker for deep Entertainment projects
1 stars 0 forks source link

[EGOVENTURE] _ready() function is not called when loading a game and current scene is identical #4

Closed ThmsKnz closed 2 years ago

ThmsKnz commented 2 years ago

Please make sure you talk to the community before creating an issue.

Describe the bug Assume that there is a scene that disables the inventory in the _ready() function. In my example it is a scene showing a map of locations where I've disabled the inventory. In case you load a game while the current scene is the this scene, the _ready() function will not be called and the inventory will again be enabled.

To Reproduce Steps to reproduce the behavior using "Carol Refurbished"

  1. Add line Inventory.disable() in file scenes/misc/map.gd in the _ready() function
  2. Start a new game and continue until the map is shown.
  3. Check that the inventory bar is disabled.
  4. The save the game and reload the saved game.
  5. And voilà the inventory bar is enabled again.

Expected behavior The expected behavior is that the _ready() function of the target scene always gets called when re-loading a game. The issue has been introduced in Egoventure's _load function. In an old version of Egoventure the scene was changed every time. In the recent version there's a different behavior if the loaded scene is identical to the current scene.

if EgoVenture.state.current_scene == current_scene: emit_signal("requested_view_change", EgoVenture.state.target_view) else: change_scene(EgoVenture.state.current_scene)

Workaround The workaround is to also disable the inventory in the _process(delta) function in these scenes. But that's not so elegant :-)

dploeger commented 2 years ago

Hm... I'm not really sure how to tackle this. We specifically removed that because it caused havoc for some cases, so I don't want to bring it back. And I don't want to call _ready, because that might work but is actually forbidden.

I could offer to add a signal like "room_loaded", which is emitted by egoventure after the change and could be caught in the room to replace the things in the "_ready" function.

What do you say?

dploeger commented 2 years ago

Additionally, I switched from recommending _ready to recommend _process because while it's not that optimal, it won't matter much to the type of games EgoVenture was designed for and it's easier to use for non-tech savvy.

ThmsKnz commented 2 years ago

Ideally loading a game should always result in the same state, independent from which scene it's being loaded, but this is of course a challenge in a four side room which could reflect 4 sceneries. As a minor fix: Could you adapt the if clause that the 'else' branch is also being called when the loaded scene is not a four side room but a single scene? (I'm not yet convinced of a room_loaded signal or using the _process function :-)

dploeger commented 2 years ago

I get your point, but I'd say, that this is a very small problem compared to reintroducing code that broke a fluent gameplay (I researched what introduced the change) and I moved to recommending to use _process anyway :D So, if you're okay with it, I'll go ahead and close this. We can reopen it at any time if the bug gets more severe.

ThmsKnz commented 2 years ago

OK, let's close this issue then. I will spend some more time thinking about it and in case I have another proposal will get back to you.

dploeger commented 2 years ago

Yes, that sounds like a good plan. Thanks.