object_properties.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <string>
  18. #include "irrlichttypes_bloated.h"
  19. #include <iostream>
  20. #include <map>
  21. #include <vector>
  22. #include "util/Optional.h"
  23. struct ObjectProperties
  24. {
  25. u16 hp_max = 1;
  26. u16 breath_max = 0;
  27. bool physical = false;
  28. bool collideWithObjects = true;
  29. // Values are BS=1
  30. aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
  31. aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
  32. bool rotate_selectionbox = false;
  33. bool pointable = true;
  34. std::string visual = "sprite";
  35. std::string mesh = "";
  36. v3f visual_size = v3f(1, 1, 1);
  37. std::vector<std::string> textures;
  38. std::string damage_texture_modifier = "^[brighten";
  39. std::vector<video::SColor> colors;
  40. v2s16 spritediv = v2s16(1, 1);
  41. v2s16 initial_sprite_basepos;
  42. bool is_visible = true;
  43. bool makes_footstep_sound = false;
  44. f32 stepheight = 0.0f;
  45. float automatic_rotate = 0.0f;
  46. bool automatic_face_movement_dir = false;
  47. f32 automatic_face_movement_dir_offset = 0.0f;
  48. bool backface_culling = true;
  49. s8 glow = 0;
  50. std::string nametag = "";
  51. video::SColor nametag_color = video::SColor(255, 255, 255, 255);
  52. Optional<video::SColor> nametag_bgcolor = nullopt;
  53. f32 automatic_face_movement_max_rotation_per_sec = -1.0f;
  54. std::string infotext;
  55. //! For dropped items, this contains item information.
  56. std::string wield_item;
  57. bool static_save = true;
  58. float eye_height = 1.625f;
  59. float zoom_fov = 0.0f;
  60. bool use_texture_alpha = false;
  61. bool shaded = true;
  62. bool show_on_minimap = false;
  63. ObjectProperties();
  64. std::string dump();
  65. // check limits of some important properties (strings) that'd cause exceptions later on
  66. bool validate();
  67. void serialize(std::ostream &os) const;
  68. void deSerialize(std::istream &is);
  69. };