💿🐜 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.

74 lines
2.2 KiB

  1. /*
  2. * Copyright (C) 2021 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. #include "nest.hpp"
  20. #include "../../nest.hpp"
  21. #include "math/math.hpp"
  22. namespace entity {
  23. namespace system {
  24. nest::nest(entity::registry& registry, ::resource_manager* resource_manager):
  25. updatable(registry),
  26. resource_manager(resource_manager)
  27. {
  28. registry.on_construct<component::nest>().connect<&nest::on_nest_construct>(this);
  29. registry.on_destroy<component::nest>().connect<&nest::on_nest_destroy>(this);
  30. }
  31. nest::~nest()
  32. {}
  33. void nest::update(double t, double dt)
  34. {}
  35. void nest::on_nest_construct(entity::registry& registry, entity::id entity_id, component::nest& component)
  36. {
  37. /*
  38. // Allocate a nest
  39. ::nest* nest = new ::nest();
  40. // Setup initial nest parameters
  41. nest->set_tunnel_radius(1.15f);
  42. nest::shaft* central_shaft = nest->get_central_shaft();
  43. central_shaft->chirality = -1.0f;
  44. central_shaft->rotation = math::radians(0.0f);
  45. central_shaft->depth = {0.0f, 100.0f};
  46. central_shaft->current_depth = 0.0f;
  47. central_shaft->radius = {0.0f, 5.0f};
  48. central_shaft->pitch = {4.0f, 8.0f};
  49. central_shaft->translation = {{{0.0f, 0.0f}, {20.0f, 11.0f}}};
  50. for (std::size_t i = 0; i < 4; ++i)
  51. {
  52. nest::chamber chamber;
  53. chamber.shaft = central_shaft;
  54. chamber.depth = (i + 1) * 23.0f;
  55. chamber.rotation = math::radians(0.0f);
  56. chamber.inner_radius = 4.0f;
  57. chamber.outer_radius = 10.0f;
  58. central_shaft->chambers.push_back(chamber);
  59. }
  60. */
  61. }
  62. void nest::on_nest_destroy(entity::registry& registry, entity::id entity_id)
  63. {}
  64. } // namespace system
  65. } // namespace entity