Fix torn notes not combining when moved into inventory#8504
Fix torn notes not combining when moved into inventory#8504morfidon wants to merge 7 commits intodiasurgical:masterfrom
Conversation
|
I don't understand, you added a new function but never call it? |
Sorry I didn't push one local change got a bit weird behavior on Windows I'm trying to fight with ^^ |
Fixes diasurgical#8487 Torn notes were only combined when picked up from the ground via CheckQuestItem(). When notes entered the inventory through other paths (e.g. stash transfers, item swaps), the combine logic never ran. Add CheckSpecialInventoryItem() which checks whether all three torn notes are present after an item is placed into InvList, and combines them into the full note if so. Called from: - ChangeInvItem (empty slot path) - ChangeInvItem (swap path) - AutoPlaceItemInInventory (covers stash-to-inventory transfers)
14c16ca to
0f62a8c
Compare
Keep Na-Krul note auto-combine limited to player-facing inventory inserts so internal inventory reflow does not trigger partial side effects.\n\nTrack the inserted note through inventory compaction when combining, and add inventory regression tests for duplicate notes and sort behavior.
This reverts commit 686d172.
|
@morfidon does this logic can be called without Hellfire installed? |
Yes, the function can be reached from shared inventory insertion paths even without Hellfire, since That said, it should be effectively a no-op there, because the helper returns immediately unless the inserted item is one of So the current behavior is: callable in vanilla paths, but inert unless Hellfire torn-note items are actually involved. If you prefer, I can add an explicit |
|
Looks like this failed in the macOS packaging step, not in compilation. The log shows
So this seems more like a transient macOS runner / packaging issue than a failure caused by the code in this PR. A rerun of the job is probably worth trying first. |
|
I'm sorry @morfidon - I kept playing & also do not have the notes anymore. I'm starting the Crypts in Hell difficulty, but do not know if I'm going to make it through due to the spike in difficulty referenced in a closed idea I had. (Seems like each enemy hit started duplicating 3-6 times based on the number of armor tinks I hear for each attack animation when I entered the caves.) If I do manage to complete the crypts and obtain all 3 notes, I will test them combining when obtaining in different ways. |
Okay, in that case they way you did is fine. I was just wondering what would happen if an enum was missing or the Hellfire mod was off. Another point: at first sight seems that a lot was changed just to check for new items in inventory. I am planning to review later this week but feels like it could be simplified, I can be wrong. |
This is a really good point. For instance, why do we need a whole new function called |
I think the two call sites represent different semantics: TryCombineNaKrulNotes() handles the ground-pickup/world-item path, while TryCombineInsertedNaKrulNote() handles an item already inserted into InvList, where removals can compact inventory and shift indices. So I do think a separate entry point is justified. Do I have green light? |
|
Yes, that's what I expected you might say. |
|
what about a scenario where someone would want to keep multiple torn note fragments in stash? after this "fix" it will be impossible to keep all 3, I think having them merge only when picking up from the ground is enough |
Extract the shared preserved-note mapping into GetOtherNaKrulNotes. Keep the ground pickup and inserted-inventory entry points separate because they still have different item lifetime and inventory compaction semantics.
Rename the inventory-insert combine helper to clarify that it runs after an item is inserted into InvList. This keeps the separate flow-specific entry point but makes its purpose clearer during review.
not unless we want to consciously design stash as a way to bypass auto-combine? If not, combining in inventory-insert flow is more consistent than limiting it to ground pickup only. "merge only on ground pickup" is, to me, semantically weaker than "merge on relevant player inventory insert flows." Because then the result depends on the random path to acquiring the item, not on the game rule itself. |
I extracted the shared "other two notes" rule into a helper while keeping the two entry points separate because they operate on different state. If you think it would still be better to unify this further, I can take another pass |
Rename the local Na-Krul note helpers to a more consistent naming scheme. This keeps behavior unchanged while making the shared predicates and transformations easier to follow in review.
|
I'm not familiar enough with github to know how to download the appimage snapshot for this change - sorry. 🙁 I'm attaching a save game for you - I slogged through the crypt and managed to get all 3 torn notes. They're in my stash. |
That's totally ok! Thank you man it helped a lot. I can confim the fix is working properly. When I move notes from stash to inventory they are being combined now. They do not combine when I move last note TO the storage. Should we change it or keep it as is. |
Fixes #8487
Torn notes were only combined when picked up from the ground. The
combination logic is currently triggered through
CheckQuestItem(),which runs during ground pickup (
InvGetItem/AutoGetItem).Because of that, when notes are moved into the inventory through
other flows (for example from stash transfers), the combine logic
never runs and the notes remain separate.
This change introduces a small helper that runs when an item is added
to the inventory. It checks whether all three torn notes are present
and performs the Na-Krul note combination there.
The helper is executed from the inventory insertion paths so the
behavior is consistent regardless of how the notes enter the
inventory.
Special care was taken to avoid referencing stale inventory entries,
since the combination removes items and compacts the inventory.
Scenarios to test (I don't have notes - @Ruler2112 could you test it out?)