1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub struct ModSettingValue {
9 pub value: crate::LuaAny,
10}
11
12pub static UNIT_MOD_SETTING: ModSettingValue = ModSettingValue {
13 value: crate::LuaAny,
14};
15
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
18pub struct SettingsDictionary;
19
20impl SettingsDictionary {
21 #[must_use]
23 pub const fn get_bool(self, _name: &'static str) -> bool {
24 false
25 }
26
27 #[must_use]
29 pub const fn get_int(self, _name: &'static str) -> i64 {
30 0
31 }
32
33 #[must_use]
35 pub const fn get_double(self, _name: &'static str) -> f64 {
36 0.0
37 }
38
39 #[must_use]
41 pub const fn get_string(self, _name: &'static str) -> &'static str {
42 ""
43 }
44
45 #[must_use]
47 pub const fn get<T: crate::SettingValue>(self, _name: &'static str) -> T {
48 T::STUB
49 }
50
51 #[must_use]
53 pub fn setting(self, _name: &'static str) -> ModSettingValue {
54 UNIT_MOD_SETTING
55 }
56}
57
58impl std::ops::Index<&str> for SettingsDictionary {
59 type Output = ModSettingValue;
60
61 fn index(&self, _key: &str) -> &ModSettingValue {
62 &UNIT_MOD_SETTING
63 }
64}
65
66pub struct SettingTable {
67 pub startup: SettingsDictionary,
68 pub global: SettingsDictionary,
69 pub player_default: SettingsDictionary,
70}
71
72pub const settings: SettingTable = SettingTable {
73 startup: SettingsDictionary,
74 global: SettingsDictionary,
75 player_default: SettingsDictionary,
76};
77
78pub struct LuaDataInterface;
79
80impl LuaDataInterface {
81 #[allow(unused_variables)]
83 pub fn extend<T, I: IntoIterator<Item = T>>(&self, items: I) {}
84}
85
86pub static data: LuaDataInterface = LuaDataInterface;
88
89pub struct BoolSetting {
90 pub name: &'static str,
92 pub setting_type: &'static str,
94 pub default_value: bool,
96}
97
98pub struct IntSetting {
99 pub name: &'static str,
101 pub setting_type: &'static str,
103 pub default_value: i64,
105 pub minimum_value: Option<i64>,
107 pub maximum_value: Option<i64>,
109}
110
111pub struct DoubleSetting {
112 pub name: &'static str,
114 pub setting_type: &'static str,
116 pub default_value: f64,
118 pub minimum_value: Option<f64>,
120 pub maximum_value: Option<f64>,
122}
123
124pub struct StringSetting {
125 pub name: &'static str,
127 pub setting_type: &'static str,
129 pub default_value: &'static str,
131 pub hidden: bool,
133}