factorio_api/settings.rs
1pub struct ModSettingValue {
2 pub value: crate::LuaAny,
3}
4
5pub static UNIT_MOD_SETTING: ModSettingValue = ModSettingValue {
6 value: crate::LuaAny,
7};
8
9pub struct SettingTable {
10 pub startup: crate::LuaAny,
11 pub global: crate::LuaAny,
12 pub player_default: crate::LuaAny,
13}
14
15pub const settings: SettingTable = SettingTable {
16 startup: crate::LuaAny,
17 global: crate::LuaAny,
18 player_default: crate::LuaAny,
19};
20
21pub struct LuaDataInterface;
22
23impl LuaDataInterface {
24 /// Register one or more prototype definitions. Translates to `data:extend({...})`.
25 #[allow(unused_variables)]
26 pub fn extend<T, I: IntoIterator<Item = T>>(&self, items: I) {}
27}
28
29/// The global `data` object used to register prototypes and settings.
30pub static data: LuaDataInterface = LuaDataInterface;
31
32pub struct BoolSetting {
33 /// Internal mod-namespaced name (e.g. `"my-mod-enabled"`).
34 pub name: &'static str,
35 /// When the setting takes effect: `"startup"`, `"runtime-global"`, or `"runtime-per-user"`.
36 pub setting_type: &'static str,
37 /// The default value for this setting.
38 pub default_value: bool,
39}
40
41pub struct IntSetting {
42 /// Internal mod-namespaced name (e.g. `"my-mod-count"`).
43 pub name: &'static str,
44 /// When the setting takes effect: `"startup"`, `"runtime-global"`, or `"runtime-per-user"`.
45 pub setting_type: &'static str,
46 /// The default value for this setting.
47 pub default_value: i64,
48 /// Optional minimum allowed value.
49 pub minimum_value: Option<i64>,
50 /// Optional maximum allowed value.
51 pub maximum_value: Option<i64>,
52}
53
54pub struct DoubleSetting {
55 /// Internal mod-namespaced name.
56 pub name: &'static str,
57 /// When the setting takes effect: `"startup"`, `"runtime-global"`, or `"runtime-per-user"`.
58 pub setting_type: &'static str,
59 /// The default value for this setting.
60 pub default_value: f64,
61 /// Optional minimum allowed value.
62 pub minimum_value: Option<f64>,
63 /// Optional maximum allowed value.
64 pub maximum_value: Option<f64>,
65}
66
67pub struct StringSetting {
68 /// Internal mod-namespaced name.
69 pub name: &'static str,
70 /// When the setting takes effect: `"startup"`, `"runtime-global"`, or `"runtime-per-user"`.
71 pub setting_type: &'static str,
72 /// The default value for this setting.
73 pub default_value: &'static str,
74 /// If `true`, the value is not shown in-game (useful for internal state).
75 pub hidden: bool,
76}