Exclude registered persistent containers during cell scan
This commit is contained in:
parent
0e2a31fbb1
commit
812dfa556a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -198,6 +198,7 @@ namespace Papyrus::ArtifactTracker
|
||||
|
||||
inline void SyncCellStorage(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*,
|
||||
RE::TESObjectREFR* a_cellStorage,
|
||||
RE::BGSListForm* a_excludeContainers,
|
||||
RE::TESForm* a_excludeForm = NULL)
|
||||
{
|
||||
if (!a_cellStorage) {
|
||||
@ -206,7 +207,6 @@ namespace Papyrus::ArtifactTracker
|
||||
|
||||
std::unordered_map<RE::FormID, bool> cellItems;
|
||||
|
||||
const auto storageBase = a_cellStorage->GetBaseObject();
|
||||
const auto cell = a_cellStorage->GetParentCell();
|
||||
const auto inv = a_cellStorage->GetInventory();
|
||||
|
||||
@ -214,7 +214,7 @@ namespace Papyrus::ArtifactTracker
|
||||
const auto baseObj = a_ref->GetBaseObject();
|
||||
|
||||
if (baseObj->formType == RE::FormType::Container || (baseObj->formType == RE::FormType::NPC && !a_ref->IsDisabled() && baseObj->As<RE::TESNPC>()->GetRace()->formID == 0x0010760A)) {
|
||||
if (a_ref->GetBaseObject()->formID == storageBase->formID) {
|
||||
if (a_excludeContainers->HasForm(a_ref->formID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ int function GetItemCountInList(FormList refList, Form baseForm) native global
|
||||
|
||||
ObjectReference function GetCellStorage(ObjectReference ref, FormList refList, Form refToCreate, bool autoCreate = true) native global
|
||||
|
||||
function SyncCellStorage(ObjectReference cellStorage, Form excludeForm = None) native global
|
||||
function SyncCellStorage(ObjectReference cellStorage, FormList excludeContainers, Form excludeForm = None) native global
|
||||
|
||||
Actor[] function GetPlayerFollowers() native global
|
||||
|
||||
|
@ -87,7 +87,7 @@ Event OnUpdate()
|
||||
endif
|
||||
bRescanHome = false
|
||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||
ETR_Functions.SyncCellStorage(cellStorage)
|
||||
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||
if ! bRescanPersistent
|
||||
ETR_Functions.AddArtifactsToList(cellStorage, ETR_ItemsStored)
|
||||
endif
|
||||
@ -119,6 +119,7 @@ event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemRefe
|
||||
lastDestContainer = akDestContainer
|
||||
lastDestIsPersistent = ETR_PersistentStorageList.HasForm(akDestContainer)
|
||||
endif
|
||||
|
||||
; Moving items without latent functions should help with avoiding stack dumps
|
||||
if lastDestIsPersistent
|
||||
bRescanHome = false
|
||||
|
@ -78,7 +78,7 @@ Event OnUpdate()
|
||||
return
|
||||
endif
|
||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||
ETR_Functions.SyncCellStorage(cellStorage)
|
||||
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||
endif
|
||||
|
||||
if bRescanPersistent
|
||||
@ -118,7 +118,7 @@ event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemRefere
|
||||
elseif bAtHome
|
||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||
if cellStorage.GetItemCount(akBaseItem)
|
||||
ETR_Functions.SyncCellStorage(cellStorage)
|
||||
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||
if ETR_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0
|
||||
ETR_ItemsStored.RemoveAddedForm(akBaseItem)
|
||||
ETR_ItemsFound.AddForm(akBaseItem)
|
||||
|
Loading…
Reference in New Issue
Block a user