An unofficial collection of APIs used in FreeJam games and mods
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.

37 lines
1.0KB

  1. use crate::techblox::{SerializedEntityDescriptor, Parsable, SerializedEntityComponent, blocks::BlockEntity};
  2. use libfj_parsable_macro_derive::*;
  3. /// Pilot seat entity descriptor (V4)
  4. #[derive(Copy, Clone, Parsable)]
  5. pub struct PilotSeatEntity {
  6. /// parent block entity
  7. pub block: BlockEntity,
  8. /// Seat following camera component
  9. pub cam_component: SeatFollowCamComponent,
  10. }
  11. impl SerializedEntityDescriptor for PilotSeatEntity {
  12. fn serialized_components() -> u8 {
  13. BlockEntity::serialized_components() + 1
  14. }
  15. fn components<'a>(&'a self) -> Vec<&'a dyn SerializedEntityComponent> {
  16. let mut c = self.block.components();
  17. c.push(&self.cam_component);
  18. return c;
  19. }
  20. fn hash_name(&self) -> u32 {
  21. Self::hash("PilotSeatEntityDescriptorV4") // 2281299333
  22. }
  23. }
  24. /// Seat settings entity component.
  25. #[derive(Copy, Clone, Parsable)]
  26. pub struct SeatFollowCamComponent {
  27. /// Should the camera follow the seat? (bool)
  28. pub follow: u8,
  29. }
  30. impl SerializedEntityComponent for SeatFollowCamComponent {}