Add minetest.registered_items and minetest.registered_nodes (Doesn't do anything yet)
This commit is contained in:
parent
3a43259021
commit
906845a874
@ -105,3 +105,6 @@ core.registered_on_inventory_open, core.register_on_inventory_open = make_regist
|
||||
core.registered_on_recieve_physics_override, core.register_on_recieve_physics_override = make_registration()
|
||||
core.registered_on_play_sound, core.register_on_play_sound = make_registration()
|
||||
core.registered_on_spawn_particle, core.register_on_spawn_particle = make_registration()
|
||||
|
||||
core.registered_nodes = {}
|
||||
core.registered_items = {}
|
||||
|
@ -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);
|
||||
|
@ -66,6 +66,9 @@ public:
|
||||
|
||||
bool on_inventory_open(Inventory *inventory);
|
||||
void open_enderchest();
|
||||
|
||||
void set_node_def(const ContentFeatures &f);
|
||||
void set_item_def(const ItemDefinition &i);
|
||||
|
||||
void setEnv(ClientEnvironment *env);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user