Schedule inventory checks in OnContainerChanged to work around a non-deterministic issue, when ContainerChanges has not been propagated yet
This commit is contained in:
parent
29f7c4e566
commit
4220779b99
Binary file not shown.
@ -6,7 +6,7 @@ message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
|
|||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
project(
|
project(
|
||||||
ArtifactTracker
|
ArtifactTracker
|
||||||
VERSION 1.0.4
|
VERSION 1.0.5
|
||||||
DESCRIPTION "Artifact Tracker"
|
DESCRIPTION "Artifact Tracker"
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
@ -627,10 +627,14 @@ namespace ArtifactTracker
|
|||||||
g_listStored->AddForm(form);
|
g_listStored->AddForm(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (a_event->oldContainer == 0x14 && !g_listStored->HasForm(form) && !GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) {
|
} else if (a_event->oldContainer == 0x14 && !g_listStored->HasForm(form)) {
|
||||||
// disposed by player
|
SKSE::GetTaskInterface()->AddTask([form]() {
|
||||||
ListRemoveItem(g_listFound, form);
|
if (!GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) {
|
||||||
g_listNew->AddForm(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
|
} else if (a_event->oldContainer == 0x14) { // dropped, consumed, dismantled, removed by script
|
||||||
|
|
||||||
if (!g_listStored->HasForm(form)) {
|
if (!g_listStored->HasForm(form)) {
|
||||||
if (!GetItemCount(RE::PlayerCharacter::GetSingleton(), form) && !FollowersHaveItem(form)) {
|
// Seems like OnContainerChanged runs concurrently with updating ContainerChanges.
|
||||||
ListRemoveItem(g_listFound, form);
|
// In small modlists ContainerChanges may not be propagated yet in this event, so we need to schedule GetItemCount.
|
||||||
g_listNew->AddForm(form);
|
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)) {
|
} else if (!g_listFound->HasForm(form)) {
|
||||||
ListRemoveItem(g_listNew, form);
|
ListRemoveItem(g_listNew, form);
|
||||||
g_listFound->AddForm(form);
|
g_listFound->AddForm(form);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (g_cellStorage && g_cellStorage->formID == a_event->oldContainer) {
|
} 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",
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
||||||
"name": "artifact-tracker",
|
"name": "artifact-tracker",
|
||||||
"version-string": "1.0.4",
|
"version-string": "1.0.5",
|
||||||
"port-version": 0,
|
"port-version": 0,
|
||||||
"description": "Artifact Tracker",
|
"description": "Artifact Tracker",
|
||||||
"homepage": "https://eddoursul.win/mods/artifact-tracker/",
|
"homepage": "https://eddoursul.win/mods/artifact-tracker/",
|
||||||
|
Loading…
Reference in New Issue
Block a user