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()) {
#ifdef _DEBUG
@ -302,7 +302,7 @@ namespace ArtifactTracker
continue;
}
if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion() || a_ref->formID == skipRefID) {
if (a_ref->IsDisabled() || a_ref->IsMarkedForDeletion()) {
continue;
}
@ -375,13 +375,13 @@ namespace ArtifactTracker
} 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
RE::FormID lastPickupFormID = NULL;
const auto crosshairObj = RE::CrosshairPickData::GetSingleton()->target;
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;
}

View File

@ -30,7 +30,7 @@ namespace ArtifactTracker
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);

View File

@ -15,9 +15,9 @@ namespace Papyrus::PapyrusFunctions
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

View File

@ -6,6 +6,8 @@ FormList Property ETR_ItemsStored Auto
Keyword Property LocTypePlayerHouse Auto
Perk Property ETR_PickupPerk Auto
bool bAtHome = false
int iFollowerIndex
ObjectReference bookShelf = None
@ -27,6 +29,10 @@ 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)
@ -141,7 +147,7 @@ state AtHome
iLimit -= 1
Utility.wait(0.5)
endwhile
SyncCellStorage(ref.GetFormID())
SyncCellStorage()
endif
endevent
@ -163,6 +169,6 @@ ObjectReference function GetCellStorage() native global
ObjectReference function GetCurrentContainer() native global
function SyncCellStorage(int FormID = 0) native global
function SyncCellStorage() native global
Actor[] function GetPlayerFollowers() native global