s_env.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "mapnode.h"
  20. #include <unordered_set>
  21. #include <vector>
  22. class ServerEnvironment;
  23. struct ScriptCallbackState;
  24. class ScriptApiEnv : virtual public ScriptApiBase
  25. {
  26. public:
  27. // Called on environment step
  28. void environment_Step(float dtime);
  29. // Called after generating a piece of map
  30. void environment_OnGenerated(v3s16 minp, v3s16 maxp, u32 blockseed);
  31. // Called on player event
  32. void player_event(ServerActiveObject *player, const std::string &type);
  33. // Called after emerge of a block queued from core.emerge_area()
  34. void on_emerge_area_completion(v3s16 blockpos, int action,
  35. ScriptCallbackState *state);
  36. void check_for_falling(v3s16 p);
  37. // Called after liquid transform changes
  38. void on_liquid_transformed(const std::vector<std::pair<v3s16, MapNode>> &list);
  39. // Called after mapblock changes
  40. void on_mapblocks_changed(const std::unordered_set<v3s16> &set);
  41. // Determines whether there are any on_mapblocks_changed callbacks
  42. bool has_on_mapblocks_changed();
  43. void initializeEnvironment(ServerEnvironment *env);
  44. };