components.rs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. extern crate specs;
  2. use specs::prelude::*;
  3. extern crate specs_derive;
  4. extern crate rltk;
  5. use rltk::{RGB};
  6. #[derive(Component)]
  7. pub struct Position {
  8. pub x: i32,
  9. pub y: i32,
  10. }
  11. #[derive(Component)]
  12. pub struct Renderable {
  13. pub glyph: u8,
  14. pub fg: RGB,
  15. pub bg: RGB,
  16. pub render_order : i32
  17. }
  18. #[derive(Component, Debug)]
  19. pub struct Player {}
  20. #[derive(Component)]
  21. pub struct Viewshed {
  22. pub visible_tiles : Vec<rltk::Point>,
  23. pub range : i32,
  24. pub dirty : bool
  25. }
  26. #[derive(Component, Debug)]
  27. pub struct Monster {}
  28. #[derive(Component, Debug)]
  29. pub struct Name {
  30. pub name : String
  31. }
  32. #[derive(Component, Debug)]
  33. pub struct BlocksTile {}
  34. #[derive(Component, Debug)]
  35. pub struct CombatStats {
  36. pub max_hp : i32,
  37. pub hp : i32,
  38. pub defense : i32,
  39. pub power : i32
  40. }
  41. #[derive(Component, Debug)]
  42. pub struct WantsToMelee {
  43. pub target : Entity
  44. }
  45. #[derive(Component, Debug)]
  46. pub struct SufferDamage {
  47. pub amount : i32
  48. }
  49. #[derive(Component, Debug)]
  50. pub struct Item {}
  51. #[derive(Component, Debug)]
  52. pub struct Potion {
  53. pub heal_amount : i32
  54. }
  55. #[derive(Component, Debug)]
  56. pub struct InBackpack {
  57. pub owner : Entity
  58. }
  59. #[derive(Component, Debug)]
  60. pub struct WantsToPickupItem {
  61. pub collected_by : Entity,
  62. pub item : Entity
  63. }
  64. #[derive(Component, Debug)]
  65. pub struct WantsToDrinkPotion {
  66. pub potion : Entity
  67. }
  68. #[derive(Component, Debug)]
  69. pub struct WantsToDropItem {
  70. pub item : Entity
  71. }