diff --git a/SPID/include/DeathDistribution.h b/SPID/include/DeathDistribution.h
index fd9c100..7113602 100644
--- a/SPID/include/DeathDistribution.h
+++ b/SPID/include/DeathDistribution.h
@@ -11,6 +11,13 @@ namespace DeathDistribution
///
/// true if given entry was an on death distribuatble form. Note that returned value doesn't represent whether parsing was successful.
bool TryParse(const std::string& key, const std::string& value, const Path&);
+
+ ///
+ /// Explicitly adds a parsed entry to the on death distributable forms.
+ ///
+ /// This method is used when another Distribution detects a use of Starts Dead trait, which qualifies entry to become on death distributable.
+ ///
+ void AddEntry(const Distribution::INI::Data&);
}
using namespace Forms;
diff --git a/SPID/src/DeathDistribution.cpp b/SPID/src/DeathDistribution.cpp
index 7946de7..69c35ed 100644
--- a/SPID/src/DeathDistribution.cpp
+++ b/SPID/src/DeathDistribution.cpp
@@ -64,6 +64,10 @@ namespace DeathDistribution
}
return true;
}
+ void AddEntry(const Distribution::INI::Data& data)
+ {
+ deathConfigs[data.type].emplace_back(data);
+ }
}
#pragma endregion
diff --git a/SPID/src/Distribute.cpp b/SPID/src/Distribute.cpp
index 03a1897..93dcabb 100644
--- a/SPID/src/Distribute.cpp
+++ b/SPID/src/Distribute.cpp
@@ -173,10 +173,11 @@ namespace Distribute
void Distribute(NPCData& npcData, bool onlyLeveledEntries)
{
const auto input = PCLevelMult::Input{ npcData.GetActor(), npcData.GetNPC(), onlyLeveledEntries };
- Distribute(npcData, input);
-
+
if (npcData.IsDead()) { // If NPC is already dead, perform the On Death Distribution.
DeathDistribution::Manager::GetSingleton()->Distribute(npcData);
+ } else {
+ Distribute(npcData, input);
}
}
diff --git a/SPID/src/LookupConfigs.cpp b/SPID/src/LookupConfigs.cpp
index 4236253..896552d 100644
--- a/SPID/src/LookupConfigs.cpp
+++ b/SPID/src/LookupConfigs.cpp
@@ -70,10 +70,23 @@ namespace Distribution
data.path = path;
- configs[data.type].emplace_back(data);
+ if (data.traits.startsDead.has_value()) {
+ logger::info("\t\t[{} = {}]", key, value);
+ if (*data.traits.startsDead) {
+ logger::info("\t\t\tEntry uses Starts Dead Trait filter and will be converted to On Death Distribution. Use 'Death{} = ...' instead of '{} = ...'", key, key);
+ DeathDistribution::INI::AddEntry(data);
+ } else {
+ logger::info("\t\t\tTrait '-D' is redundant, because Regular Distribution ignores Dead NPCs by default.");
+ }
+
+ } else {
+ configs[data.type].emplace_back(data);
+ }
+
}
} catch (const std::exception& e) {
- logger::warn("\t\tFailed to parse entry [{} = {}]: {}", key, value, e.what());
+ logger::warn("\t\t[{} = {}]", key, value);
+ logger::warn("\t\t\tFailed to parse entry: {}", e.what());
}
}