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.

45 lines
1.4KB

  1. use crate::techblox::{UnityFloat3, UnityQuaternion, SerializedEntityComponent, SerializedEntityDescriptor, Parsable};
  2. use libfj_parsable_macro_derive::*;
  3. /// Block group entity descriptor.
  4. #[derive(Clone, Copy, Parsable)]
  5. pub struct BlockGroupEntity {
  6. /// Block group identifier
  7. pub saved_block_group_id: SavedBlockGroupIdComponent,
  8. /// Block group location information
  9. pub block_group_transform: BlockGroupTransformEntityComponent,
  10. }
  11. impl BlockGroupEntity {}
  12. impl SerializedEntityDescriptor for BlockGroupEntity {
  13. fn serialized_components() -> u8 {
  14. 2
  15. }
  16. fn components<'a>(&'a self) -> Vec<&'a dyn SerializedEntityComponent> {
  17. vec![&self.saved_block_group_id,
  18. &self.block_group_transform]
  19. }
  20. }
  21. /// Saved block group identifier entity component.
  22. #[derive(Clone, Copy, Parsable)]
  23. pub struct SavedBlockGroupIdComponent {
  24. /// Block group identifier
  25. pub saved_block_group_id: i32,
  26. }
  27. impl SerializedEntityComponent for SavedBlockGroupIdComponent {}
  28. /// Block group entity component for storing position and rotation.
  29. #[derive(Clone, Copy, Parsable)]
  30. pub struct BlockGroupTransformEntityComponent {
  31. /// Block group position
  32. pub block_group_grid_position: UnityFloat3,
  33. /// Block group rotation
  34. pub block_group_grid_rotation: UnityQuaternion,
  35. }
  36. impl SerializedEntityComponent for BlockGroupTransformEntityComponent {}