mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
[CSM] Add event on_place_node API lua (#5548)
* [CSM] Add event on_place_node API lua
This commit is contained in:
@@ -42,6 +42,7 @@ extern "C" {
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdarg>
|
||||
#include "script/common/c_content.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -320,22 +321,10 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L,
|
||||
if (cobj == NULL || cobj->getId() == 0) {
|
||||
ObjectRef::create(L, cobj);
|
||||
} else {
|
||||
objectrefGet(L, cobj->getId());
|
||||
push_objectRef(L, cobj->getId());
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptApiBase::objectrefGet(lua_State *L, u16 id)
|
||||
{
|
||||
// Get core.object_refs[i]
|
||||
lua_getglobal(L, "core");
|
||||
lua_getfield(L, -1, "object_refs");
|
||||
luaL_checktype(L, -1, LUA_TTABLE);
|
||||
lua_pushnumber(L, id);
|
||||
lua_gettable(L, -2);
|
||||
lua_remove(L, -2); // object_refs
|
||||
lua_remove(L, -2); // core
|
||||
}
|
||||
|
||||
Server* ScriptApiBase::getServer()
|
||||
{
|
||||
return dynamic_cast<Server *>(m_gamedef);
|
||||
|
Reference in New Issue
Block a user