components.rs 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. }
  17. #[derive(Component, Debug)]
  18. pub struct Player {}
  19. #[derive(Component)]
  20. pub struct Viewshed {
  21. pub visible_tiles : Vec<rltk::Point>,
  22. pub range : i32,
  23. pub dirty : bool
  24. }
  25. #[derive(Component, Debug)]
  26. pub struct Monster {}
  27. #[derive(Component, Debug)]
  28. pub struct Name {
  29. pub name : String
  30. }
  31. #[derive(Component, Debug)]
  32. pub struct BlocksTile {}
  33. #[derive(Component, Debug)]
  34. pub struct CombatStats {
  35. pub max_hp : i32,
  36. pub hp : i32,
  37. pub defense : i32,
  38. pub power : i32
  39. }
  40. #[derive(Component, Debug)]
  41. pub struct WantsToMelee {
  42. pub target : Entity
  43. }
  44. #[derive(Component, Debug)]
  45. pub struct SufferDamage {
  46. pub amount : i32
  47. }