s_nodemeta.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "cpp_api/s_item.h"
  19. #include "irr_v3d.h"
  20. struct MoveAction;
  21. struct ItemStack;
  22. class ScriptApiNodemeta
  23. : virtual public ScriptApiBase,
  24. public ScriptApiItem
  25. {
  26. public:
  27. ScriptApiNodemeta() = default;
  28. virtual ~ScriptApiNodemeta() = default;
  29. // Return number of accepted items to be moved
  30. int nodemeta_inventory_AllowMove(
  31. const MoveAction &ma, int count,
  32. ServerActiveObject *player);
  33. // Return number of accepted items to be put
  34. int nodemeta_inventory_AllowPut(
  35. const MoveAction &ma, const ItemStack &stack,
  36. ServerActiveObject *player);
  37. // Return number of accepted items to be taken
  38. int nodemeta_inventory_AllowTake(
  39. const MoveAction &ma, const ItemStack &stack,
  40. ServerActiveObject *player);
  41. // Report moved items
  42. void nodemeta_inventory_OnMove(
  43. const MoveAction &ma, int count,
  44. ServerActiveObject *player);
  45. // Report put items
  46. void nodemeta_inventory_OnPut(
  47. const MoveAction &ma, const ItemStack &stack,
  48. ServerActiveObject *player);
  49. // Report taken items
  50. void nodemeta_inventory_OnTake(
  51. const MoveAction &ma, const ItemStack &stack,
  52. ServerActiveObject *player);
  53. private:
  54. };