space_traders_api/models/ship_reactor.rs
1/*
2 * SpaceTraders API
3 *
4 * SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe. The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server. ```json http { \"method\": \"GET\", \"url\": \"https://api.spacetraders.io/v2\", } ``` Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community. We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players.
5 *
6 * The version of the OpenAPI document: 2.3.0
7 * Contact: joel@spacetraders.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ShipReactor : The reactor of the ship. The reactor is responsible for powering the ship's systems and weapons.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ShipReactor {
17 /// Symbol of the reactor.
18 #[serde(rename = "symbol")]
19 pub symbol: Symbol,
20 /// Name of the reactor.
21 #[serde(rename = "name")]
22 pub name: String,
23 /// Description of the reactor.
24 #[serde(rename = "description")]
25 pub description: String,
26 /// The repairable condition of a component. A value of 0 indicates the component needs significant repairs, while a value of 1 indicates the component is in near perfect condition. As the condition of a component is repaired, the overall integrity of the component decreases.
27 #[serde(rename = "condition")]
28 pub condition: f64,
29 /// The overall integrity of the component, which determines the performance of the component. A value of 0 indicates that the component is almost completely degraded, while a value of 1 indicates that the component is in near perfect condition. The integrity of the component is non-repairable, and represents permanent wear over time.
30 #[serde(rename = "integrity")]
31 pub integrity: f64,
32 /// The amount of power provided by this reactor. The more power a reactor provides to the ship, the lower the cooldown it gets when using a module or mount that taxes the ship's power.
33 #[serde(rename = "powerOutput")]
34 pub power_output: i32,
35 #[serde(rename = "requirements")]
36 pub requirements: Box<models::ShipRequirements>,
37 /// The overall quality of the component, which determines the quality of the component. High quality components return more ships parts and ship plating when a ship is scrapped. But also require more of these parts to repair. This is transparent to the player, as the parts are bought from/sold to the marketplace.
38 #[serde(rename = "quality")]
39 pub quality: f64,
40}
41
42impl ShipReactor {
43 /// The reactor of the ship. The reactor is responsible for powering the ship's systems and weapons.
44 pub fn new(symbol: Symbol, name: String, description: String, condition: f64, integrity: f64, power_output: i32, requirements: models::ShipRequirements, quality: f64) -> ShipReactor {
45 ShipReactor {
46 symbol,
47 name,
48 description,
49 condition,
50 integrity,
51 power_output,
52 requirements: Box::new(requirements),
53 quality,
54 }
55 }
56}
57/// Symbol of the reactor.
58#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
59pub enum Symbol {
60 #[serde(rename = "REACTOR_SOLAR_I")]
61 ReactorSolarI,
62 #[serde(rename = "REACTOR_FUSION_I")]
63 ReactorFusionI,
64 #[serde(rename = "REACTOR_FISSION_I")]
65 ReactorFissionI,
66 #[serde(rename = "REACTOR_CHEMICAL_I")]
67 ReactorChemicalI,
68 #[serde(rename = "REACTOR_ANTIMATTER_I")]
69 ReactorAntimatterI,
70}
71
72impl Default for Symbol {
73 fn default() -> Symbol {
74 Self::ReactorSolarI
75 }
76}
77