1

Perk-based delayed processing of picked up items

This commit is contained in:
Eddoursul 2022-07-01 22:15:55 +02:00
parent 238d00a816
commit 1ca711df36
7 changed files with 16 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -253,7 +253,7 @@ namespace ArtifactTracker
} }
} }
void SyncCellStorage(RE::FormID skipRefID) void SyncCellStorage()
{ {
if (!IsHome()) { if (!IsHome()) {
#ifdef _DEBUG #ifdef _DEBUG
@ -302,7 +302,7 @@ namespace ArtifactTracker
continue; continue;
} }
if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion() || a_ref->formID == skipRefID) { if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion()) {
continue; continue;
} }
@ -375,13 +375,13 @@ namespace ArtifactTracker
} else if (g_cellStorage) { // probably, picked up at home (can also be crafted, but oh well) } else if (g_cellStorage) { // probably, picked up at home (can also be crafted, but oh well)
// OnContainerChanged fires before a picked item gets marked for deletion // OnContainerChanged fires before a picked item gets marked for deletion
RE::FormID lastPickupFormID = NULL;
const auto crosshairObj = RE::CrosshairPickData::GetSingleton()->target; const auto crosshairObj = RE::CrosshairPickData::GetSingleton()->target;
if (crosshairObj && crosshairObj.get() && crosshairObj.get().get()->GetBaseObject()->formID == a_event->baseObj) { if (crosshairObj && crosshairObj.get() && crosshairObj.get().get()->GetBaseObject()->formID == a_event->baseObj) {
lastPickupFormID = crosshairObj.get().get()->formID; // Picked up items are handled in the perk
return;
} }
SyncCellStorage(lastPickupFormID); SyncCellStorage();
return; return;
} }

View File

@ -30,7 +30,7 @@ namespace ArtifactTracker
void OnCellEnter(RE::BGSLocation* location, RE::TESObjectCELL* cell); void OnCellEnter(RE::BGSLocation* location, RE::TESObjectCELL* cell);
void SyncCellStorage(RE::FormID skipRefID = NULL); void SyncCellStorage();
void OnContainerChanged(const RE::TESContainerChangedEvent* a_event, RE::TESForm* form); void OnContainerChanged(const RE::TESContainerChangedEvent* a_event, RE::TESForm* form);

View File

@ -15,9 +15,9 @@ namespace Papyrus::PapyrusFunctions
return ArtifactTracker::g_cellStorage; return ArtifactTracker::g_cellStorage;
} }
inline void SyncCellStorage(RE::StaticFunctionTag*, RE::FormID skipRefID = NULL) inline void SyncCellStorage(RE::StaticFunctionTag*)
{ {
ArtifactTracker::SyncCellStorage(skipRefID); ArtifactTracker::SyncCellStorage();
} }
// From po3's Papyrus Extender // From po3's Papyrus Extender

View File

@ -6,6 +6,8 @@ FormList Property ETR_ItemsStored Auto
Keyword Property LocTypePlayerHouse Auto Keyword Property LocTypePlayerHouse Auto
Perk Property ETR_PickupPerk Auto
bool bAtHome = false bool bAtHome = false
int iFollowerIndex int iFollowerIndex
ObjectReference bookShelf = None ObjectReference bookShelf = None
@ -27,6 +29,10 @@ Event OnPlayerLoadGame()
return return
endif endif
if ! (GetReference() as Actor).HasPerk(ETR_PickupPerk)
(GetReference() as Actor).AddPerk(ETR_PickupPerk)
endif
if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800 if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800
ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew) ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew)
ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound) ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound)
@ -141,7 +147,7 @@ state AtHome
iLimit -= 1 iLimit -= 1
Utility.wait(0.5) Utility.wait(0.5)
endwhile endwhile
SyncCellStorage(ref.GetFormID()) SyncCellStorage()
endif endif
endevent endevent
@ -163,6 +169,6 @@ ObjectReference function GetCellStorage() native global
ObjectReference function GetCurrentContainer() native global ObjectReference function GetCurrentContainer() native global
function SyncCellStorage(int FormID = 0) native global function SyncCellStorage() native global
Actor[] function GetPlayerFollowers() native global Actor[] function GetPlayerFollowers() native global