space_traders_api/models/ship_engine.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/// ShipEngine : The engine determines how quickly a ship travels between waypoints.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ShipEngine {
17 /// The symbol of the engine.
18 #[serde(rename = "symbol")]
19 pub symbol: Symbol,
20 /// The name of the engine.
21 #[serde(rename = "name")]
22 pub name: String,
23 /// The description of the engine.
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 speed stat of this engine. The higher the speed, the faster a ship can travel from one point to another. Reduces the time of arrival when navigating the ship.
33 #[serde(rename = "speed")]
34 pub speed: 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 ShipEngine {
43 /// The engine determines how quickly a ship travels between waypoints.
44 pub fn new(symbol: Symbol, name: String, description: String, condition: f64, integrity: f64, speed: i32, requirements: models::ShipRequirements, quality: f64) -> ShipEngine {
45 ShipEngine {
46 symbol,
47 name,
48 description,
49 condition,
50 integrity,
51 speed,
52 requirements: Box::new(requirements),
53 quality,
54 }
55 }
56}
57/// The symbol of the engine.
58#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
59pub enum Symbol {
60 #[serde(rename = "ENGINE_IMPULSE_DRIVE_I")]
61 EngineImpulseDriveI,
62 #[serde(rename = "ENGINE_ION_DRIVE_I")]
63 EngineIonDriveI,
64 #[serde(rename = "ENGINE_ION_DRIVE_II")]
65 EngineIonDriveIi,
66 #[serde(rename = "ENGINE_HYPER_DRIVE_I")]
67 EngineHyperDriveI,
68}
69
70impl Default for Symbol {
71 fn default() -> Symbol {
72 Self::EngineImpulseDriveI
73 }
74}
75