1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/apps/openmw/mwlua/luabindings.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
3.2 KiB
C++
Raw Normal View History

2020-12-18 23:21:10 +01:00
#include "luabindings.hpp"
#include <components/lua/asyncpackage.hpp>
#include <components/lua/utilpackage.hpp>
2020-12-18 23:21:10 +01:00
2021-08-04 19:14:24 +03:00
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/datetimemanager.hpp"
2020-12-18 23:21:10 +01:00
2024-01-26 21:39:33 +00:00
#include "animationbindings.hpp"
#include "camerabindings.hpp"
#include "cellbindings.hpp"
#include "corebindings.hpp"
#include "debugbindings.hpp"
#include "inputbindings.hpp"
#include "localscripts.hpp"
2024-03-05 10:07:35 +04:00
#include "markupbindings.hpp"
#include "menuscripts.hpp"
#include "nearbybindings.hpp"
#include "objectbindings.hpp"
#include "postprocessingbindings.hpp"
#include "soundbindings.hpp"
#include "types/types.hpp"
#include "uibindings.hpp"
2023-08-22 18:04:14 +04:00
#include "vfsbindings.hpp"
#include "worldbindings.hpp"
2023-05-13 19:30:18 +02:00
namespace MWLua
{
std::map<std::string, sol::object> initCommonPackages(const Context& context)
{
sol::state_view lua = context.mLua->unsafeState();
MWWorld::DateTimeManager* tm = MWBase::Environment::get().getWorld()->getTimeManager();
return {
2024-01-26 21:39:33 +00:00
{ "openmw.animation", initAnimationPackage(context) },
{ "openmw.async",
LuaUtil::getAsyncPackageInitializer(
lua, [tm] { return tm->getSimulationTime(); }, [tm] { return tm->getGameTime(); }) },
2024-03-05 10:07:35 +04:00
{ "openmw.markup", initMarkupPackage(context) },
{ "openmw.util", LuaUtil::initUtilPackage(lua) },
2023-08-22 18:04:14 +04:00
{ "openmw.vfs", initVFSPackage(context) },
};
}
std::map<std::string, sol::object> initGlobalPackages(const Context& context)
2021-12-14 00:39:01 +01:00
{
initObjectBindingsForGlobalScripts(context);
initCellBindingsForGlobalScripts(context);
return {
{ "openmw.core", initCorePackage(context) },
{ "openmw.types", initTypesPackage(context) },
{ "openmw.world", initWorldPackage(context) },
};
2021-12-14 00:39:01 +01:00
}
std::map<std::string, sol::object> initLocalPackages(const Context& context)
2021-12-14 00:39:01 +01:00
{
initObjectBindingsForLocalScripts(context);
initCellBindingsForLocalScripts(context);
LocalScripts::initializeSelfPackage(context);
return {
{ "openmw.core", initCorePackage(context) },
{ "openmw.types", initTypesPackage(context) },
{ "openmw.nearby", initNearbyPackage(context) },
};
2021-12-14 00:39:01 +01:00
}
std::map<std::string, sol::object> initPlayerPackages(const Context& context)
2021-12-14 00:39:01 +01:00
{
return {
{ "openmw.ambient", initAmbientPackage(context) },
{ "openmw.camera", initCameraPackage(context.sol()) },
{ "openmw.debug", initDebugPackage(context) },
{ "openmw.input", initInputPackage(context) },
{ "openmw.postprocessing", initPostprocessingPackage(context) },
{ "openmw.ui", initUserInterfacePackage(context) },
};
2021-12-14 00:39:01 +01:00
}
std::map<std::string, sol::object> initMenuPackages(const Context& context)
{
return {
{ "openmw.core", initCorePackage(context) },
2023-10-31 10:22:58 +01:00
{ "openmw.ambient", initAmbientPackage(context) },
{ "openmw.ui", initUserInterfacePackage(context) },
{ "openmw.menu", initMenuPackage(context) },
2023-10-31 10:22:58 +01:00
{ "openmw.input", initInputPackage(context) },
};
}
2020-12-18 23:21:10 +01:00
}