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.

Moved and started on filter.

AlephCubed d01b9329 87f0d2c3

+62 -22
+2 -17
src/difficulty/lightshow.rs
··· 1 - use crate::loose_enum; 2 - use serde::{Deserialize, Serialize}; 3 - 4 1 pub mod basic; 5 2 pub mod color; 6 3 pub mod easing; 4 + pub mod filter; 7 5 pub mod rotation; 8 6 9 - #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 10 - #[serde(rename_all = "camelCase")] 11 - pub struct Filter { 12 - pub f: i32, 13 - pub p: i32, 14 - pub t: i32, 15 - pub r: i32, 16 - #[serde(rename = "c")] 17 - pub color: i32, 18 - pub n: i32, 19 - pub s: i32, 20 - pub l: i32, 21 - pub d: i32, 22 - } 7 + use crate::loose_enum; 23 8 24 9 loose_enum! { 25 10 /// The distribution value does different things depending on the type.
+2 -1
src/difficulty/lightshow/color.rs
··· 1 + use crate::difficulty::lightshow::DistributionType; 1 2 use crate::difficulty::lightshow::easing::Easing; 2 - use crate::difficulty::lightshow::{DistributionType, Filter}; 3 + use crate::difficulty::lightshow::filter::Filter; 3 4 use crate::loose_enum; 4 5 use crate::macros::LooseBool; 5 6 use serde::{Deserialize, Serialize};
+53
src/difficulty/lightshow/filter.rs
··· 1 + use crate::loose_enum; 2 + use crate::macros::LooseBool; 3 + use serde::{Deserialize, Serialize}; 4 + 5 + /// Controls which light indices are affected by event boxes. 6 + #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 7 + #[serde(rename_all = "camelCase")] 8 + pub struct Filter { 9 + // V3 10 + #[serde(rename = "f")] 11 + pub filter_type: FilterType, 12 + /// Dependent on the [`FilterType`] 13 + #[serde(rename = "p")] 14 + pub parameter1: i32, 15 + /// Dependent on the [`FilterType`] 16 + #[serde(rename = "t")] 17 + pub parameter2: i32, 18 + #[serde(rename = "r")] 19 + pub reverse: LooseBool, 20 + // V3.1 21 + #[serde(rename = "c")] 22 + pub chunks: i32, 23 + #[serde(rename = "n")] 24 + pub random_behaviour: i32, 25 + #[serde(rename = "s")] 26 + pub random_seed: i32, 27 + #[serde(rename = "d")] 28 + pub limit_behaviour: i32, 29 + #[serde(rename = "l")] 30 + pub limit_percent: i32, 31 + } 32 + 33 + loose_enum! { 34 + /// The parameters of a [Filter] do different things depending on the type. 35 + /// 36 + /// ### [Division](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-1): 37 + /// Splits the group up into equal sections and selects one. 38 + /// - Parameter 1 determines the number of sections. 39 + /// It will be rounded up to the nearest multiple of the group size. 40 + /// - Parameter 2 determines the section to select, starting at 0. 41 + /// 42 + /// ### [Step and Offset](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-2): 43 + /// Alternates selecting and not selecting lights. 44 + /// - Parameter 1 is the index of the first light that will be selected, starting at 0. 45 + /// - Parameter 2 determines the number of lights that will be skipped between selections. 46 + #[derive(Default)] 47 + FilterType { 48 + #[default] 49 + //Todo Doesn't match wiki 50 + Division = 1, 51 + StepAndOffset = 2, 52 + } 53 + }
+2 -1
src/difficulty/lightshow/rotation.rs
··· 1 + use crate::difficulty::lightshow::DistributionType; 1 2 use crate::difficulty::lightshow::easing::Easing; 2 - use crate::difficulty::lightshow::{DistributionType, Filter}; 3 + use crate::difficulty::lightshow::filter::Filter; 3 4 use crate::loose_enum; 4 5 use crate::macros::LooseBool; 5 6 use serde::{Deserialize, Serialize};
+3 -3
src/info.rs
··· 31 31 #[serde(rename = "_coverImageFilename")] 32 32 pub cover_image_file: String, 33 33 #[serde(rename = "_environmentName")] 34 - pub environment: String, 34 + pub environment: Environment, 35 35 #[serde(rename = "_allDirectionsEnvironmentName")] 36 - pub all_directions_environment: String, 36 + pub all_directions_environment: AllDirectionEnvironment, 37 37 #[serde(rename = "_environmentNames")] 38 - pub environments: Vec<Value>, 38 + pub environments: Vec<Environment>, 39 39 #[serde(rename = "_colorSchemes")] 40 40 pub color_schemes: Vec<Value>, // Todo 41 41 #[serde(rename = "_difficultyBeatmapSets")]