Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
670 stars 72 forks source link

when loading a player state, unequip current wieldable before loading #171

Closed brian-holsters closed 3 weeks ago

brian-holsters commented 2 months ago

Fixes #166

Added an optional argument to change_wieldable_to which allows to skip the await. This is required for quick loading the current scene since otherwise the await messes up the loading time resulting in unequipping the wieldable from the loaded data instead of the old one.

aronand commented 2 months ago

Your fix seems to work as intended.

However, while testing it I discovered a bug with the load system Nevermind, turns out it was my save slot itself that was somehow causing issues. A fresh save worked just fine 😄

aronand commented 2 months ago

One bug I did notice upon further testing is that the UI still retains information about the wieldable after loading a save: image

brian-holsters commented 2 months ago

After further testing, I don't think this is ready to merge...

These are the bugs related to loading with equippables so far:

The second and last bugs seem to be happening in main as well.

Phazorknight commented 2 months ago

So I've attempted to fix this myself in https://github.com/Phazorknight/Cogito/commit/85401bcd1f4b1dbb3d89a6503722fb4a8c126592

The approach I took is that I don't attempt to do anything before loading, but instead try to reset all leftover references when the PlayerInteractionComponent is loaded (which is when set_state() is called) and then equip the wieldables by just calling use on the wieldable item that was equipped when the save state was created.

Phazorknight commented 3 weeks ago

Closing as the previously mentioned commit solves this issue.