use bincode::{Decode, Encode};
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
pub struct Hitsound {
pub file: String,
pub volume: Option<u8>,
}
impl Hitsound {
#[must_use]
pub fn new(file: impl Into<String>) -> Self {
Self {
file: file.into(),
volume: None,
}
}
#[must_use]
pub fn with_volume(file: impl Into<String>, volume: u8) -> Self {
Self {
file: file.into(),
volume: Some(volume.min(100)),
}
}
}