From 4fcacd59aa2e703e0cac0ef5cbd3538657fd962f Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Sat, 27 Jan 2024 12:02:56 -0600 Subject: [PATCH] Add model to NPC lua --- apps/openmw/mwlua/types/npc.cpp | 3 +++ files/lua_api/openmw/types.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/apps/openmw/mwlua/types/npc.cpp b/apps/openmw/mwlua/types/npc.cpp index 30c8fd60d9..b1ac3d994a 100644 --- a/apps/openmw/mwlua/types/npc.cpp +++ b/apps/openmw/mwlua/types/npc.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "apps/openmw/mwbase/environment.hpp" #include "apps/openmw/mwbase/mechanicsmanager.hpp" @@ -78,6 +79,8 @@ namespace MWLua = sol::readonly_property([](const ESM::NPC& rec) -> int { return (int)rec.mNpdt.mDisposition; }); record["head"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mHead.serializeText(); }); + record["model"] = sol::readonly_property( + [](const ESM::NPC& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); }); record["isMale"] = sol::readonly_property([](const ESM::NPC& rec) -> bool { return rec.isMale(); }); record["baseGold"] = sol::readonly_property([](const ESM::NPC& rec) -> int { return rec.mNpdt.mGold; }); addActorServicesBindings(record, context); diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index ba0b2dd58b..734288bfb7 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -939,6 +939,7 @@ -- @field #string name -- @field #string race -- @field #string class Name of the NPC's class (e. g. Acrobat) +-- @field #string model Path to the model associated with this NPC, used for animations. -- @field #string mwscript MWScript that is attached to this NPC -- @field #string hair Path to the hair body part model -- @field #string head Path to the head body part model