From a88f0ecc958c52fd018429cc986fb30755cabfd4 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Thu, 2 Nov 2023 17:43:09 +0100 Subject: [PATCH] Expose governing attributes to Lua --- apps/openmw/mwlua/stats.cpp | 3 +++ files/lua_api/openmw/core.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/apps/openmw/mwlua/stats.cpp b/apps/openmw/mwlua/stats.cpp index 5c1e536dd6..127d8e79d9 100644 --- a/apps/openmw/mwlua/stats.cpp +++ b/apps/openmw/mwlua/stats.cpp @@ -454,6 +454,9 @@ namespace MWLua return nullptr; return &*rec.mSchool; }); + skillT["attribute"] = sol::readonly_property([](const ESM::Skill& rec) -> std::string { + return ESM::Attribute::indexToRefId(rec.mData.mAttribute).serializeText(); + }); auto schoolT = context.mLua->sol().new_usertype("MagicSchool"); schoolT[sol::meta_function::to_string] diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua index abdb099ed7..44ab4473fa 100644 --- a/files/lua_api/openmw/core.lua +++ b/files/lua_api/openmw/core.lua @@ -862,6 +862,7 @@ -- @field #string description Human-readable description -- @field #string icon VFS path to the icon -- @field #MagicSchoolData school Optional magic school +-- @field #string attribute The id of the skill's governing attribute -- @type MagicSchoolData -- @field #string name Human-readable name