#include "birthsignbindings.hpp" #include #include #include #include #include "../mwbase/environment.hpp" #include "idcollectionbindings.hpp" #include "types/types.hpp" namespace sol { template <> struct is_automagical : std::false_type { }; } namespace MWLua { sol::table initBirthSignRecordBindings(const Context& context) { sol::state_view& lua = context.mLua->sol(); sol::table birthSigns(context.mLua->sol(), sol::create); addRecordFunctionBinding(birthSigns, context); auto signT = lua.new_usertype("ESM3_BirthSign"); signT[sol::meta_function::to_string] = [](const ESM::BirthSign& rec) -> std::string { return "ESM3_BirthSign[" + rec.mId.toDebugString() + "]"; }; signT["id"] = sol::readonly_property([](const ESM::BirthSign& rec) { return rec.mId.serializeText(); }); signT["name"] = sol::readonly_property([](const ESM::BirthSign& rec) -> std::string_view { return rec.mName; }); signT["description"] = sol::readonly_property([](const ESM::BirthSign& rec) -> std::string_view { return rec.mDescription; }); auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); signT["texture"] = sol::readonly_property([vfs](const ESM::BirthSign& rec) -> std::string { return Misc::ResourceHelpers::correctTexturePath(rec.mTexture, vfs); }); signT["spells"] = sol::readonly_property([lua](const ESM::BirthSign& rec) -> sol::table { return createReadOnlyRefIdTable(lua, rec.mPowers.mList); }); return LuaUtil::makeReadOnly(birthSigns); } }