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.

at dev 69 lines 2.0 kB view raw
1//! Events that effect gameplay and aren't purely visual. 2 3use crate::impl_timed; 4use loose_enum::loose_enum; 5use serde::{Deserialize, Serialize}; 6 7/// Controls the rotation that interactable objects spawn in 90/360 degree difficulties. 8#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] 9#[cfg_attr( 10 feature = "bevy_reflect", 11 derive(bevy_reflect::Reflect), 12 reflect(Debug, Clone, PartialEq) 13)] 14pub struct LaneRotationEvent { 15 /// The time the event takes place. 16 #[serde(rename = "b")] 17 pub beat: f32, 18 #[serde(rename = "e")] 19 pub execution_time: ExecutionTime, 20 /// The number of degrees to rotate objects around the player. 21 #[serde(rename = "r")] 22 pub degrees: f32, 23} 24 25impl_timed!(LaneRotationEvent::beat); 26 27loose_enum!( 28 /// Determines when a [`LaneRotationEvent`] will be applied to objects. 29 #[derive(Default, Debug, Clone, Copy, Eq, PartialEq, Hash)] 30 #[cfg_attr( 31 feature = "bevy_reflect", 32 derive(bevy_reflect::Reflect), 33 reflect(Debug, Clone, PartialEq) 34 )] 35 pub enum ExecutionTime: i32 { 36 /// The [`LaneRotationEvent`] will affect objects with a beat *greater than or equal to* the event's beat. 37 #[default] 38 Early = 0, 39 /// The [`LaneRotationEvent`] will affect objects with a beat *greater than* the event's beat. 40 Late = 1, 41 } 42); 43 44/// Changes the BPM of the map at a specific beat. 45#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 46#[cfg_attr( 47 feature = "bevy_reflect", 48 derive(bevy_reflect::Reflect), 49 reflect(Debug, Clone, PartialEq) 50)] 51pub struct BpmEvent { 52 /// The time the event takes place. 53 #[serde(rename = "b")] 54 pub beat: f32, 55 /// The BPM to change the map too. 56 #[serde(rename = "m")] 57 pub bpm: f32, 58} 59 60impl Default for BpmEvent { 61 fn default() -> Self { 62 Self { 63 beat: 0.0, 64 bpm: 100.0, 65 } 66 } 67} 68 69impl_timed!(BpmEvent::beat);