components.rs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 Consumable {}
  53. #[derive(Component, Debug)]
  54. pub struct Ranged {
  55. pub range : i32
  56. }
  57. #[derive(Component, Debug)]
  58. pub struct InflictsDamage {
  59. pub damage : i32
  60. }
  61. #[derive(Component, Debug)]
  62. pub struct AreaOfEffect {
  63. pub radius : i32
  64. }
  65. #[derive(Component, Debug)]
  66. pub struct Confusion {
  67. pub turns : i32
  68. }
  69. #[derive(Component, Debug)]
  70. pub struct ProvidesHealing {
  71. pub heal_amount : i32
  72. }
  73. #[derive(Component, Debug)]
  74. pub struct InBackpack {
  75. pub owner : Entity
  76. }
  77. #[derive(Component, Debug)]
  78. pub struct WantsToPickupItem {
  79. pub collected_by : Entity,
  80. pub item : Entity
  81. }
  82. #[derive(Component, Debug)]
  83. pub struct WantsToUseItem {
  84. pub item : Entity,
  85. pub target : Option<rltk::Point>
  86. }
  87. #[derive(Component, Debug)]
  88. pub struct WantsToDropItem {
  89. pub item : Entity
  90. }