activeobjectmgr.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Minetest
  3. Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
  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 <functional>
  18. #include <vector>
  19. #include "../activeobjectmgr.h"
  20. #include "clientobject.h"
  21. namespace client
  22. {
  23. class ActiveObjectMgr final : public ::ActiveObjectMgr<ClientActiveObject>
  24. {
  25. public:
  26. ~ActiveObjectMgr() override;
  27. void step(float dtime,
  28. const std::function<void(ClientActiveObject *)> &f) override;
  29. bool registerObject(std::unique_ptr<ClientActiveObject> obj) override;
  30. void removeObject(u16 id) override;
  31. void getActiveObjects(const v3f &origin, f32 max_d,
  32. std::vector<DistanceSortedActiveObject> &dest);
  33. /// Gets all CAOs whose selection boxes may intersect the @p shootline.
  34. /// @note CAOs without a selection box are not returned.
  35. /// @note Distances are along the @p shootline.
  36. std::vector<DistanceSortedActiveObject> getActiveSelectableObjects(const core::line3d<f32> &shootline);
  37. };
  38. } // namespace client