s_entity.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Minetest
  3. Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include "cpp_api/s_base.h"
  18. #include "irr_v3d.h"
  19. struct ObjectProperties;
  20. struct ToolCapabilities;
  21. class ScriptApiEntity
  22. : virtual public ScriptApiBase
  23. {
  24. public:
  25. bool luaentity_Add(u16 id, const char *name);
  26. void luaentity_Activate(u16 id,
  27. const std::string &staticdata, u32 dtime_s);
  28. void luaentity_Remove(u16 id);
  29. std::string luaentity_GetStaticdata(u16 id);
  30. void luaentity_GetProperties(u16 id,
  31. ObjectProperties *prop);
  32. void luaentity_Step(u16 id, float dtime);
  33. bool luaentity_Punch(u16 id,
  34. ServerActiveObject *puncher, float time_from_last_punch,
  35. const ToolCapabilities *toolcap, v3f dir, s16 damage);
  36. bool luaentity_on_death(u16 id, ServerActiveObject *killer);
  37. void luaentity_Rightclick(u16 id, ServerActiveObject *clicker);
  38. void luaentity_on_attach_child(u16 id, ServerActiveObject *child);
  39. void luaentity_on_detach_child(u16 id, ServerActiveObject *child);
  40. void luaentity_on_detach(u16 id, ServerActiveObject *parent);
  41. private:
  42. bool luaentity_run_simple_callback(u16 id, ServerActiveObject *sao,
  43. const char *field);
  44. };