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.

Documentation improvements.

AlephCubed f4fb9d8f 47d8db38

+45 -12
+1 -1
src/difficulty.rs
··· 41 41 pub color_event_boxes: Vec<ColorEventBox>, 42 42 #[serde(rename = "lightRotationEventBoxGroups")] 43 43 pub rotation_event_boxes: Vec<RotationEventBox>, 44 - /// Only present in difficulty file V3.2 or higher. 44 + /// > Only present in difficulty file V3.2 or higher. 45 45 #[serde(rename = "lightTranslationEventBoxGroups")] 46 46 pub translation_event_boxes: Option<Vec<TranslationEventBox>>, 47 47 #[doc(alias = "keyword_events")]
+7
src/difficulty/lightshow/boxes.rs
··· 32 32 fn get_filter(&self) -> &Filter; 33 33 fn get_data(&self) -> &Vec<Self::Data>; 34 34 35 + /// Returns the number of beats that the event will be offset for a given light ID. 36 + /// # Panics 37 + /// Will panic if the light ID is greater than or equal to the group size. 35 38 fn get_beat_offset(&self, light_id: i32, group_size: i32) -> f32; 39 + 40 + /// Returns the value that the event will be offset for a given light ID (i.e. brightness offset). 41 + /// # Panics 42 + /// Will panic if the light ID is greater than or equal to the group size. 36 43 fn get_value_offset(&self, light_id: i32, group_size: i32) -> f32; 37 44 } 38 45
+4 -1
src/difficulty/lightshow/boxes/color.rs
··· 52 52 pub bright_dist_value: f32, 53 53 #[serde(rename = "b")] 54 54 pub bright_dist_effect_first: LooseBool, 55 - /// Only present in difficulty file V3.2 or higher. 55 + /// > Only present in difficulty file V3.2 or higher. 56 56 #[serde(rename = "i")] 57 57 pub bright_dist_easing: Option<Easing>, 58 58 #[serde(rename = "e")] ··· 77 77 impl_event_group!(ColorEventGroup::get_brightness_offset, ColorEventData); 78 78 79 79 impl ColorEventGroup { 80 + /// Returns the brightness that the event will be offset for a given light ID. 81 + /// # Panics 82 + /// Will panic if the light ID is greater than or equal to the group size. 80 83 pub fn get_brightness_offset(&self, light_id: i32, group_size: i32) -> f32 { 81 84 self.bright_dist_type.compute_offset( 82 85 light_id,
+4 -1
src/difficulty/lightshow/boxes/rotation.rs
··· 53 53 pub rotation_dist_value: f32, 54 54 #[serde(rename = "b")] 55 55 pub rotation_dist_effect_first: LooseBool, 56 - /// Only present in difficulty file V3.2 or higher. 56 + /// > Only present in difficulty file V3.2 or higher. 57 57 #[serde(rename = "i")] 58 58 pub rotation_dist_easing: Option<Easing>, 59 59 #[serde(rename = "a")] ··· 84 84 impl_event_group!(RotationEventGroup::get_rotation_offset, RotationEventData); 85 85 86 86 impl RotationEventGroup { 87 + /// Returns the number of degrees that the event will be offset for a given light ID. 88 + /// # Panics 89 + /// Will panic if the light ID is greater than or equal to the group size. 87 90 pub fn get_rotation_offset(&self, light_id: i32, group_size: i32) -> f32 { 88 91 self.rotation_dist_type.compute_offset( 89 92 light_id,
+3
src/difficulty/lightshow/boxes/translation.rs
··· 90 90 ); 91 91 92 92 impl TranslationEventGroup { 93 + /// Returns the number of units that the event will be offset for a given light ID. 94 + /// # Panics 95 + /// Will panic if the light ID is greater than or equal to the group size. 93 96 pub fn get_translation_offset(&self, light_id: i32, group_size: i32) -> f32 { 94 97 self.translation_dist_type.compute_offset( 95 98 light_id,
+4
src/difficulty/lightshow/easing.rs
··· 46 46 } 47 47 48 48 impl Easing { 49 + /// Applies the relevant easing function. 50 + /// 51 + /// The Beatsaber specific easing use the standard equivalent instead. 52 + /// If the easing is [`None`](Self::None) or [`Unknown`](Self::Unknown), then the result will be zero. 49 53 pub fn ease(&self, num: f32) -> f32 { 50 54 match self { 51 55 Easing::None => 0.0,
+16 -6
src/difficulty/lightshow/filter.rs
··· 22 22 #[serde(rename = "r")] 23 23 pub reverse: LooseBool, 24 24 // V3.1: 25 - /// Only present in difficulty file V3.1 or higher. 25 + /// > Only present in difficulty file V3.1 or higher. 26 + /// 27 + /// Chunks will divide the group into multiple chunks, which will each behave as a single object. 28 + /// 29 + /// To see this in practice, check out [this video](https://youtube.com/watch?v=NJPPBvyHJjg&t=197). 26 30 #[serde(rename = "c")] 27 31 pub chunks: Option<i32>, 28 - /// Only present in difficulty file V3.1 or higher. 32 + /// > Only present in difficulty file V3.1 or higher. 29 33 #[serde(rename = "n")] 30 34 pub random_behaviour: Option<RandomBehaviour>, 31 - /// Only present in difficulty file V3.1 or higher. 35 + /// > Only present in difficulty file V3.1 or higher. 32 36 #[serde(rename = "s")] 33 37 pub random_seed: Option<i32>, 34 - /// Only present in difficulty file V3.1 or higher. 38 + /// > Only present in difficulty file V3.1 or higher. 39 + /// 40 + /// Determines how [the limit](Filter::limit_percent) behaves. This is applied *after* the [`FilterType`] behaviour. 41 + /// 42 + /// To see this in practice, check out [this video](https://youtube.com/watch?v=NJPPBvyHJjg&t=338). 35 43 #[serde(rename = "d")] 36 44 pub limit_behaviour: Option<LimitBehaviour>, 37 - /// Only present in difficulty file V3.1 or higher. 45 + /// > Only present in difficulty file V3.1 or higher. 46 + /// 47 + /// A value from 0.0 to 1.0 which represents the percent of lights that will be effected, 48 + /// and the behaviour is dependent on [`LimitBehaviour`]. 38 49 #[serde(rename = "l")] 39 50 pub limit_percent: Option<f32>, 40 51 } ··· 46 57 parameter1: 1, 47 58 parameter2: 0, 48 59 reverse: LooseBool::False, 49 - // Todo 50 60 chunks: Some(1), 51 61 random_behaviour: Some(RandomBehaviour::None), 52 62 random_seed: Some(0),
+3 -3
src/info.rs
··· 41 41 pub environment: Environment, 42 42 #[serde(rename = "_allDirectionsEnvironmentName")] 43 43 pub all_directions_environment: AllDirectionEnvironment, 44 - /// Only present in info file V2.1 or higher. 44 + /// > Only present in info file V2.1 or higher. 45 45 #[serde(rename = "_environmentNames")] 46 46 pub environments: Option<Vec<Environment>>, 47 - /// Only present in info file V2.1 or higher. 47 + /// > Only present in info file V2.1 or higher. 48 48 #[serde(rename = "_colorSchemes")] 49 49 pub color_schemes: Option<Vec<ColorSchemeOverride>>, 50 50 #[serde(rename = "_difficultyBeatmapSets")] ··· 161 161 #[doc(alias = "node_jump_distance")] 162 162 #[serde(rename = "_noteJumpStartBeatOffset")] 163 163 pub njd: f32, 164 - /// Only present in info file V2.1 or higher. 164 + /// > Only present in info file V2.1 or higher. 165 165 #[serde(rename = "_beatmapColorSchemeIdx")] 166 166 pub color_scheme_index: Option<i32>, 167 167 }
+3
src/timing_traits.rs
··· 1 1 /// Represents any beatmap object that happens at a specific beat. 2 2 pub trait Timed { 3 + /// Returns the beat that an object takes place. 3 4 fn get_beat(&self) -> f32; 4 5 } 5 6 6 7 /// Represents any beatmap object that happens over a duration of time in beats. 7 8 pub trait Duration: Timed { 9 + /// Returns the beat that an object ends. 8 10 fn get_end_beat(&self) -> f32; 11 + /// Returns the length (in beats) that an object takes place. 9 12 fn get_duration(&self) -> f32; 10 13 } 11 14