Async cell rescan in a separate thread after pickup, removed the perk
This commit is contained in:
parent
adb77dd4d9
commit
31b9d5642e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -198,6 +198,7 @@ namespace ArtifactTracker
|
||||
g_bHomeContainer = false;
|
||||
g_cellStorage = cellStorage;
|
||||
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESActivateEvent>(EventListener::GetSingleton());
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Home mode ON");
|
||||
#endif
|
||||
@ -206,6 +207,7 @@ namespace ArtifactTracker
|
||||
g_bHomeContainer = false;
|
||||
g_cellStorage = nullptr;
|
||||
RE::UI::GetSingleton()->RemoveEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink<RE::TESActivateEvent>(EventListener::GetSingleton());
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Home mode OFF");
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "EventListener.h"
|
||||
#include "ArtifactTracker.h"
|
||||
#include "Util.h"
|
||||
|
||||
auto EventListener::GetSingleton() -> EventListener*
|
||||
{
|
||||
@ -86,3 +87,21 @@ auto EventListener::ProcessEvent(
|
||||
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
auto EventListener::ProcessEvent(
|
||||
const RE::TESActivateEvent* a_event,
|
||||
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl
|
||||
{
|
||||
if (ArtifactTracker::IsHome() && a_event->actionRef->IsPlayerRef() && a_event->objectActivated) {
|
||||
const auto ref = a_event->objectActivated.get();
|
||||
if (ref && ArtifactTracker::IsArtifact(ref->GetBaseObject())) {
|
||||
std::thread([]() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
ArtifactTracker::SyncCellStorage();
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ class EventListener :
|
||||
public RE::BSTEventSink<RE::TESContainerChangedEvent>,
|
||||
public RE::BSTEventSink<RE::TESCellFullyLoadedEvent>,
|
||||
public RE::BSTEventSink<RE::BGSActorCellEvent>,
|
||||
public RE::BSTEventSink<RE::MenuOpenCloseEvent>
|
||||
public RE::BSTEventSink<RE::MenuOpenCloseEvent>,
|
||||
public RE::BSTEventSink<RE::TESActivateEvent>
|
||||
{
|
||||
public:
|
||||
~EventListener() = default;
|
||||
@ -42,6 +43,11 @@ public:
|
||||
RE::BSTEventSource<SKSE::ModCallbackEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl override;
|
||||
|
||||
auto ProcessEvent(
|
||||
const RE::TESActivateEvent* a_event,
|
||||
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl override;
|
||||
|
||||
private:
|
||||
EventListener() = default;
|
||||
};
|
@ -6,8 +6,6 @@ FormList Property ETR_ItemsStored Auto
|
||||
|
||||
Keyword Property LocTypePlayerHouse Auto
|
||||
|
||||
Perk Property ETR_PickupPerk Auto
|
||||
|
||||
bool bAtHome = false
|
||||
ObjectReference bookShelf = None
|
||||
int iFollowerIndex = 0
|
||||
@ -31,10 +29,6 @@ Event OnPlayerLoadGame()
|
||||
return
|
||||
endif
|
||||
|
||||
if ! (GetReference() as Actor).HasPerk(ETR_PickupPerk)
|
||||
(GetReference() as Actor).AddPerk(ETR_PickupPerk)
|
||||
endif
|
||||
|
||||
if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800
|
||||
ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew)
|
||||
ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound)
|
||||
|
@ -1,14 +0,0 @@
|
||||
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
|
||||
;NEXT FRAGMENT INDEX 6
|
||||
Scriptname PRKF_ETR_PickupPerk_03000808 Extends Perk Hidden
|
||||
|
||||
;BEGIN FRAGMENT Fragment_0
|
||||
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
|
||||
;BEGIN CODE
|
||||
Utility.wait(0.3)
|
||||
ArtifactTrackerPlayer.SyncCellStorage()
|
||||
;END CODE
|
||||
EndFunction
|
||||
;END FRAGMENT
|
||||
|
||||
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
|
Loading…
Reference in New Issue
Block a user