-
Notifications
You must be signed in to change notification settings - Fork 220
Update game_state.gd #1686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update game_state.gd #1686
Conversation
"Fix inventory persistence: do not save collected items until scene changes"
wjt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you deleted all the documentation comments? Please revise this to restore them. It's hard to review the actual changes when most of the highlighted changes are deleting perfectly good comments
Please translate your new comments to English. (It's OK if the English is not perfect of course!)
| ## Internal flag used to delay inventory persistence until the scene changes. | ||
| ## This ensures items are not saved the moment they are collected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use # for internal fields. Adding a ## comment causes it to show up in the API documentation for the class; but we don't want this one to be there since it shouldn't be read/modified outside this file.
| ## Internal flag used to delay inventory persistence until the scene changes. | |
| ## This ensures items are not saved the moment they are collected. | |
| # Internal flag used to delay inventory persistence until the scene changes. | |
| # This ensures items are not saved the moment they are collected. |
| _do_set_scene(scene_path, spawn_point) | ||
|
|
||
| # If inventory changes were pending, write them now. | ||
| if _pending_inventory_save: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this flag. I think you can just unconditionally call _write_inventory_to_state() here?
| func start_quest(quest: Quest) -> void: | ||
| _do_clear_inventory() | ||
| _update_inventory_state() | ||
| _mark_inventory_dirty() # Deferred saving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be deferred when starting a quest - it should be cleared immediately.
"Fix inventory persistence: do not save collected items until scene changes"