|
|
|
@ -18,6 +18,7 @@ namespace ArtifactTracker |
|
|
|
|
std::unordered_set<RE::FormType> g_artifactFormTypes; |
|
|
|
|
std::unordered_map<RE::FormID, RE::TESObjectREFR*> g_persistentMap; |
|
|
|
|
RE::TESObjectREFR* g_cellStorage; |
|
|
|
|
std::uint32_t g_iFollowerIndex; |
|
|
|
|
|
|
|
|
|
bool Init(bool bKID) |
|
|
|
|
{ |
|
|
|
@ -628,4 +629,48 @@ namespace ArtifactTracker |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// From po3's Papyrus Extender
|
|
|
|
|
std::vector<RE::Actor*> GetPlayerFollowers() |
|
|
|
|
{ |
|
|
|
|
std::vector<RE::Actor*> result; |
|
|
|
|
|
|
|
|
|
if (const auto processLists = RE::ProcessLists::GetSingleton(); processLists) { |
|
|
|
|
for (auto& actorHandle : processLists->highActorHandles) { |
|
|
|
|
if (auto actor = actorHandle.get(); actor && actor->IsPlayerTeammate()) { |
|
|
|
|
result.push_back(actor.get()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RescanFoundArtifacts() |
|
|
|
|
{ |
|
|
|
|
ListRevert(g_listFound); |
|
|
|
|
AddRefArtifactsToList(RE::PlayerCharacter::GetSingleton(), g_listFound, g_listStored); |
|
|
|
|
|
|
|
|
|
for (const auto& ref : GetPlayerFollowers()) { |
|
|
|
|
AddRefArtifactsToList(ref, g_listFound, g_listStored); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void OnLocationChange() |
|
|
|
|
{ |
|
|
|
|
std::uint32_t iCurrentFollowers; |
|
|
|
|
|
|
|
|
|
for (const auto& actor : GetPlayerFollowers()) { |
|
|
|
|
iCurrentFollowers += actor->formID; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (iCurrentFollowers != g_iFollowerIndex) { |
|
|
|
|
g_iFollowerIndex = iCurrentFollowers; |
|
|
|
|
std::thread([]() { |
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(3000)); // wait for followers to load into the new cell
|
|
|
|
|
RE::DebugNotification("Team changed, rescanning the found list"); |
|
|
|
|
RescanFoundArtifacts(); |
|
|
|
|
}).detach(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|