Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
717 stars 81 forks source link

Crash when firing foam pistol #94

Closed ac-arcana closed 4 months ago

ac-arcana commented 4 months ago

I get a crash when firing the foam pistol on line 38 of Slot.

To reproduce the crash:

Start a new game Pick up the flashlight Pick up a health potion Pick up the pistol Wield the pistol now that it is in the third slot Open the inventory, and move the pistol to the first slot, the flashlight to the second slot, and the potion to the third slot. Now when you attempt to fire the pistol it will crash.

I think it specifically has to do with already wielding the pistol, and swapping two items in the hot bar slots. This seems to be the minimum steps I could reproduce it with.

Phazorknight commented 4 months ago

Thanks for flagging this and your repro steps. Looking into this it seems like this is a general bug with wieldables when you move their inventory slots while you wield them. The wieldable item looses the reference to the slot it is/was in, causing the crash. Looking into a way to fix this.

Phazorknight commented 4 months ago

This should be fixed in https://github.com/Phazorknight/Cogito/commit/70b138adc95e6b7bb8a14d8ab39f4796e96ffdac but please reopen this issue if it appears again.