From 5a8610c2f41e44c827912246b4f9437051d11621 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 18 Jul 2020 20:01:17 +0200 Subject: Added customizable keybindings, improved freecam, added special inventory keybind (by default ender inventory) --- src/script/cpp_api/s_client.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/script/cpp_api/s_client.cpp') diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp index f2cc9730b..7f88d2f96 100644 --- a/src/script/cpp_api/s_client.cpp +++ b/src/script/cpp_api/s_client.cpp @@ -242,6 +242,20 @@ bool ScriptApiClient::on_inventory_open(Inventory *inventory) return readParam(L, -1); } +void ScriptApiClient::open_special_inventory() +{ + SCRIPTAPI_PRECHECKHEADER + + PUSH_ERROR_HANDLER(L); + int error_handler = lua_gettop(L) - 1; + lua_insert(L, error_handler); + + lua_getglobal(L, "core"); + lua_getfield(L, -1, "open_special_inventory"); + if (lua_isfunction(L, -1)) + lua_pcall(L, 0, 0, error_handler); +} + void ScriptApiClient::setEnv(ClientEnvironment *env) { ScriptApiBase::setEnv(env); -- cgit v1.2.3