diff --git a/apps/openmw/mwlua/luabindings.cpp b/apps/openmw/mwlua/luabindings.cpp index 782cc07c46..db3057f982 100644 --- a/apps/openmw/mwlua/luabindings.cpp +++ b/apps/openmw/mwlua/luabindings.cpp @@ -37,7 +37,6 @@ #include "camerabindings.hpp" #include "cellbindings.hpp" -#include "classbindings.hpp" #include "debugbindings.hpp" #include "factionbindings.hpp" #include "inputbindings.hpp" @@ -158,12 +157,9 @@ namespace MWLua api["magic"] = initCoreMagicBindings(context); api["stats"] = initCoreStatsBindings(context); - sol::table character(lua->sol(), sol::create); initCoreFactionBindings(context); - character["factions"] = &MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>(); + api["factions"] = &MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>(); - character["classes"] = initCoreClassBindings(context); - api["character"] = LuaUtil::makeReadOnly(character); api["l10n"] = LuaUtil::initL10nLoader(lua->sol(), MWBase::Environment::get().getL10nManager()); const MWWorld::Store<ESM::GameSetting>* gmstStore = &MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>(); diff --git a/apps/openmw/mwlua/types/npc.cpp b/apps/openmw/mwlua/types/npc.cpp index 25997b6468..823cf59613 100644 --- a/apps/openmw/mwlua/types/npc.cpp +++ b/apps/openmw/mwlua/types/npc.cpp @@ -12,6 +12,7 @@ #include <apps/openmw/mwworld/class.hpp> #include <apps/openmw/mwworld/esmstore.hpp> +#include "../classbindings.hpp" #include "../localscripts.hpp" #include "../stats.hpp" @@ -81,6 +82,9 @@ namespace MWLua record["baseGold"] = sol::readonly_property([](const ESM::NPC& rec) -> int { return rec.mNpdt.mGold; }); addActorServicesBindings<ESM::NPC>(record, context); + sol::table character(lua, sol::create); + character["classes"] = initCoreClassBindings(context); + npc["character"] = LuaUtil::makeReadOnly(character); // This function is game-specific, in future we should replace it with something more universal. npc["isWerewolf"] = [](const Object& o) { const MWWorld::Class& cls = o.ptr().getClass(); diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua index 98046ac7c0..441136805b 100644 --- a/files/lua_api/openmw/core.lua +++ b/files/lua_api/openmw/core.lua @@ -12,24 +12,7 @@ --- -- A read-only list of all @{#FactionRecord}s in the world database. --- @field [parent=#Character] #list<#FactionRecord> factions - ---- @{#Character}: Class and Character Data --- @field [parent=#core] #Character character - - ---- @{#Classes}: Class Data --- @field [parent=#Character] #Classes classes - ---- --- A read-only list of all @{#ClassRecord}s in the world database. --- @field [parent=#Classes] #list<#ClassRecord> records - ---- --- Returns a read-only @{#ClassRecord} --- @function [parent=#Classes] record --- @param #string recordId --- @return #ClassRecord +-- @field [parent=#core] #list<#FactionRecord> factions --- -- Terminates the game and quits to the OS. Should be used only for testing purposes. @@ -889,19 +872,6 @@ -- @field #string failureSound VFS path to the failure sound -- @field #string hitSound VFS path to the hit sound ---- --- Class data record --- @type ClassRecord --- @field #string id Class id --- @field #string name Class name --- @field #list<#string> attributes A read-only list containing the specialized attributes of the class. --- @field #list<#string> majorSkills A read-only list containing the major skills of the class. --- @field #list<#string> minorSkills A read-only list containing the minor skills of the class. --- @field #string description Class description --- @field #boolean isPlayable True if the player can play as this class --- @field #string specialization Class specialization. Either combat, magic, or stealth. - - --- -- Faction data record -- @type FactionRecord diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 69ce5fbaf2..b300351df3 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -872,6 +872,35 @@ -- @param openmw.core#GameObject actor -- @return #number +--- @{#Character}: Class and Character Data +-- @field [parent=#NPC] #Character character + + +--- @{#Classes}: Class Data +-- @field [parent=#Character] #Classes classes + +--- +-- A read-only list of all @{#ClassRecord}s in the world database. +-- @field [parent=#Classes] #list<#ClassRecord> records + +--- +-- Returns a read-only @{#ClassRecord} +-- @function [parent=#Classes] record +-- @param #string recordId +-- @return #ClassRecord + +--- +-- Class data record +-- @type ClassRecord +-- @field #string id Class id +-- @field #string name Class name +-- @field #list<#string> attributes A read-only list containing the specialized attributes of the class. +-- @field #list<#string> majorSkills A read-only list containing the major skills of the class. +-- @field #list<#string> minorSkills A read-only list containing the minor skills of the class. +-- @field #string description Class description +-- @field #boolean isPlayable True if the player can play as this class +-- @field #string specialization Class specialization. Either combat, magic, or stealth. + --- -- Whether the NPC or player is in the werewolf form at the moment. -- @function [parent=#NPC] isWerewolf