3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef SCRIPTAPI_HEADER
21 #define SCRIPTAPI_HEADER
32 #include "scriptapi_inventory.h"
33 #include "scriptapi_nodemeta.h"
34 #include "scriptapi_entity.h"
35 #include "scriptapi_object.h"
36 #include "scriptapi_env.h"
37 #include "scriptapi_item.h"
38 #include "scriptapi_node.h"
40 #define luamethod(class, name) {#name, class::l_##name}
44 void scriptapi_export(lua_State *L, Server *server);
45 bool scriptapi_loadmod(lua_State *L, const std::string &scriptpath,
46 const std::string &modname);
48 // Returns true if script handled message
49 bool scriptapi_on_chat_message(lua_State *L, const std::string &name,
50 const std::string &message);
53 void scriptapi_on_shutdown(lua_State *L);
56 void scriptapi_on_newplayer(lua_State *L, ServerActiveObject *player);
57 void scriptapi_on_dieplayer(lua_State *L, ServerActiveObject *player);
58 bool scriptapi_on_respawnplayer(lua_State *L, ServerActiveObject *player);
59 void scriptapi_on_joinplayer(lua_State *L, ServerActiveObject *player);
60 void scriptapi_on_leaveplayer(lua_State *L, ServerActiveObject *player);
61 bool scriptapi_get_auth(lua_State *L, const std::string &playername,
62 std::string *dst_password, std::set<std::string> *dst_privs);
63 void scriptapi_create_auth(lua_State *L, const std::string &playername,
64 const std::string &password);
65 bool scriptapi_set_password(lua_State *L, const std::string &playername,
66 const std::string &password);
69 void scriptapi_on_player_receive_fields(lua_State *L,
70 ServerActiveObject *player,
71 const std::string &formname,
72 const std::map<std::string, std::string> &fields);