s_client.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Minetest
  3. Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
  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.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public License along
  14. with this program; if not, write to the Free Software Foundation, Inc.,
  15. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #pragma once
  18. #include "util/pointedthing.h"
  19. #include "cpp_api/s_base.h"
  20. #include "mapnode.h"
  21. #include "itemdef.h"
  22. #include "util/string.h"
  23. #include "util/pointedthing.h"
  24. #include "lua_api/l_item.h"
  25. #ifdef _CRT_MSVCP_CURRENT
  26. #include <cstdint>
  27. #endif
  28. class ClientEnvironment;
  29. class ScriptApiClient : virtual public ScriptApiBase
  30. {
  31. public:
  32. // Calls when mods are loaded
  33. void on_mods_loaded();
  34. // Calls on_shutdown handlers
  35. void on_shutdown();
  36. // Chat message handlers
  37. bool on_sending_message(const std::string &message);
  38. bool on_receiving_message(const std::string &message);
  39. void on_damage_taken(int32_t damage_amount);
  40. void on_hp_modification(int32_t newhp);
  41. void on_death();
  42. void environment_step(float dtime);
  43. void on_formspec_input(const std::string &formname, const StringMap &fields);
  44. bool on_dignode(v3s16 p, MapNode node);
  45. bool on_punchnode(v3s16 p, MapNode node);
  46. bool on_placenode(const PointedThing &pointed, const ItemDefinition &item);
  47. bool on_item_use(const ItemStack &item, const PointedThing &pointed);
  48. bool on_inventory_open(Inventory *inventory);
  49. void setEnv(ClientEnvironment *env);
  50. };