Removed StoreCraftedSupplies, covered by StoreInventorySupplies
This commit is contained in:
parent
e879358d9b
commit
8a876457ed
Binary file not shown.
@ -1,3 +1,2 @@
|
||||
LoadSuppliesEverywhere = false
|
||||
StoreInventorySupplies = true
|
||||
StoreCraftedSupplies = true
|
||||
|
@ -40,7 +40,6 @@ auto EventListener::ProcessEvent(
|
||||
-> RE::BSEventNotifyControl
|
||||
{
|
||||
if (!a_event->opening && a_event->menuName == RE::CraftingMenu::MENU_NAME) {
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
|
||||
SKSE::GetTaskInterface()->AddTask([]() {
|
||||
ReturnSupplies();
|
||||
});
|
||||
@ -99,32 +98,3 @@ auto EventListener::ProcessEvent(
|
||||
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
auto EventListener::ProcessEvent(
|
||||
const RE::TESContainerChangedEvent* a_event,
|
||||
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl
|
||||
{
|
||||
if (!RE::UI::GetSingleton()->IsMenuOpen(RE::CraftingMenu::MENU_NAME)) {
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->RemoveEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
const auto item = RE::TESForm::LookupByID(a_event->baseObj);
|
||||
const auto kForm = item->As<RE::BGSKeywordForm>();
|
||||
bool isMaterial = false;
|
||||
|
||||
if (item->Is(RE::FormType::Misc) && (kForm->HasKeywordString("VendorItemOreIngot") || kForm->HasKeywordString("VendorItemAnimalHide") || kForm->HasKeywordString("VendorItemAnimalPart") || kForm->HasKeywordString("VendorItemFireword"))) {
|
||||
isMaterial = true;
|
||||
} else if (item->Is(RE::FormType::AlchemyItem) && kForm->HasKeywordString("VendorItemFoodRaw")) {
|
||||
isMaterial = true;
|
||||
} else if (item->Is(RE::FormType::Ingredient)) {
|
||||
isMaterial = true;
|
||||
}
|
||||
|
||||
if (isMaterial) {
|
||||
AddToCraftedSupplies(item, a_event->itemCount);
|
||||
}
|
||||
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
@ -3,8 +3,7 @@
|
||||
class EventListener :
|
||||
public RE::BSTEventSink<SKSE::ModCallbackEvent>,
|
||||
public RE::BSTEventSink<RE::MenuOpenCloseEvent>,
|
||||
public RE::BSTEventSink<RE::TESActivateEvent>,
|
||||
public RE::BSTEventSink<RE::TESContainerChangedEvent>
|
||||
public RE::BSTEventSink<RE::TESActivateEvent>
|
||||
{
|
||||
public:
|
||||
~EventListener() = default;
|
||||
@ -30,11 +29,6 @@ public:
|
||||
const RE::TESActivateEvent* a_event,
|
||||
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl override;
|
||||
|
||||
auto ProcessEvent(
|
||||
const RE::TESContainerChangedEvent* a_event,
|
||||
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
|
||||
-> RE::BSEventNotifyControl override;
|
||||
|
||||
private:
|
||||
EventListener() = default;
|
||||
|
@ -58,23 +58,11 @@ inline const std::map<std::string, bool> GetSettings(bool bInit = false)
|
||||
if (bInit) {
|
||||
settings.insert({ "LoadSuppliesEverywhere", false });
|
||||
settings.insert({ "StoreInventorySupplies", true });
|
||||
settings.insert({ "StoreCraftedSupplies", true });
|
||||
LoadINI(&settings, "Data/SKSE/Plugins/EnderalSEEasyCrafting.ini");
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
inline void AddToCraftedSupplies(RE::TESForm* form, std::int32_t itemCount)
|
||||
{
|
||||
auto it = supplyCount.find(form);
|
||||
|
||||
if (it != supplyCount.end()) {
|
||||
it->second += itemCount;
|
||||
} else {
|
||||
supplyCount.insert({ form, itemCount });
|
||||
}
|
||||
}
|
||||
|
||||
inline void FetchSuppliesByType(RE::FormType formType)
|
||||
{
|
||||
const auto chest = RE::TESForm::LookupByID(0x5C132)->As<RE::TESObjectREFR>();
|
||||
@ -144,6 +132,7 @@ inline void ReturnSupplies()
|
||||
} else if (kform->HasKeyword(kOreIngot) || kform->HasKeyword(kAnimalPart) || kform->HasKeyword(kAnimalHide) || kform->HasKeyword(kFirewood)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a_form.Is(RE::FormType::AlchemyItem)) {
|
||||
@ -177,11 +166,10 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
|
||||
bAllowFetch = true;
|
||||
} else {
|
||||
RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) {
|
||||
if (const auto base = b_ref.GetBaseObject(); base) {
|
||||
if (chestAct == base) {
|
||||
bAllowFetch = true;
|
||||
return false;
|
||||
}
|
||||
const auto base = b_ref.GetBaseObject();
|
||||
if (chestAct == base) {
|
||||
bAllowFetch = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -191,10 +179,6 @@ inline void FetchSupplies(RE::TESFurniture* a_furn)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetSettings().at("StoreCraftedSupplies")) {
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
|
||||
}
|
||||
|
||||
bSuppliesFetched = true;
|
||||
|
||||
switch (a_furn->workBenchData.benchType.underlying()) {
|
||||
|
Loading…
Reference in New Issue
Block a user