Added support for 1.6.629+

This commit is contained in:
Eddoursul 2022-10-08 17:54:12 +02:00
parent edd4f9ff5d
commit a299275ba7
8 changed files with 37 additions and 38 deletions

View File

@ -1,4 +1,4 @@
LoadSuppliesEverywhere = false LoadSuppliesEverywhere = false
StoreInventorySupplies = true StoreInventorySupplies = true
ShowFetchingNotification = true ShowFetchingNotification = true
ShowReturningNotification = false ShowReturningNotification = true

View File

@ -6,7 +6,7 @@ message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
######################################################################################################################## ########################################################################################################################
project( project(
EnderalSEEasyCrafting EnderalSEEasyCrafting
VERSION 1.0.0 VERSION 1.1.0
DESCRIPTION "Enderal SE Easy Crafting" DESCRIPTION "Enderal SE Easy Crafting"
LANGUAGES CXX) LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)

View File

@ -113,8 +113,11 @@ auto EventListener::ProcessEvent(
std::thread([furn]() { std::thread([furn]() {
std::this_thread::sleep_for(std::chrono::milliseconds(300)); std::this_thread::sleep_for(std::chrono::milliseconds(300));
const auto playerRef = RE::PlayerCharacter::GetSingleton(); 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; return;
} }
SKSE::GetTaskInterface()->AddTask([furn]() { SKSE::GetTaskInterface()->AddTask([furn]() {
@ -123,7 +126,9 @@ auto EventListener::ProcessEvent(
} }
std::thread([]() { std::thread([]() {
const auto playerRef = RE::PlayerCharacter::GetSingleton(); 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(100));
} }
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(500));

View File

@ -11,7 +11,8 @@ namespace {
SKSE::stl::report_and_fail("Failed to find standard logging directory"sv); 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<spdlog::sinks::basic_file_sink_mt>(path->string(), true); auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true);
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink)); auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink));
@ -22,24 +23,15 @@ namespace {
spdlog::set_default_logger(std::move(log)); spdlog::set_default_logger(std::move(log));
spdlog::set_pattern("[%l] %v"s); 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) { 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(); InitializeLogging();
auto* plugin = PluginDeclaration::GetSingleton(); auto* plugin = PluginDeclaration::GetSingleton();
@ -47,7 +39,9 @@ SKSEPluginLoad(const LoadInterface* skse) {
logger::info("{} {} is loading...", plugin->GetName(), version); logger::info("{} {} is loading...", plugin->GetName(), version);
Init(skse); Init(skse);
InitializeMessaging();
GetSettings(true);
EventListener::Install();
logger::info("{} has finished loading.", plugin->GetName()); logger::info("{} has finished loading.", plugin->GetName());
return true; return true;

View File

@ -285,9 +285,9 @@ inline bool FetchSupplies(RE::TESFurniture* a_furn)
RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) { RE::TES::GetSingleton()->ForEachReferenceInRange(playerRef, 4000, [&chestAct, &bAllowFetch](RE::TESObjectREFR& b_ref) {
if (chestAct == b_ref.GetBaseObject()) { if (chestAct == b_ref.GetBaseObject()) {
bAllowFetch = true; bAllowFetch = true;
return false; return RE::BSContainer::ForEachResult::kStop;
} }
return true; return RE::BSContainer::ForEachResult::kContinue;
}); });
} }

View File

@ -1,15 +1,15 @@
{ {
"registries": [ "registries": [
{ {
"kind": "git", "kind": "git",
"repository": "https://gitlab.com/colorglass/vcpkg-colorglass", "repository": "https://gitlab.com/colorglass/vcpkg-colorglass",
"baseline": "5a11d06fd1b2d7cd6339d6aea48d450309e89cc1", "baseline": "1b279b20c7e0db1c9d549ff3b64e024c01317b55",
"packages": [ "packages": [
"commonlibsse-ng", "commonlibsse-ng",
"gluino", "gluino",
"script-extender-common", "script-extender-common",
"skse" "skse"
] ]
} }
] ]
} }

View File

@ -1,14 +1,14 @@
{ {
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "enderal-se", "name": "enderal-se-easy-crafting",
"version-string": "1.0.0", "version-string": "1.1",
"port-version": 0, "port-version": 0,
"description": "Enderal SE Helper", "description": "Enderal SE Easy Crafting",
"homepage": "https://eddoursul.win/mods/enderal-se/", "homepage": "https://eddoursul.win/mods/enderal-se-easy-crafting/",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"features": { "features": {
"plugin": { "plugin": {
"description": "Enderal SE functions and potion replacer.", "description": "Automatic use of crafting supplies for Enderal SE 2.0.12+.",
"dependencies": [ "dependencies": [
"commonlibsse-ng", "commonlibsse-ng",
"simpleini" "simpleini"