diff --git a/Artifact Tracker.esp b/Artifact Tracker.esp index a63bae7..1be4264 100644 Binary files a/Artifact Tracker.esp and b/Artifact Tracker.esp differ diff --git a/SKSE/Plugins/ArtifactTracker.dll b/SKSE/Plugins/ArtifactTracker.dll index 5bf5ab0..d98e046 100644 Binary files a/SKSE/Plugins/ArtifactTracker.dll and b/SKSE/Plugins/ArtifactTracker.dll differ diff --git a/Scripts/ArtifactTrackerPlayer.pex b/Scripts/ArtifactTrackerPlayer.pex index 4731442..6195133 100644 Binary files a/Scripts/ArtifactTrackerPlayer.pex and b/Scripts/ArtifactTrackerPlayer.pex differ diff --git a/Scripts/PRKF_ETR_PickupPerk_03000808.pex b/Scripts/PRKF_ETR_PickupPerk_03000808.pex deleted file mode 100644 index 5461e9e..0000000 Binary files a/Scripts/PRKF_ETR_PickupPerk_03000808.pex and /dev/null differ diff --git a/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp b/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp index 8611a40..3930d8d 100644 --- a/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp +++ b/Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp @@ -198,6 +198,7 @@ namespace ArtifactTracker g_bHomeContainer = false; g_cellStorage = cellStorage; RE::UI::GetSingleton()->AddEventSink(EventListener::GetSingleton()); + RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink(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(EventListener::GetSingleton()); + RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink(EventListener::GetSingleton()); #ifdef _DEBUG SKSE::log::info("Home mode OFF"); #endif diff --git a/Source/ArtifactTrackerDLL/src/EventListener.cpp b/Source/ArtifactTrackerDLL/src/EventListener.cpp index 34ea2ce..8390613 100644 --- a/Source/ArtifactTrackerDLL/src/EventListener.cpp +++ b/Source/ArtifactTrackerDLL/src/EventListener.cpp @@ -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* 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; +} diff --git a/Source/ArtifactTrackerDLL/src/EventListener.h b/Source/ArtifactTrackerDLL/src/EventListener.h index e155efc..b1b00dc 100644 --- a/Source/ArtifactTrackerDLL/src/EventListener.h +++ b/Source/ArtifactTrackerDLL/src/EventListener.h @@ -5,7 +5,8 @@ class EventListener : public RE::BSTEventSink, public RE::BSTEventSink, public RE::BSTEventSink, - public RE::BSTEventSink + public RE::BSTEventSink, + public RE::BSTEventSink { public: ~EventListener() = default; @@ -42,6 +43,11 @@ public: RE::BSTEventSource* a_eventSource) -> RE::BSEventNotifyControl override; + auto ProcessEvent( + const RE::TESActivateEvent* a_event, + RE::BSTEventSource* a_eventSource) + -> RE::BSEventNotifyControl override; + private: EventListener() = default; }; \ No newline at end of file diff --git a/Source/Scripts/ArtifactTrackerPlayer.psc b/Source/Scripts/ArtifactTrackerPlayer.psc index af48507..2f79c36 100644 --- a/Source/Scripts/ArtifactTrackerPlayer.psc +++ b/Source/Scripts/ArtifactTrackerPlayer.psc @@ -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) diff --git a/Source/Scripts/PRKF_ETR_PickupPerk_03000808.psc b/Source/Scripts/PRKF_ETR_PickupPerk_03000808.psc deleted file mode 100644 index ace391b..0000000 --- a/Source/Scripts/PRKF_ETR_PickupPerk_03000808.psc +++ /dev/null @@ -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