Beatsaber Rust Utilities: A Beatsaber V3 parsing library.
beatsaber beatmap
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Even more documentation.

Also renamed the `boxes` module to `group`.

+61 -9
+5
src/difficulty/gameplay_event.rs
··· 11 11 reflect(Debug, Clone, PartialEq) 12 12 )] 13 13 pub struct LaneRotationEvent { 14 + /// The time the event takes place. 14 15 #[serde(rename = "b")] 15 16 pub beat: f32, 16 17 #[serde(rename = "e")] 17 18 pub execution_time: ExecutionTime, 19 + /// The number of degrees to rotate objects around the player. 18 20 #[serde(rename = "r")] 19 21 pub degrees: f32, 20 22 } ··· 33 35 } 34 36 ); 35 37 38 + /// Changes the BPM of the map at a specific beat. 36 39 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 37 40 #[cfg_attr( 38 41 feature = "bevy_reflect", ··· 40 43 reflect(Debug, Clone, PartialEq) 41 44 )] 42 45 pub struct BpmEvent { 46 + /// The time the event takes place. 43 47 #[serde(rename = "b")] 44 48 pub beat: f32, 49 + /// The BPM to change the map too. 45 50 #[serde(rename = "m")] 46 51 pub bpm: f32, 47 52 }
+2 -2
src/difficulty/lightshow.rs
··· 1 1 //! Events that have no effect on gameplay. 2 2 3 3 pub mod basic; 4 - pub mod boxes; 5 4 pub mod easing; 6 5 pub mod filter; 6 + pub mod group; 7 7 8 8 pub use basic::*; 9 - pub use boxes::*; 10 9 pub use easing::*; 11 10 pub use filter::*; 11 + pub use group::*; 12 12 13 13 use crate::loose_enum; 14 14
+2
src/difficulty/lightshow/basic.rs
··· 1 + //! The non-group events that were inherited from difficulty file V2. 2 + 1 3 use crate::difficulty::playfield::CutDirection; 2 4 use crate::impl_timed; 3 5 use serde::{Deserialize, Serialize};
+6 -3
src/difficulty/lightshow/boxes.rs src/difficulty/lightshow/group.rs
··· 1 + //! The advanced group lighting system events. 2 + 1 3 pub mod color; 2 4 pub mod rotation; 3 5 pub mod translation; ··· 21 23 #[doc(hidden)] 22 24 macro_rules! impl_event_box { 23 25 ($ident:ident, $group:ident, $data:ident) => { 24 - impl crate::difficulty::lightshow::boxes::EventBox for $ident { 26 + impl crate::difficulty::lightshow::group::EventBox for $ident { 25 27 type Group = $group; 26 28 type Data = $data; 27 29 ··· 60 62 #[doc(hidden)] 61 63 macro_rules! impl_event_group { 62 64 ($ident:ident::$value_offset:ident, $data:ident) => { 63 - impl crate::difficulty::lightshow::boxes::EventGroup for $ident { 65 + impl crate::difficulty::lightshow::group::EventGroup for $ident { 64 66 type Data = $data; 65 67 66 68 fn get_filter(&self) -> &Filter { ··· 93 95 94 96 /// The lowest-level group event type, which determines the base value of the event. 95 97 pub trait EventData { 98 + /// Returns the number of beats the event will be offset from the [`EventBox`]'s beat. 96 99 fn get_beat_offset(&self) -> f32; 97 100 } 98 101 ··· 100 103 #[doc(hidden)] 101 104 macro_rules! impl_event_data { 102 105 ($ident:ident) => { 103 - impl crate::difficulty::lightshow::boxes::EventData for $ident { 106 + impl crate::difficulty::lightshow::group::EventData for $ident { 104 107 fn get_beat_offset(&self) -> f32 { 105 108 self.beat_offset 106 109 }
+13 -1
src/difficulty/lightshow/boxes/color.rs src/difficulty/lightshow/group/color.rs
··· 1 + //! Events that control the color of lights. 2 + 1 3 use crate::difficulty::lightshow::DistributionType; 2 4 use crate::difficulty::lightshow::easing::Easing; 3 5 use crate::difficulty::lightshow::filter::Filter; ··· 13 15 reflect(Debug, Clone, PartialEq) 14 16 )] 15 17 pub struct ColorEventBox { 18 + /// The time the event takes place. 16 19 #[serde(rename = "b")] 17 20 pub beat: f32, 21 + /// The ID of the collection of objects that this event effects. 18 22 #[serde(rename = "g")] 19 23 pub group_id: i32, 20 24 #[serde(rename = "e")] ··· 46 50 pub filter: Filter, 47 51 #[serde(rename = "d")] 48 52 pub beat_dist_type: DistributionType, 53 + /// The strength of the beat distribution. Dependent on the [distribution type](Self::beat_dist_type). 54 + /// 55 + /// A value of zero will have no effect. 49 56 #[serde(rename = "w")] 50 57 pub beat_dist_value: f32, 58 + /// The strength of the brightness distribution. Dependent on the [distribution type](Self::bright_dist_type). 59 + /// 60 + /// A value of zero will have no effect. 51 61 #[serde(rename = "t")] 52 62 pub bright_dist_type: DistributionType, 53 63 #[serde(rename = "r")] 54 64 pub bright_dist_value: f32, 65 + /// Whether the first [`ColorEventData`] of the group will be effected by brightness distribution. 55 66 #[serde(rename = "b")] 56 67 pub bright_dist_effect_first: LooseBool, 57 68 /// > Only present in difficulty file V3.2 or higher. ··· 106 117 reflect(Debug, Clone, PartialEq) 107 118 )] 108 119 pub struct ColorEventData { 120 + /// The number of beats the event will be offset from the [`ColorEventBox`]'s beat. 109 121 #[serde(rename = "b")] 110 122 pub beat_offset: f32, 111 123 #[serde(rename = "i")] ··· 165 177 #[cfg(test)] 166 178 mod tests { 167 179 use super::*; 168 - use crate::difficulty::lightshow::boxes::EventGroup; 169 180 use crate::difficulty::lightshow::filter::FilterType; 181 + use crate::difficulty::lightshow::group::EventGroup; 170 182 171 183 #[test] 172 184 fn beat_wave() {
+14 -1
src/difficulty/lightshow/boxes/rotation.rs src/difficulty/lightshow/group/rotation.rs
··· 1 - use crate::difficulty::lightshow::boxes::EventData; 1 + //! Events that control the rotation of objects. 2 + 2 3 use crate::difficulty::lightshow::easing::Easing; 3 4 use crate::difficulty::lightshow::filter::Filter; 5 + use crate::difficulty::lightshow::group::EventData; 4 6 use crate::difficulty::lightshow::{DistributionType, EventAxis, TransitionType}; 5 7 use crate::utils::LooseBool; 6 8 use crate::{impl_event_box, impl_event_group, impl_timed, loose_enum}; ··· 14 16 reflect(Debug, Clone, PartialEq) 15 17 )] 16 18 pub struct RotationEventBox { 19 + /// The time the event takes place. 17 20 #[serde(rename = "b")] 18 21 pub beat: f32, 22 + /// The ID of the collection of objects that this event effects. 19 23 #[serde(rename = "g")] 20 24 pub group_id: i32, 21 25 #[serde(rename = "e")] ··· 47 51 pub filter: Filter, 48 52 #[serde(rename = "d")] 49 53 pub beat_dist_type: DistributionType, 54 + /// The strength of the beat distribution. Dependent on the [distribution type](Self::beat_dist_type). 55 + /// 56 + /// A value of zero will have no effect. 50 57 #[serde(rename = "w")] 51 58 pub beat_dist_value: f32, 52 59 #[serde(rename = "t")] 53 60 pub rotation_dist_type: DistributionType, 61 + /// The strength of the rotation distribution. Dependent on the [distribution type](Self::rotation_dist_type). 62 + /// 63 + /// A value of zero will have no effect. 54 64 #[serde(rename = "s")] 55 65 pub rotation_dist_value: f32, 66 + /// Whether the first [`RotationEventData`] of the group will be effected by rotation distribution. 56 67 #[serde(rename = "b")] 57 68 pub rotation_dist_effect_first: LooseBool, 58 69 /// > Only present in difficulty file V3.2 or higher. ··· 114 125 reflect(Debug, Clone, PartialEq) 115 126 )] 116 127 pub struct RotationEventData { 128 + /// The number of beats the event will be offset from the [`RotationEventBox`]'s beat. 117 129 #[serde(rename = "b")] 118 130 pub beat_offset: f32, 119 131 #[serde(rename = "p")] 120 132 pub transition_type: TransitionType, 121 133 #[serde(rename = "e")] 122 134 pub easing: Easing, 135 + /// The base number of degrees the event will rotate objects by. 123 136 #[serde(rename = "r")] 124 137 pub degrees: f32, 125 138 #[serde(rename = "o")]
+14 -1
src/difficulty/lightshow/boxes/translation.rs src/difficulty/lightshow/group/translation.rs
··· 1 - use crate::difficulty::lightshow::boxes::EventData; 1 + //! Events that control the translation/position of objects. 2 + 2 3 use crate::difficulty::lightshow::easing::Easing; 3 4 use crate::difficulty::lightshow::filter::Filter; 5 + use crate::difficulty::lightshow::group::EventData; 4 6 use crate::difficulty::lightshow::{DistributionType, EventAxis, TransitionType}; 5 7 use crate::utils::LooseBool; 6 8 use crate::{impl_event_box, impl_event_group, impl_timed}; ··· 14 16 reflect(Debug, Clone, PartialEq) 15 17 )] 16 18 pub struct TranslationEventBox { 19 + /// The time the event takes place. 17 20 #[serde(rename = "b")] 18 21 pub beat: f32, 22 + /// The ID of the collection of objects that this event effects. 19 23 #[serde(rename = "g")] 20 24 pub group_id: i32, 21 25 #[serde(rename = "e")] ··· 51 55 pub filter: Filter, 52 56 #[serde(rename = "d")] 53 57 pub beat_dist_type: DistributionType, 58 + /// The strength of the beat distribution. Dependent on the [beat distribution type](Self::beat_dist_type). 59 + /// 60 + /// A value of zero will have no effect. 54 61 #[serde(rename = "w")] 55 62 pub beat_dist_value: f32, 56 63 #[serde(rename = "t")] 57 64 pub translation_dist_type: DistributionType, 65 + /// The strength of the translation distribution. Dependent on the [distribution type](Self::translation_dist_type). 66 + /// 67 + /// A value of zero will have no effect. 58 68 #[serde(rename = "s")] 59 69 pub translation_dist_value: f32, 70 + /// Whether the first [`TranslationEventData`] of the group will be effected by translation distribution. 60 71 #[serde(rename = "b")] 61 72 pub translation_dist_effect_first: LooseBool, 62 73 #[serde(rename = "i")] ··· 120 131 reflect(Debug, Clone, PartialEq) 121 132 )] 122 133 pub struct TranslationEventData { 134 + /// The number of beats the event will be offset from the [`TranslationEventBox`]'s beat. 123 135 #[serde(rename = "b")] 124 136 pub beat_offset: f32, 125 137 #[serde(rename = "p")] 126 138 pub transition_type: TransitionType, 127 139 #[serde(rename = "e")] 128 140 pub easing: Easing, 141 + /// The base number of units the event will offset objects by. 129 142 #[serde(rename = "t")] 130 143 pub value: f32, 131 144 }
+2
src/difficulty/lightshow/easing.rs
··· 1 + //! The easing that a [transition](crate::lightshow::TransitionType::Transition) event will use. 2 + 1 3 use crate::loose_enum; 2 4 use simple_easing::*; 3 5
+3 -1
src/difficulty/lightshow/filter.rs
··· 1 + //! Controls which light IDs are affected by an event. 2 + 1 3 use crate::loose_enum; 2 4 use crate::utils::LooseBool; 3 5 use serde::{Deserialize, Serialize}; 4 6 5 - /// Controls which light IDs are affected by an event box. 7 + /// Controls which light IDs are affected by an event. 6 8 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 7 9 #[cfg_attr( 8 10 feature = "bevy_reflect",