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.

35 lines
1.0KB

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