aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_client.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-01-07 10:45:59 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-01-07 10:45:59 +0100
commit906845a874ec7f59caadad5392113204c8abcf76 (patch)
treeeedde6d1a2983f233fd5b1ad6b43323c50d4620f /src/script/cpp_api/s_client.cpp
parent3a43259021d7c9c9c8626a5bead7c8d420890d91 (diff)
downloaddragonfireclient-906845a874ec7f59caadad5392113204c8abcf76.tar.xz
Add minetest.registered_items and minetest.registered_nodes (Doesn't do anything yet)
Diffstat (limited to 'src/script/cpp_api/s_client.cpp')
-rw-r--r--src/script/cpp_api/s_client.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index 200a449ee..b90decfb5 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -18,6 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "nodedef.h"
+#include "itemdef.h"
#include "s_client.h"
#include "s_internal.h"
#include "client/client.h"
@@ -317,6 +319,28 @@ void ScriptApiClient::open_enderchest()
lua_pcall(L, 0, 0, error_handler);
}
+void ScriptApiClient::set_node_def(const ContentFeatures &f)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_nodes");
+
+ push_content_features(L, f);
+ lua_setfield(L, -2, f.name.c_str());
+}
+
+void ScriptApiClient::set_item_def(const ItemDefinition &i)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_items");
+
+ push_item_definition(L, i);
+ lua_setfield(L, -2, i.name.c_str());
+}
+
void ScriptApiClient::setEnv(ClientEnvironment *env)
{
ScriptApiBase::setEnv(env);