💿🐜 Antkeeper source code https://antkeeper.com
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.

66 lines
2.0 KiB

  1. /*
  2. * Copyright (C) 2020 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_EBT_HPP
  20. #define ANTKEEPER_EBT_HPP
  21. #include "game/behavior/behavior-tree.hpp"
  22. #include <entt/entt.hpp>
  23. /// Entity Behavior Tree
  24. /**
  25. * The `ebt` namespace defines Entity Behavior Tree (EBT) nodes and an EBT context, on which EBT nodes operate.
  26. */
  27. namespace ebt {
  28. /**
  29. * EBT context which references an entity and its registry.
  30. */
  31. struct context
  32. {
  33. entt::registry* registry;
  34. entt::entity entity;
  35. };
  36. typedef behavior_tree::status status;
  37. typedef behavior_tree::node<context> node;
  38. typedef behavior_tree::leaf_node<context> leaf_node;
  39. typedef behavior_tree::decorator_node<context> decorator_node;
  40. typedef behavior_tree::composite_node<context> composite_node;
  41. typedef behavior_tree::action<context> action;
  42. typedef behavior_tree::condition<context> condition;
  43. typedef behavior_tree::inverter<context> inverter;
  44. typedef behavior_tree::repeater<context> repeater;
  45. typedef behavior_tree::succeeder<context> succeeder;
  46. typedef behavior_tree::sequence<context> sequence;
  47. typedef behavior_tree::selector<context> selector;
  48. // Actions
  49. status print(context& context, const std::string& text);
  50. status print_eid(context& context);
  51. status warp_to(context& context, float x, float y, float z);
  52. // Conditions
  53. bool is_carrying_food(const context& context);
  54. } // namespace ebt
  55. #endif // ANTKEEPER_EBT_HPP