Added support for Immersive Display Overhaul
This commit is contained in:
parent
477029e357
commit
33410ccee7
Binary file not shown.
@ -438,77 +438,79 @@ namespace ArtifactTracker
|
||||
g_listFound->AddForm(form);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (a_event->oldContainer != 0x14) {
|
||||
return;
|
||||
}
|
||||
} else if (a_event->oldContainer == 0x14) {
|
||||
|
||||
// Items moved from player's inventory
|
||||
// Items moved from player's inventory
|
||||
|
||||
if (!a_event->newContainer) { // no destination container
|
||||
if (!a_event->newContainer) { // no destination container
|
||||
|
||||
if (g_cellStorage && a_event->reference) { // dropped or placed on rack at home
|
||||
if (GetItemCount(g_cellStorage, form) <= 0) {
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Added dropped {} to cell storage", form->GetName());
|
||||
RE::DebugNotification("Adding to cell storage");
|
||||
#endif
|
||||
g_cellStorage->AddObjectToContainer(form->As<RE::TESBoundObject>(), nullptr, 1, nullptr);
|
||||
if (g_cellStorage && a_event->reference) { // dropped or placed on rack at home
|
||||
if (GetItemCount(g_cellStorage, form) <= 0) {
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Added dropped {} to cell storage", form->GetName());
|
||||
RE::DebugNotification("Adding to cell storage");
|
||||
#endif
|
||||
g_cellStorage->AddObjectToContainer(form->As<RE::TESBoundObject>(), nullptr, 1, nullptr);
|
||||
}
|
||||
ListRemoveItem(g_listFound, form);
|
||||
ListRemoveItem(g_listNew, form);
|
||||
g_listStored->AddForm(form);
|
||||
return;
|
||||
}
|
||||
ListRemoveItem(g_listFound, form);
|
||||
ListRemoveItem(g_listNew, form);
|
||||
g_listStored->AddForm(form);
|
||||
|
||||
if (g_listStored->HasForm(form)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
if ((GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
ListRemoveItem(g_listNew, form);
|
||||
g_listNew->AddForm(form);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_listStored->HasForm(form)) {
|
||||
return;
|
||||
}
|
||||
if (g_persistentMap.contains(a_event->newContainer)) { // moved to a persistent container
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
if ((GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
ListRemoveItem(g_listNew, form);
|
||||
g_listNew->AddForm(form);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_persistentMap.contains(a_event->newContainer)) { // moved to a persistent container
|
||||
|
||||
if (!g_listStored->HasForm(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listStored->AddForm(form);
|
||||
}
|
||||
|
||||
} else if (g_cellStorage) { // stored at home in a non-persistent/non-registered container
|
||||
|
||||
// g_bContainerMode is expected to be true, enabling processing after closing container.
|
||||
// Can be hit by autosorting mods. Most of them work with persistent containers, which should be added to the list of persistent containers.
|
||||
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Synchronous processing of a non-persistent container (moved from player)");
|
||||
#endif
|
||||
|
||||
const auto targetContainer = RE::TESForm::LookupByID<RE::TESObjectREFR>(a_event->newContainer);
|
||||
|
||||
if (IsValidContainer(targetContainer)) {
|
||||
if (GetItemCount(g_cellStorage, form) <= 0) {
|
||||
g_cellStorage->AddObjectToContainer(form->As<RE::TESBoundObject>(), nullptr, 1, nullptr);
|
||||
}
|
||||
|
||||
if (!g_listStored->HasForm(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listStored->AddForm(form);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (g_cellStorage) { // stored at home in a non-persistent/non-registered container
|
||||
|
||||
// g_bContainerMode is expected to be true, enabling processing after closing container.
|
||||
// Can be hit by autosorting mods. Most of them work with persistent containers, which should be added to the list of persistent containers.
|
||||
|
||||
#ifdef _DEBUG
|
||||
SKSE::log::info("Synchronous processing of a non-persistent container (moved from player)");
|
||||
#endif
|
||||
|
||||
const auto targetContainer = RE::TESForm::LookupByID<RE::TESObjectREFR>(a_event->newContainer);
|
||||
|
||||
if (IsValidContainer(targetContainer)) {
|
||||
if (GetItemCount(g_cellStorage, form) <= 0) {
|
||||
g_cellStorage->AddObjectToContainer(form->As<RE::TESBoundObject>(), nullptr, 1, nullptr);
|
||||
}
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
} else if (g_listFound->HasForm(form) && (GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listNew->AddForm(form);
|
||||
if (!g_listStored->HasForm(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listStored->AddForm(form);
|
||||
}
|
||||
}
|
||||
|
||||
// NB: During OnContainerChanged, InventoryChanges do not have the current change included yet
|
||||
} else if (g_listFound->HasForm(form) && (GetItemCount(RE::PlayerCharacter::GetSingleton(), form) - a_event->itemCount <= 0) && !FollowersHaveItem(form)) {
|
||||
ListRemoveItem(g_listFound, form);
|
||||
g_listNew->AddForm(form);
|
||||
}
|
||||
} else if (g_cellStorage && a_event->reference) {
|
||||
// Items dropped by someone else at home.
|
||||
// Mainly for compatibility with Immersive Display Overhaul
|
||||
SyncCellStorage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ auto EventListener::ProcessEvent(
|
||||
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl
|
||||
{
|
||||
if (!ArtifactTracker::g_bHomeContainer && (a_event->newContainer == 0x14 || a_event->oldContainer == 0x14)) {
|
||||
if (!ArtifactTracker::g_bHomeContainer && (a_event->newContainer == 0x14 || a_event->oldContainer == 0x14 || (ArtifactTracker::IsHome() && a_event->reference))) {
|
||||
const auto form = ArtifactTracker::GetArtifactByID(a_event->baseObj);
|
||||
if (form) {
|
||||
ArtifactTracker::OnContainerChanged(a_event, form);
|
||||
|
Loading…
Reference in New Issue
Block a user