diff --git a/SKSE/Plugins/EnderalSEEasyCrafting.dll b/SKSE/Plugins/EnderalSEEasyCrafting.dll index 89f5852..0afd974 100644 Binary files a/SKSE/Plugins/EnderalSEEasyCrafting.dll and b/SKSE/Plugins/EnderalSEEasyCrafting.dll differ diff --git a/SKSE/Plugins/EnderalSEEasyCrafting.ini b/SKSE/Plugins/EnderalSEEasyCrafting.ini index c744b90..20373b3 100644 --- a/SKSE/Plugins/EnderalSEEasyCrafting.ini +++ b/SKSE/Plugins/EnderalSEEasyCrafting.ini @@ -1,4 +1,4 @@ LoadSuppliesEverywhere = false StoreInventorySupplies = true ShowFetchingNotification = true -ShowReturningNotification = false +ShowReturningNotification = true diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 15a2680..babbe89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.") ######################################################################################################################## project( EnderalSEEasyCrafting - VERSION 1.0.0 + VERSION 1.1.0 DESCRIPTION "Enderal SE Easy Crafting" LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) diff --git a/src/src/EventListener.cpp b/src/src/EventListener.cpp index d1eef29..42b6b01 100644 --- a/src/src/EventListener.cpp +++ b/src/src/EventListener.cpp @@ -113,8 +113,11 @@ auto EventListener::ProcessEvent( std::thread([furn]() { std::this_thread::sleep_for(std::chrono::milliseconds(300)); + const auto playerRef = RE::PlayerCharacter::GetSingleton(); - if (playerRef->GetSitSleepState() != RE::SIT_SLEEP_STATE::kWantToSit && playerRef->GetSitSleepState() != RE::SIT_SLEEP_STATE::kWaitingForSitAnim) { + const auto sitState = playerRef->AsActorState()->GetSitSleepState(); + + if (sitState != RE::SIT_SLEEP_STATE::kWantToSit && sitState != RE::SIT_SLEEP_STATE::kWaitingForSitAnim) { return; } SKSE::GetTaskInterface()->AddTask([furn]() { @@ -123,7 +126,9 @@ auto EventListener::ProcessEvent( } std::thread([]() { const auto playerRef = RE::PlayerCharacter::GetSingleton(); - while (playerRef->GetSitSleepState() == RE::SIT_SLEEP_STATE::kWantToSit || playerRef->GetSitSleepState() == RE::SIT_SLEEP_STATE::kWaitingForSitAnim) { + const auto sitState = playerRef->AsActorState()->GetSitSleepState(); + + while (sitState == RE::SIT_SLEEP_STATE::kWantToSit || sitState == RE::SIT_SLEEP_STATE::kWaitingForSitAnim) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } std::this_thread::sleep_for(std::chrono::milliseconds(500)); diff --git a/src/src/Main.cpp b/src/src/Main.cpp index f0c0a62..d1dab51 100644 --- a/src/src/Main.cpp +++ b/src/src/Main.cpp @@ -11,7 +11,8 @@ namespace { SKSE::stl::report_and_fail("Failed to find standard logging directory"sv); } - *path /= "EnderalSEEasyCrafting.log"sv; + *path /= PluginDeclaration::GetSingleton()->GetName(); + *path += ".log"sv; auto sink = std::make_shared(path->string(), true); auto log = std::make_shared("global log"s, std::move(sink)); @@ -22,24 +23,15 @@ namespace { spdlog::set_default_logger(std::move(log)); spdlog::set_pattern("[%l] %v"s); } - - void InitializeMessaging() - { - GetMessagingInterface()->RegisterListener([](MessagingInterface::Message* message) { - if (message->type == MessagingInterface::kPostPostLoad) { - if (!std::filesystem::exists("Data\\Enderal - Forgotten Stories.esm") || !std::filesystem::exists("Data\\SKSE\\Plugins\\EnderalSE.ini")) { - MessageBoxW(NULL, L"Easy Crafting requires Enderal SE 2.0.12 or newer.", L"Enderal SE Easy Crafting", MB_OK | MB_ICONERROR); - exit(EXIT_FAILURE); - } - GetSettings(true); - EventListener::Install(); - } - }); - } } SKSEPluginLoad(const LoadInterface* skse) { + if (!std::filesystem::exists("Data\\Enderal - Forgotten Stories.esm") || !std::filesystem::exists("Data\\SKSE\\Plugins\\EnderalSE.ini")) { + MessageBoxW(NULL, L"Easy Crafting requires Enderal SE 2.0.12 or newer.", L"Enderal SE Easy Crafting", MB_OK | MB_ICONERROR); + exit(EXIT_FAILURE); + } + InitializeLogging(); auto* plugin = PluginDeclaration::GetSingleton(); @@ -47,7 +39,9 @@ SKSEPluginLoad(const LoadInterface* skse) { logger::info("{} {} is loading...", plugin->GetName(), version); Init(skse); - InitializeMessaging(); + + GetSettings(true); + EventListener::Install(); logger::info("{} has finished loading.", plugin->GetName()); return true; diff --git a/src/src/Util.h b/src/src/Util.h index 5f30b23..0be08c2 100644 --- a/src/src/Util.h +++ b/src/src/Util.h @@ -285,9 +285,9 @@ inline bool FetchSupplies(RE::TESFurniture* a_furn) RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) { if (chestAct == b_ref.GetBaseObject()) { bAllowFetch = true; - return false; + return RE::BSContainer::ForEachResult::kStop; } - return true; + return RE::BSContainer::ForEachResult::kContinue; }); } diff --git a/src/vcpkg-configuration.json b/src/vcpkg-configuration.json index 337bdfa..f9a6b24 100644 --- a/src/vcpkg-configuration.json +++ b/src/vcpkg-configuration.json @@ -1,15 +1,15 @@ { "registries": [ - { - "kind": "git", - "repository": "https://gitlab.com/colorglass/vcpkg-colorglass", - "baseline": "5a11d06fd1b2d7cd6339d6aea48d450309e89cc1", - "packages": [ - "commonlibsse-ng", - "gluino", - "script-extender-common", - "skse" - ] - } + { + "kind": "git", + "repository": "https://gitlab.com/colorglass/vcpkg-colorglass", + "baseline": "1b279b20c7e0db1c9d549ff3b64e024c01317b55", + "packages": [ + "commonlibsse-ng", + "gluino", + "script-extender-common", + "skse" + ] + } ] } diff --git a/src/vcpkg.json b/src/vcpkg.json index 99277de..ef3e95a 100644 --- a/src/vcpkg.json +++ b/src/vcpkg.json @@ -1,14 +1,14 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", - "name": "enderal-se", - "version-string": "1.0.0", + "name": "enderal-se-easy-crafting", + "version-string": "1.1", "port-version": 0, - "description": "Enderal SE Helper", - "homepage": "https://eddoursul.win/mods/enderal-se/", + "description": "Enderal SE Easy Crafting", + "homepage": "https://eddoursul.win/mods/enderal-se-easy-crafting/", "license": "LGPL-3.0", "features": { "plugin": { - "description": "Enderal SE functions and potion replacer.", + "description": "Automatic use of crafting supplies for Enderal SE 2.0.12+.", "dependencies": [ "commonlibsse-ng", "simpleini"