1

Added an option to prevent stealing

This commit is contained in:
Eddoursul 2024-07-04 20:42:41 +02:00
parent 8f9a75591e
commit 84e67980ec

View File

@ -16,6 +16,7 @@ inline std::map<std::string, std::any> g_settings{
{ "bPickupFlora", true }, { "bPickupFlora", true },
{ "bPickupIngredients", true }, { "bPickupIngredients", true },
{ "bPickupSoulGems", true }, { "bPickupSoulGems", true },
{ "bAllowStealing", true },
}; };
auto EventListener::GetSingleton() -> EventListener* auto EventListener::GetSingleton() -> EventListener*
@ -84,6 +85,7 @@ auto EventListener::ProcessEvent(
} }
std::unordered_set<RE::TESObjectREFR*> refQueue; std::unordered_set<RE::TESObjectREFR*> refQueue;
bool bAllowStealing = std::any_cast<bool>(g_settings["bAllowStealing"]);
TES->ForEachReferenceInRange(initRef, static_cast<float>(std::any_cast<int>(g_settings["iRadius"])), [&](RE::TESObjectREFR* a_ref) { TES->ForEachReferenceInRange(initRef, static_cast<float>(std::any_cast<int>(g_settings["iRadius"])), [&](RE::TESObjectREFR* a_ref) {
if (!a_ref) { if (!a_ref) {
@ -100,6 +102,10 @@ auto EventListener::ProcessEvent(
return RE::BSContainer::ForEachResult::kContinue; return RE::BSContainer::ForEachResult::kContinue;
} }
if (!bAllowStealing && a_ref->IsCrimeToActivate()) {
return RE::BSContainer::ForEachResult::kContinue;
}
bool bAdd = false; bool bAdd = false;
if (initBase == refBase) { if (initBase == refBase) {