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