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*,
|
inline void SyncCellStorage(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*,
|
||||||
RE::TESObjectREFR* a_cellStorage,
|
RE::TESObjectREFR* a_cellStorage,
|
||||||
|
RE::BGSListForm* a_excludeContainers,
|
||||||
RE::TESForm* a_excludeForm = NULL)
|
RE::TESForm* a_excludeForm = NULL)
|
||||||
{
|
{
|
||||||
if (!a_cellStorage) {
|
if (!a_cellStorage) {
|
||||||
@ -206,7 +207,6 @@ namespace Papyrus::ArtifactTracker
|
|||||||
|
|
||||||
std::unordered_map<RE::FormID, bool> cellItems;
|
std::unordered_map<RE::FormID, bool> cellItems;
|
||||||
|
|
||||||
const auto storageBase = a_cellStorage->GetBaseObject();
|
|
||||||
const auto cell = a_cellStorage->GetParentCell();
|
const auto cell = a_cellStorage->GetParentCell();
|
||||||
const auto inv = a_cellStorage->GetInventory();
|
const auto inv = a_cellStorage->GetInventory();
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ namespace Papyrus::ArtifactTracker
|
|||||||
const auto baseObj = a_ref->GetBaseObject();
|
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 (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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ namespace Papyrus::ArtifactTracker
|
|||||||
if (!is_artifact(baseObj)) {
|
if (!is_artifact(baseObj)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inv.find(baseObj) == inv.end()) {
|
if (inv.find(baseObj) == inv.end()) {
|
||||||
if (!a_excludeForm || !is_excluded(baseObj, a_excludeForm)) {
|
if (!a_excludeForm || !is_excluded(baseObj, a_excludeForm)) {
|
||||||
a_cellStorage->AddObjectToContainer(baseObj, nullptr, 1, nullptr);
|
a_cellStorage->AddObjectToContainer(baseObj, nullptr, 1, nullptr);
|
||||||
|
@ -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
|
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
|
Actor[] function GetPlayerFollowers() native global
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ Event OnUpdate()
|
|||||||
endif
|
endif
|
||||||
bRescanHome = false
|
bRescanHome = false
|
||||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||||
ETR_Functions.SyncCellStorage(cellStorage)
|
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||||
if ! bRescanPersistent
|
if ! bRescanPersistent
|
||||||
ETR_Functions.AddArtifactsToList(cellStorage, ETR_ItemsStored)
|
ETR_Functions.AddArtifactsToList(cellStorage, ETR_ItemsStored)
|
||||||
endif
|
endif
|
||||||
@ -119,6 +119,7 @@ event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemRefe
|
|||||||
lastDestContainer = akDestContainer
|
lastDestContainer = akDestContainer
|
||||||
lastDestIsPersistent = ETR_PersistentStorageList.HasForm(akDestContainer)
|
lastDestIsPersistent = ETR_PersistentStorageList.HasForm(akDestContainer)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
; Moving items without latent functions should help with avoiding stack dumps
|
; Moving items without latent functions should help with avoiding stack dumps
|
||||||
if lastDestIsPersistent
|
if lastDestIsPersistent
|
||||||
bRescanHome = false
|
bRescanHome = false
|
||||||
|
@ -78,7 +78,7 @@ Event OnUpdate()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||||
ETR_Functions.SyncCellStorage(cellStorage)
|
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if bRescanPersistent
|
if bRescanPersistent
|
||||||
@ -118,7 +118,7 @@ event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemRefere
|
|||||||
elseif bAtHome
|
elseif bAtHome
|
||||||
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
ObjectReference cellStorage = ETR_Functions.GetCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer)
|
||||||
if cellStorage.GetItemCount(akBaseItem)
|
if cellStorage.GetItemCount(akBaseItem)
|
||||||
ETR_Functions.SyncCellStorage(cellStorage)
|
ETR_Functions.SyncCellStorage(cellStorage, ETR_PersistentStorageList)
|
||||||
if ETR_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0
|
if ETR_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0
|
||||||
ETR_ItemsStored.RemoveAddedForm(akBaseItem)
|
ETR_ItemsStored.RemoveAddedForm(akBaseItem)
|
||||||
ETR_ItemsFound.AddForm(akBaseItem)
|
ETR_ItemsFound.AddForm(akBaseItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user