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.

Some event documentation.

+47 -3
+21
src/difficulty/lightshow/basic.rs
··· 2 2 use crate::impl_timed; 3 3 use serde::{Deserialize, Serialize}; 4 4 5 + /// The basic V2 event type, which is still used for some elements of V3 environments (for example, the player platform). 5 6 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 6 7 #[cfg_attr( 7 8 feature = "bevy_reflect", ··· 9 10 reflect(Debug, Clone, PartialEq) 10 11 )] 11 12 pub struct BasicEvent { 13 + /// The time the event takes place. 12 14 #[serde(rename = "b")] 13 15 pub beat: f32, 16 + /// Determines the behaviour of the event. The exact behaviour differs depending on the environment. 17 + /// 14 18 /// More info [here](https://bsmg.wiki/mapping/map-format/lightshow.html#basic-events-type). 15 19 #[serde(rename = "et")] 16 20 pub event_type: i32, 21 + /// Determines which effect the event will produce, based on its [type](Self::event_type). 17 22 #[serde(rename = "i")] 18 23 pub value: i32, 24 + /// Modifies the effect. 19 25 #[serde(rename = "f")] 20 26 pub float: f32, 21 27 } 22 28 23 29 impl_timed!(BasicEvent::beat); 24 30 31 + /// Controls the TinyTAN figures on the [BTS environment](crate::info::Environment::BTS). 32 + /// 33 + /// More info [here](https://bsmg.wiki/mapping/map-format/lightshow.html#waypoints). 25 34 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 26 35 #[cfg_attr( 27 36 feature = "bevy_reflect", ··· 29 38 reflect(Debug, Clone, PartialEq) 30 39 )] 31 40 pub struct Waypoint { 41 + /// The time the event takes place. 32 42 #[serde(rename = "b")] 33 43 pub beat: f32, 44 + /// A value representing the vertical position of the event. 45 + /// In the range 0..2 inclusive, with zero being the bottom and two being the top row. 34 46 #[serde(rename = "y")] 35 47 pub row: u8, 48 + /// A value representing the horizontal position of the event. 49 + /// In the range 0..3 inclusive, with zero being the far left and three being the far right column. 36 50 #[serde(rename = "x")] 37 51 pub col: u8, 38 52 #[serde(rename = "d")] ··· 41 55 42 56 impl_timed!(Waypoint::beat); 43 57 58 + /// Controls which lighting colors are used, based on a map or environment's [color scheme](crate::info::color_scheme::ColorScheme). 44 59 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 45 60 #[cfg_attr( 46 61 feature = "bevy_reflect", ··· 48 63 reflect(Debug, Clone, PartialEq) 49 64 )] 50 65 pub struct ColorBoostEvent { 66 + /// The time the event takes place. 51 67 #[serde(rename = "b")] 52 68 pub beat: f32, 69 + /// Whether to enable or disable boost colors. 53 70 #[serde(rename = "o")] 54 71 pub boost: bool, 55 72 } ··· 57 74 impl_timed!(ColorBoostEvent::beat); 58 75 59 76 /// An event containing an array of Special Event Keywords. 77 + /// 60 78 /// More info [here](https://bsmg.wiki/mapping/map-format/lightshow.html#special-event-keywords). 61 79 #[doc(alias = "KeywordEvent")] 62 80 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] ··· 71 89 } 72 90 73 91 /// Allows basic event lanes to be overridden with environment-specific behaviour, using secret keys. 92 + /// 74 93 /// More info [here](https://bsmg.wiki/mapping/map-format/lightshow.html#special-event-keywords). 75 94 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 76 95 #[cfg_attr( ··· 79 98 reflect(Debug, Clone, PartialEq) 80 99 )] 81 100 pub struct Keyword { 101 + /// The secret key of the effect. 82 102 #[serde(rename = "k")] 83 103 pub keyword: String, 104 + /// A list of [event types](BasicEvent::event_type) to effect with the keyword. 84 105 #[serde(rename = "e")] 85 106 pub event_types: Vec<i32>, 86 107 }
+4 -1
src/difficulty/lightshow/boxes.rs
··· 9 9 use crate::difficulty::lightshow::filter::Filter; 10 10 use crate::timing_traits::Timed; 11 11 12 + /// A collection of [`EventGroup`]s that share the same group ID and beat. 12 13 pub trait EventBox: Timed { 13 14 type Group: EventGroup<Data = Self::Data>; 14 15 type Data: EventData; ··· 31 32 }; 32 33 } 33 34 35 + /// A collection of [`EventData`] that share the same [`Filter`] and distribution. 34 36 pub trait EventGroup { 35 37 type Data: EventData; 36 38 ··· 45 47 )] 46 48 fn get_beat_offset(&self, light_id: i32, group_size: i32) -> f32; 47 49 48 - /// Returns the value that the event will be offset for a given light ID (i.e. brightness offset). 50 + /// Returns the value (i.e. brightness) that the event will be offset for a given light ID. 49 51 /// # Panics 50 52 /// Will panic if the light ID is greater than or equal to the group size. 51 53 #[deprecated( ··· 89 91 }; 90 92 } 91 93 94 + /// The lowest-level group event type, which determines the base value of the event. 92 95 pub trait EventData { 93 96 fn get_beat_offset(&self) -> f32; 94 97 }
+13 -2
src/difficulty/lightshow/boxes/color.rs
··· 5 5 use crate::{impl_event_box, impl_event_data, impl_event_group, impl_timed, loose_enum}; 6 6 use serde::{Deserialize, Serialize}; 7 7 8 + /// A collection of [`ColorEventGroup`]s that share the same group ID and beat. 8 9 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 9 10 #[cfg_attr( 10 11 feature = "bevy_reflect", ··· 33 34 impl_timed!(ColorEventBox::beat); 34 35 impl_event_box!(ColorEventBox, ColorEventGroup, ColorEventData); 35 36 37 + /// A collection of [`ColorEventData`] that share the same [`Filter`] and distribution. 36 38 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 37 39 #[cfg_attr( 38 40 feature = "bevy_reflect", ··· 96 98 } 97 99 } 98 100 101 + /// The lowest-level group event type, which determines the color of the event. 99 102 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 100 103 #[cfg_attr( 101 104 feature = "bevy_reflect", ··· 111 114 pub color: LightColor, 112 115 #[serde(rename = "s")] 113 116 pub brightness: f32, 117 + /// Determines the number of strobes that will take place each beat. 118 + /// A value of zero will result in no strobing. 114 119 #[serde(rename = "f")] 115 120 pub strobe_frequency: i32, 116 121 } ··· 130 135 impl_event_data!(ColorEventData); 131 136 132 137 loose_enum! { 138 + /// Controls how the state is changed relative to the previous event. 133 139 #[derive(Default, Copy)] 134 140 ColorTransitionType: i32 { 135 - /// Replaced with `Transition` and [`Easing::None`] in difficulty file V3.2 or higher. 141 + /// Unique to color events. 142 + /// Has the same effect as using [`TransitionType::Transition`](crate::lightshow::TransitionType::Transition) 143 + /// and [`Easing::None`] in rotation/translation events. 144 + #[default] 136 145 Instant = 0, 137 - #[default] 146 + /// The state will blend from the previous event's state, using the events [easing](Easing). 138 147 Transition = 1, 148 + /// The event's state will be ignored, replaced with the state from the previous event. 139 149 Extend = 2, 140 150 } 141 151 } 142 152 143 153 loose_enum! { 154 + /// Controls which color to display, based on a map or environment's [color scheme](crate::info::color_scheme::ColorScheme). 144 155 #[derive(Default, Copy)] 145 156 LightColor: i32 { 146 157 #[default]
+5
src/difficulty/lightshow/boxes/rotation.rs
··· 6 6 use crate::{impl_event_box, impl_event_group, impl_timed, loose_enum}; 7 7 use serde::{Deserialize, Serialize}; 8 8 9 + /// A collection of [`RotationEventGroup`]s that share the same group ID and beat. 9 10 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 10 11 #[cfg_attr( 11 12 feature = "bevy_reflect", ··· 34 35 impl_timed!(RotationEventBox::beat); 35 36 impl_event_box!(RotationEventBox, RotationEventGroup, RotationEventData); 36 37 38 + /// A collection of [`RotationEventData`] that share the same [`EventAxis`], [`Filter`], and distribution. 37 39 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 38 40 #[cfg_attr( 39 41 feature = "bevy_reflect", ··· 58 60 pub rotation_dist_easing: Option<Easing>, 59 61 #[serde(rename = "a")] 60 62 pub axis: EventAxis, 63 + /// If true, the rotation will be mirrored. 61 64 #[serde(rename = "r")] 62 65 pub invert_axis: LooseBool, 63 66 #[serde(rename = "l")] ··· 103 106 } 104 107 } 105 108 109 + /// The lowest-level group event type, which determines the base rotation of the event. 106 110 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 107 111 #[cfg_attr( 108 112 feature = "bevy_reflect", ··· 120 124 pub degrees: f32, 121 125 #[serde(rename = "o")] 122 126 pub direction: RotationDirection, 127 + /// Extends the rotation by 360 degrees in the [`RotationDirection`]. 123 128 #[serde(rename = "l")] 124 129 pub loops: i32, 125 130 }
+4
src/difficulty/lightshow/boxes/translation.rs
··· 6 6 use crate::{impl_event_box, impl_event_group, impl_timed}; 7 7 use serde::{Deserialize, Serialize}; 8 8 9 + /// A collection of [`TranslationEventGroup`]s that share the same group ID and beat. 9 10 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 10 11 #[cfg_attr( 11 12 feature = "bevy_reflect", ··· 38 39 TranslationEventData 39 40 ); 40 41 42 + /// A collection of [`TranslationEventData`] that share the same [`EventAxis`], [`Filter`], and distribution. 41 43 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 42 44 #[cfg_attr( 43 45 feature = "bevy_reflect", ··· 61 63 pub translation_dist_easing: Easing, 62 64 #[serde(rename = "a")] 63 65 pub axis: EventAxis, 66 + /// If true, the translation will be mirrored. 64 67 #[serde(rename = "r")] 65 68 pub invert_axis: LooseBool, 66 69 #[serde(rename = "l")] ··· 109 112 } 110 113 } 111 114 115 + /// The lowest-level group event type, which determines the base position of the event. 112 116 #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 113 117 #[cfg_attr( 114 118 feature = "bevy_reflect",