mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 09:39:56 +00:00
Enable openmw.input
in menu scripts
This commit is contained in:
parent
1dd7a15255
commit
889ddc10d6
@ -24,6 +24,12 @@ namespace MWLua
|
||||
|
||||
sol::table initInputPackage(const Context& context)
|
||||
{
|
||||
{
|
||||
sol::state_view& lua = context.mLua->sol();
|
||||
if (lua["openmw_input"] != sol::nil)
|
||||
return lua["openmw_input"];
|
||||
}
|
||||
|
||||
sol::usertype<SDL_Keysym> keyEvent = context.mLua->sol().new_usertype<SDL_Keysym>("KeyEvent");
|
||||
keyEvent["symbol"] = sol::readonly_property([](const SDL_Keysym& e) {
|
||||
if (e.sym > 0 && e.sym <= 255)
|
||||
@ -291,7 +297,9 @@ namespace MWLua
|
||||
{ "Tab", SDL_SCANCODE_TAB },
|
||||
}));
|
||||
|
||||
return LuaUtil::makeReadOnly(api);
|
||||
sol::state_view& lua = context.mLua->sol();
|
||||
lua["openmw_input"] = LuaUtil::makeReadOnly(api);
|
||||
return lua["openmw_input"];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,13 +76,11 @@ namespace MWLua
|
||||
std::map<std::string, sol::object> initMenuPackages(const Context& context)
|
||||
{
|
||||
return {
|
||||
{ "openmw.core", initCorePackageForMenuScripts(context) }, //
|
||||
{ "openmw.ambient", initAmbientPackage(context) }, //
|
||||
{ "openmw.ui", initUserInterfacePackage(context) }, //
|
||||
{ "openmw.core", initCorePackageForMenuScripts(context) },
|
||||
{ "openmw.ambient", initAmbientPackage(context) },
|
||||
{ "openmw.ui", initUserInterfacePackage(context) },
|
||||
{ "openmw.menu", initMenuPackage(context) },
|
||||
// TODO: Maybe add:
|
||||
// { "openmw.input", initInputPackage(context) },
|
||||
// { "openmw.postprocessing", initPostprocessingPackage(context) },
|
||||
{ "openmw.input", initInputPackage(context) },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ local env = {
|
||||
ambient = require('openmw.ambient'),
|
||||
async = require('openmw.async'),
|
||||
ui = require('openmw.ui'),
|
||||
input = require('openmw.input'),
|
||||
aux_util = require('openmw_aux.util'),
|
||||
view = require('openmw_aux.util').deepToString,
|
||||
print = printToConsole,
|
||||
|
Loading…
x
Reference in New Issue
Block a user