1
Fork 0

Schedule inventory checks in OnContainerChanged to work around a non-deterministic issue, when ContainerChanges has not been propagated yet

ae-1.6.629 1.0.5
Eddoursul 2 months ago
parent 29f7c4e566
commit 4220779b99
  1. BIN
      SKSE/Plugins/ArtifactTracker.dll
  2. 2
      Source/ArtifactTrackerDLL/CMakeLists.txt
  3. 30
      Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp
  4. 2
      Source/ArtifactTrackerDLL/vcpkg.json

Binary file not shown.

@ -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)

@ -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) {

@ -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/",

Loading…
Cancel
Save