You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
2.0 KiB

  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. #ifndef S_ITEM_H_
  17. #define S_ITEM_H_
  18. #include "cpp_api/s_base.h"
  19. #include "irr_v3d.h"
  20. struct PointedThing;
  21. struct ItemStack;
  22. class ServerActiveObject;
  23. struct ItemDefinition;
  24. class LuaItemStack;
  25. class ModApiItemMod;
  26. class InventoryList;
  27. struct InventoryLocation;
  28. class ScriptApiItem
  29. : virtual public ScriptApiBase
  30. {
  31. public:
  32. bool item_OnDrop(ItemStack &item,
  33. ServerActiveObject *dropper, v3f pos);
  34. bool item_OnPlace(ItemStack &item,
  35. ServerActiveObject *placer, const PointedThing &pointed);
  36. bool item_OnUse(ItemStack &item,
  37. ServerActiveObject *user, const PointedThing &pointed);
  38. bool item_OnSecondaryUse(ItemStack &item,
  39. ServerActiveObject *user);
  40. bool item_OnCraft(ItemStack &item, ServerActiveObject *user,
  41. const InventoryList *old_craft_grid, const InventoryLocation &craft_inv);
  42. bool item_CraftPredict(ItemStack &item, ServerActiveObject *user,
  43. const InventoryList *old_craft_grid, const InventoryLocation &craft_inv);
  44. protected:
  45. friend class LuaItemStack;
  46. friend class ModApiItemMod;
  47. friend class LuaRaycast;
  48. bool getItemCallback(const char *name, const char *callbackname, const v3s16 *p = nullptr);
  49. void pushPointedThing(const PointedThing& pointed);
  50. };
  51. #endif /* S_ITEM_H_ */