Use different shaders for spell and skill tomes
This commit is contained in:
parent
b45d935425
commit
14ea69a354
@ -21,9 +21,9 @@ void EventListener::Install()
|
||||
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
|
||||
|
||||
std::map<std::string, std::any> settings{
|
||||
{ "sRegularBookShader", "Skyrim.esm@C5EF7" },
|
||||
{ "sRegularBookShader", "Skyrim.esm@D2057" },
|
||||
{ "sSpellBookShader", "Skyrim.esm@C5EF7" },
|
||||
{ "sSkillBookShader", "Skyrim.esm@C5EF7" },
|
||||
{ "sSkillBookShader", "Skyrim.esm@C34B1" },
|
||||
};
|
||||
|
||||
LoadINI(&settings, std::format("Data/SKSE/Plugins/{}.ini", SKSE::PluginDeclaration::GetSingleton()->GetName()).c_str());
|
||||
@ -56,9 +56,18 @@ auto EventListener::ProcessEvent(
|
||||
if (const auto bookObj = baseObj->As<RE::TESObjectBOOK>()) {
|
||||
if (!bookObj->IsRead()) {
|
||||
RE::TESObjectREFR* ref = a_event->reference.get();
|
||||
SKSE::GetTaskInterface()->AddTask([ref]() {
|
||||
|
||||
auto shader = EventListener::regularBookShader;
|
||||
|
||||
if (bookObj->TeachesSpell()) {
|
||||
shader = EventListener::spellBookShader;
|
||||
} else if (bookObj->TeachesSkill()) {
|
||||
shader = EventListener::skillBookShader;
|
||||
}
|
||||
|
||||
SKSE::GetTaskInterface()->AddTask([ref, shader]() {
|
||||
if (ref) {
|
||||
ref->ApplyEffectShader(EventListener::regularBookShader);
|
||||
ref->ApplyEffectShader(shader);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ inline void ClearOldShaders()
|
||||
{
|
||||
if (const auto processLists = RE::ProcessLists::GetSingleton()) {
|
||||
processLists->ForEachShaderEffect([&](RE::ShaderReferenceEffect* a_shaderEffect) -> RE::BSContainer::ForEachResult {
|
||||
if (a_shaderEffect && a_shaderEffect->effectData == EventListener::regularBookShader && a_shaderEffect->target) {
|
||||
if (a_shaderEffect && (a_shaderEffect->effectData == EventListener::regularBookShader || a_shaderEffect->effectData == EventListener::spellBookShader || a_shaderEffect->effectData == EventListener::skillBookShader) && a_shaderEffect->target) {
|
||||
if (const auto targetRef = a_shaderEffect->target.get()) {
|
||||
if (const auto baseObj = targetRef->GetBaseObject(); baseObj->IsBook()) {
|
||||
if (baseObj->As<RE::TESObjectBOOK>()->IsRead()) {
|
||||
|
Loading…
Reference in New Issue
Block a user