diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-07-18 20:01:17 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-07-18 20:01:17 +0200 |
commit | 5a8610c2f41e44c827912246b4f9437051d11621 (patch) | |
tree | 04fa785120501182e83c5b05515527bb0428aa63 /src/script/cpp_api | |
parent | 83f59484d3b03e8964f1c7886dd1a0afd96ddd8d (diff) | |
download | dragonfireclient-5a8610c2f41e44c827912246b4f9437051d11621.tar.xz |
Added customizable keybindings, improved freecam, added special inventory keybind (by default ender inventory)
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r-- | src/script/cpp_api/s_client.cpp | 14 | ||||
-rw-r--r-- | src/script/cpp_api/s_client.h | 1 |
2 files changed, 15 insertions, 0 deletions
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<bool>(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); diff --git a/src/script/cpp_api/s_client.h b/src/script/cpp_api/s_client.h index 93fe96791..4cdcb42eb 100644 --- a/src/script/cpp_api/s_client.h +++ b/src/script/cpp_api/s_client.h @@ -59,6 +59,7 @@ public: bool on_item_use(const ItemStack &item, const PointedThing &pointed); bool on_inventory_open(Inventory *inventory); + void open_special_inventory(); void setEnv(ClientEnvironment *env); }; |