From 835a67d876b0ed10c3794f33f78d1a7c8783aeb4 Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Sun, 18 Jun 2023 20:58:06 +0000 Subject: [PATCH] Add icon path to core.MagicEffect --- apps/openmw/mwlua/magicbindings.cpp | 4 ++++ files/lua_api/openmw/core.lua | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwlua/magicbindings.cpp b/apps/openmw/mwlua/magicbindings.cpp index 28755a69de..e21bdda171 100644 --- a/apps/openmw/mwlua/magicbindings.cpp +++ b/apps/openmw/mwlua/magicbindings.cpp @@ -300,6 +300,10 @@ namespace MWLua auto name = ESM::MagicEffect::indexToName(rec.mIndex); return Misc::StringUtils::lowerCase(name); }); + magicEffectT["icon"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> std::string { + auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); + return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs); + }); magicEffectT["name"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> std::string_view { return MWBase::Environment::get() .getWorld() diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua index c5b7c3deba..13b2eeb2bf 100644 --- a/files/lua_api/openmw/core.lua +++ b/files/lua_api/openmw/core.lua @@ -627,7 +627,8 @@ --- -- @type MagicEffect --- @field #string Effect id string +-- @field #string id Effect ID +-- @field #string icon Effect Icon Path -- @field #string name Localized name of the effect -- @field #number school @{#MagicSchool} -- @field #number baseCost