Skip to main content

modde_games/cyberpunk/
manifest.rs

1use serde::Deserialize;
2
3/// REDmod mod manifest (`info.json`).
4#[derive(Debug, Clone, Deserialize)]
5pub struct RedModManifest {
6    pub name: String,
7    pub version: Option<String>,
8    #[serde(default)]
9    pub custom_sounds: Vec<CustomSound>,
10    #[serde(default)]
11    pub scripts: Vec<ScriptEntry>,
12}
13
14#[derive(Debug, Clone, Deserialize)]
15pub struct CustomSound {
16    pub name: String,
17    #[serde(rename = "type")]
18    pub sound_type: Option<String>,
19    pub file: String,
20}
21
22#[derive(Debug, Clone, Deserialize)]
23pub struct ScriptEntry {
24    pub name: String,
25    pub path: Option<String>,
26}
27
28impl RedModManifest {
29    /// Parse a REDmod `info.json` file.
30    pub fn parse(json: &str) -> anyhow::Result<Self> {
31        Ok(serde_json::from_str(json)?)
32    }
33}