1
Fork 0

Send delayed operations to the main thread

ae-1.6.629
Eddoursul 2 years ago
parent 10194f1757
commit 4d4d95b317
  1. BIN
      SKSE/Plugins/ArtifactTracker.dll
  2. 8
      Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp
  3. 4
      Source/ArtifactTrackerDLL/src/EventListener.cpp

Binary file not shown.

@ -269,7 +269,9 @@ namespace ArtifactTracker
g_bBookShelf = false; g_bBookShelf = false;
std::thread([]() { std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(1200)); std::this_thread::sleep_for(std::chrono::milliseconds(1200));
ArtifactTracker::SyncCellStorage(); SKSE::GetTaskInterface()->AddTask([&]() {
ArtifactTracker::SyncCellStorage();
});
}).detach(); }).detach();
} else { } else {
SyncCellStorage(); SyncCellStorage();
@ -757,7 +759,9 @@ namespace ArtifactTracker
g_iFollowerIndex = iCurrentFollowers; g_iFollowerIndex = iCurrentFollowers;
std::thread([]() { std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(3000)); // wait for followers to load into the new cell std::this_thread::sleep_for(std::chrono::milliseconds(3000)); // wait for followers to load into the new cell
RescanFoundArtifacts(); SKSE::GetTaskInterface()->AddTask([&]() {
RescanFoundArtifacts();
});
}).detach(); }).detach();
} }
} }

@ -116,7 +116,9 @@ auto EventListener::ProcessEvent(
if (ref && ArtifactTracker::IsArtifact(ref->GetBaseObject())) { if (ref && ArtifactTracker::IsArtifact(ref->GetBaseObject())) {
std::thread([]() { std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(200)); std::this_thread::sleep_for(std::chrono::milliseconds(200));
ArtifactTracker::SyncCellStorage(); SKSE::GetTaskInterface()->AddTask([&]() {
ArtifactTracker::SyncCellStorage();
});
}).detach(); }).detach();
} }
} }

Loading…
Cancel
Save