diff --git a/SKSE/Plugins/ArtifactTracker.dll b/SKSE/Plugins/ArtifactTracker.dll index f49e1cd..4cb0634 100644 Binary files a/SKSE/Plugins/ArtifactTracker.dll and b/SKSE/Plugins/ArtifactTracker.dll differ diff --git a/Source/ArtifactTrackerDLL/CMakeLists.txt b/Source/ArtifactTrackerDLL/CMakeLists.txt index fb9bfc9..0bf8af5 100644 --- a/Source/ArtifactTrackerDLL/CMakeLists.txt +++ b/Source/ArtifactTrackerDLL/CMakeLists.txt @@ -6,7 +6,7 @@ message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.") ######################################################################################################################## project( ArtifactTracker - VERSION 1.0.4 + VERSION 1.0.5 DESCRIPTION "Artifact Tracker" LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) diff --git a/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp b/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp index 5ec1c63..ba77424 100644 --- a/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp +++ b/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp @@ -627,10 +627,14 @@ namespace ArtifactTracker g_listStored->AddForm(form); } - } else if (a_event->oldContainer == 0x14 && !g_listStored->HasForm(form) && !GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) { - // disposed by player - ListRemoveItem(g_listFound, form); - g_listNew->AddForm(form); + } else if (a_event->oldContainer == 0x14 && !g_listStored->HasForm(form)) { + SKSE::GetTaskInterface()->AddTask([form]() { + if (!GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) { + // disposed by player + ListRemoveItem(g_listFound, form); + g_listNew->AddForm(form); + } + }); } } } @@ -664,14 +668,18 @@ namespace ArtifactTracker } else if (a_event->oldContainer == 0x14) { // dropped, consumed, dismantled, removed by script if (!g_listStored->HasForm(form)) { - if (!GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) { - ListRemoveItem(g_listFound, form); - g_listNew->AddForm(form); + // Seems like OnContainerChanged runs concurrently with updating ContainerChanges. + // In small modlists ContainerChanges may not be propagated yet in this event, so we need to schedule GetItemCount. + SKSE::GetTaskInterface()->AddTask([form]() { + if (!GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) { + ListRemoveItem(g_listFound, form); + g_listNew->AddForm(form); - } else if (!g_listFound->HasForm(form)) { - ListRemoveItem(g_listNew, form); - g_listFound->AddForm(form); - } + } else if (!g_listFound->HasForm(form)) { + ListRemoveItem(g_listNew, form); + g_listFound->AddForm(form); + } + }); } } else if (g_cellStorage && g_cellStorage->formID == a_event->oldContainer) { diff --git a/Source/ArtifactTrackerDLL/vcpkg.json b/Source/ArtifactTrackerDLL/vcpkg.json index 2ecfaba..0dabd77 100644 --- a/Source/ArtifactTrackerDLL/vcpkg.json +++ b/Source/ArtifactTrackerDLL/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "artifact-tracker", - "version-string": "1.0.4", + "version-string": "1.0.5", "port-version": 0, "description": "Artifact Tracker", "homepage": "https://eddoursul.win/mods/artifact-tracker/",