1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use std::ops::Range;
use getset::CopyGetters;
use serde::{Deserialize, Serialize};
use traffloat_types::units;
use crate::{building, cargo, gas, liquid, skill};
#[derive(Debug, Clone, getset::Getters, getset::CopyGetters, Serialize, Deserialize)]
#[cfg_attr(feature = "xy", derive(xylem::Xylem))]
#[cfg_attr(feature = "xy", xylem(derive(Deserialize)))]
pub struct Catalyst {
#[getset(get = "pub")]
range: CatalystRange,
#[getset(get_copy = "pub")]
multipliers: Multipliers,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "xy", derive(xylem::Xylem))]
#[cfg_attr(feature = "xy", xylem(derive(Deserialize), serde(tag = "type")))]
pub enum CatalystRange {
Cargo {
ty: cargo::Id,
levels: Range<units::CargoSize>,
},
Liquid {
ty: liquid::Id,
levels: Range<units::LiquidVolume>,
},
Gas {
ty: gas::Id,
levels: Range<units::GasVolume>,
},
Electricity {
levels: Range<units::ElectricPower>,
},
Light {
levels: Range<units::Brightness>,
},
Skill {
ty: skill::Id,
levels: Range<units::Skill>,
storage: building::storage::population::Id,
},
}
#[derive(Debug, Clone, Copy, CopyGetters, Serialize, Deserialize)]
#[cfg_attr(feature = "xy", derive(xylem::Xylem))]
#[cfg_attr(feature = "xy", xylem(derive(Deserialize)))]
pub struct Multipliers {
#[getset(get_copy = "pub")]
underflow: f64,
#[getset(get_copy = "pub")]
min: f64,
#[getset(get_copy = "pub")]
max: f64,
#[getset(get_copy = "pub")]
overflow: f64,
}