Configurable pickup delay
This commit is contained in:
parent
bb459ce135
commit
c53f9ba39b
@ -7,7 +7,8 @@ RE::BGSKeyword* EventListener::keywordHide;
|
||||
RE::BGSKeyword* EventListener::keywordIngot;
|
||||
|
||||
inline std::map<std::string, std::any> g_settings{
|
||||
{ "fRadius", 350.0f },
|
||||
{ "iRadius", 350 },
|
||||
{ "iPickupDelay", 100 },
|
||||
{ "bPickupGold", true },
|
||||
{ "bPickupLockpicks", true },
|
||||
{ "bPickupMaterials", true },
|
||||
@ -84,7 +85,7 @@ auto EventListener::ProcessEvent(
|
||||
|
||||
std::unordered_set<RE::TESObjectREFR*> refQueue;
|
||||
|
||||
TES->ForEachReferenceInRange(baseRef, std::any_cast<float>(g_settings["fRadius"]), [&](RE::TESObjectREFR* a_ref) {
|
||||
TES->ForEachReferenceInRange(baseRef, static_cast<float>(std::any_cast<int>(g_settings["iRadius"])), [&](RE::TESObjectREFR* a_ref) {
|
||||
if (!a_ref) {
|
||||
return RE::BSContainer::ForEachResult::kContinue;
|
||||
}
|
||||
@ -157,9 +158,10 @@ auto EventListener::ProcessEvent(
|
||||
|
||||
std::thread([refQueue]() {
|
||||
RE::ScriptEventSourceHolder::GetSingleton()->GetEventSource<RE::TESActivateEvent>()->RemoveEventSink(EventListener::GetSingleton());
|
||||
int iPickupDelay = std::any_cast<int>(g_settings["iPickupDelay"]);
|
||||
|
||||
for (const auto& item : refQueue) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(iPickupDelay));
|
||||
SKSE::GetTaskInterface()->AddTask([&item]() {
|
||||
if (item && item->formID) {
|
||||
item->ActivateRef(RE::PlayerCharacter::GetSingleton(), 0, nullptr, item->extraList.GetCount(), false);
|
||||
|
Loading…
Reference in New Issue
Block a user