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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
use crate::internal::*;
use crate::prelude::*;
pub mod generator;
pub mod types;
#[derive(Clone, PartialEq, PartialOrd, Debug, Default, Serialize, Deserialize)]
pub struct TelluricBodyDetails {
/// The main composition of this world.
pub body_type: TelluricBodyComposition,
/// The type of this world.
pub world_type: CelestialBodyWorldType,
/// What are the pecularities of this telluric body.
pub special_traits: Vec<CelestialBodySpecialTrait>,
/// The degree of heat this body's core still has.
pub core_heat: CelestialBodyCoreHeat,
/// The strength of this object's magnetic field.
pub magnetic_field: MagneticFieldStrength,
/// This body's atmospheric pressure, in atm, with 1 atm being equal to the average sea-level air pressure on Earth.
pub atmospheric_pressure: f32,
/// What is the atmosphere composed of.
pub atmospheric_composition: Vec<(f32, ChemicalComponent)>,
/// Percentage of this world that is covered by some kind of liquid.
pub hydrosphere: f32,
/// Percentage of water on this world that is covered by some kind of ice.
pub ice_over_water: f32,
/// Percentage of land on this world that is in the open, as in not recovered by water or ice.
pub land_area_percentage: f32,
/// Percentage of land on this world that is covered by some kind of ice.
pub ice_over_land: f32,
/// An indication of the levels of volcanism in this world, from 0 to 100 (check `get_volcanism_level` to know what the numbers correspond to).
pub volcanism: f32,
/// An indication of the levels of tectonic activity in this world, from 0 to 100 (check `get_tectonics_level` to know what the numbers correspond to).
pub tectonic_activity: f32,
/// An indication of the levels of average relative water humidity in this world. Value will be -1.0 if non-applicable (no atmosphere or temperature < -50°C for example).
pub humidity: f32,
/// A descriptive name for the world’s over-all surface temperature.
pub temperature_category: WorldTemperatureCategory,
/// A descriptive name for the world’s over-all climate.
pub climate: WorldClimateType,
// pub landmasses: u32,
// pub territories: Vec<Territory>,
// pub atmospheric_composition: AtmosphericCompositionType,
// pub special_features: Vec<Information>,
}
impl TelluricBodyDetails {
/// Creates a new [TelluricBodyDetails].
pub fn new(
body_type: TelluricBodyComposition,
world_type: CelestialBodyWorldType,
special_traits: Vec<CelestialBodySpecialTrait>,
core_heat: CelestialBodyCoreHeat,
magnetic_field: MagneticFieldStrength,
atmospheric_pressure: f32,
atmospheric_composition: Vec<(f32, ChemicalComponent)>,
hydrosphere: f32,
ice_over_water: f32,
land_area_percentage: f32,
ice_over_land: f32,
volcanism: f32,
tectonic_activity: f32,
humidity: f32,
temperature_category: WorldTemperatureCategory,
climate: WorldClimateType,
) -> Self {
Self {
body_type,
world_type,
special_traits,
core_heat,
magnetic_field,
atmospheric_pressure,
atmospheric_composition,
hydrosphere,
ice_over_water,
land_area_percentage,
ice_over_land,
volcanism,
tectonic_activity,
humidity,
temperature_category,
climate,
}
}
/// Returns an enum value giving a human-comprehensible value to this planet's volcanism levels.
pub fn get_volcanism_level(self) -> VolcanicActivity {
if self.volcanism <= 0.01 {
VolcanicActivity::None
} else if self.volcanism <= 6.0 {
VolcanicActivity::Light
} else if self.volcanism <= 25.0 {
VolcanicActivity::Moderate
} else if self.volcanism <= 55.0 {
VolcanicActivity::Heavy
} else {
VolcanicActivity::Extreme
}
}
/// Returns an enum value giving a human-comprehensible value to this planet's tectonic activity levels.
pub fn get_tectonics_level(self) -> TectonicActivity {
if self.tectonic_activity <= 0.01 {
TectonicActivity::None
} else if self.tectonic_activity <= 16.0 {
TectonicActivity::Light
} else if self.tectonic_activity <= 35.0 {
TectonicActivity::Moderate
} else if self.tectonic_activity <= 55.0 {
TectonicActivity::Heavy
} else {
TectonicActivity::Extreme
}
}
}