Skip to content

Commit

Permalink
outfit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 committed Mar 5, 2024
1 parent 9dfa1b4 commit 1e62a06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
9 changes: 2 additions & 7 deletions SPID/src/Distribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,10 @@ namespace Distribute

const auto npc = a_npcData.GetNPC();
const auto actor = a_npcData.GetActor();

if (!actor->IsDead()) {
actor->ResetInventory(false);
}


for_each_form<RE::BGSOutfit>(a_npcData, Forms::outfits, a_input, [&](auto* a_outfit) {
if (detail::can_equip_outfit(npc, a_outfit)) {
actor->RemoveOutfitItems(npc->defaultOutfit);
npc->defaultOutfit = a_outfit;
npc->defaultOutfit = a_outfit;
npc->AddKeyword(processedOutfit);
return true;
}
Expand Down
16 changes: 9 additions & 7 deletions SPID/src/DistributeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Distribute
for (const auto& xList : *entryList->extraLists) {
const auto outfitItem = xList ? xList->GetByType<RE::ExtraOutfitItem>() : nullptr;
if (outfitItem && outfitItem->id == formID) {
RE::ActorEquipManager::GetSingleton()->EquipObject(actor, entryList->object, xList, 1, nullptr, true);
RE::ActorEquipManager::GetSingleton()->EquipObject(actor, entryList->object, xList, 1, nullptr, true, !actor->IsDead());
}
}
}
Expand Down Expand Up @@ -70,6 +70,7 @@ namespace Distribute
Distribute(npcData, false, true);
}
if (processOnLoad) {
a_this->RemoveOutfitItems(nullptr);
DistributeItemOutfits(npcData, { a_this, npc, false });
}
}
Expand Down Expand Up @@ -111,13 +112,14 @@ namespace Distribute
func(a_this, a_buf);

if (const auto npc = a_this->GetActorBase()) {
// some npcs are completely reset upon loading
if (a_this->Is3DLoaded() && detail::should_process_NPC(npc)) {
auto npcData = NPCData(a_this, npc);
Distribute(npcData, false);
// some leveled npcs are completely reset upon loading
if (a_this->Is3DLoaded()) {
if (detail::should_process_NPC(npc)) {
auto npcData = NPCData(a_this, npc);
Distribute(npcData, false);
}
detail::force_equip_outfit(a_this, npc);
}

detail::force_equip_outfit(a_this, npc);
}
}
static inline REL::Relocation<decltype(thunk)> func;
Expand Down

0 comments on commit 1e62a06

Please sign in to comment.