luminol_data/
lib.rs

1#![allow(non_upper_case_globals)]
2
3// Editor specific types
4pub mod rmxp;
5
6// Shared structs with the same layout
7mod shared;
8
9mod option_vec;
10
11mod rgss_structs;
12
13pub mod helpers;
14
15pub mod commands;
16
17pub use helpers::*;
18pub use option_vec::OptionVec;
19pub use rgss_structs::{Color, Table1, Table2, Table3, Tone};
20
21pub mod rpg {
22    pub use crate::rmxp::*;
23    pub use crate::shared::*;
24
25    pub trait DatabaseEntry
26    where
27        Self: Default,
28    {
29        fn default_with_id(id: usize) -> Self;
30    }
31
32    macro_rules! basic_container {
33        ($($parent:ident, $child:ident),* $(,)?) => {
34            $(
35                #[derive(Debug, Default)]
36                pub struct $parent {
37                    pub data: Vec<$child>,
38                    pub modified: bool,
39                }
40            )*
41        };
42    }
43
44    macro_rules! database_entry {
45        ($($type:ident),* $(,)?) => {
46            $(
47                impl DatabaseEntry for $type {
48                    fn default_with_id(id: usize) -> Self {
49                        Self { id, ..Default::default() }
50                    }
51                }
52            )*
53        };
54    }
55
56    basic_container! {
57        Actors, Actor,
58        Animations, Animation,
59        Armors, Armor,
60        Classes, Class,
61        CommonEvents, CommonEvent,
62        Enemies, Enemy,
63        Items, Item,
64        Scripts, Script,
65        Skills, Skill,
66        States, State,
67        Tilesets, Tileset,
68        Troops, Troop,
69        Weapons, Weapon,
70    }
71
72    database_entry! {
73        Actor,
74        Animation,
75        Armor,
76        Class,
77        CommonEvent,
78        Enemy,
79        Item,
80        Skill,
81        State,
82        Tileset,
83        Troop,
84        Weapon,
85    }
86
87    #[derive(Debug, Default)]
88    pub struct MapInfos {
89        pub data: std::collections::HashMap<usize, MapInfo>,
90        pub modified: bool,
91    }
92}
93
94pub use shared::BlendMode;
95
96pub type Path = Option<camino::Utf8PathBuf>;