space_traders_api/models/ship_frame.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/// ShipFrame : The frame of the ship. The frame determines the number of modules and mounting points of the ship, as well as base fuel capacity. As the condition of the frame takes more wear, the ship will become more sluggish and less maneuverable.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ShipFrame {
17 /// Symbol of the frame.
18 #[serde(rename = "symbol")]
19 pub symbol: Symbol,
20 /// Name of the frame.
21 #[serde(rename = "name")]
22 pub name: String,
23 /// Description of the frame.
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 slots that can be dedicated to modules installed in the ship. Each installed module take up a number of slots, and once there are no more slots, no new modules can be installed.
33 #[serde(rename = "moduleSlots")]
34 pub module_slots: i32,
35 /// The amount of slots that can be dedicated to mounts installed in the ship. Each installed mount takes up a number of points, and once there are no more points remaining, no new mounts can be installed.
36 #[serde(rename = "mountingPoints")]
37 pub mounting_points: i32,
38 /// The maximum amount of fuel that can be stored in this ship. When refueling, the ship will be refueled to this amount.
39 #[serde(rename = "fuelCapacity")]
40 pub fuel_capacity: i32,
41 #[serde(rename = "requirements")]
42 pub requirements: Box<models::ShipRequirements>,
43 /// 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.
44 #[serde(rename = "quality")]
45 pub quality: f64,
46}
47
48impl ShipFrame {
49 /// The frame of the ship. The frame determines the number of modules and mounting points of the ship, as well as base fuel capacity. As the condition of the frame takes more wear, the ship will become more sluggish and less maneuverable.
50 pub fn new(symbol: Symbol, name: String, description: String, condition: f64, integrity: f64, module_slots: i32, mounting_points: i32, fuel_capacity: i32, requirements: models::ShipRequirements, quality: f64) -> ShipFrame {
51 ShipFrame {
52 symbol,
53 name,
54 description,
55 condition,
56 integrity,
57 module_slots,
58 mounting_points,
59 fuel_capacity,
60 requirements: Box::new(requirements),
61 quality,
62 }
63 }
64}
65/// Symbol of the frame.
66#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
67pub enum Symbol {
68 #[serde(rename = "FRAME_PROBE")]
69 FrameProbe,
70 #[serde(rename = "FRAME_DRONE")]
71 FrameDrone,
72 #[serde(rename = "FRAME_INTERCEPTOR")]
73 FrameInterceptor,
74 #[serde(rename = "FRAME_RACER")]
75 FrameRacer,
76 #[serde(rename = "FRAME_FIGHTER")]
77 FrameFighter,
78 #[serde(rename = "FRAME_FRIGATE")]
79 FrameFrigate,
80 #[serde(rename = "FRAME_SHUTTLE")]
81 FrameShuttle,
82 #[serde(rename = "FRAME_EXPLORER")]
83 FrameExplorer,
84 #[serde(rename = "FRAME_MINER")]
85 FrameMiner,
86 #[serde(rename = "FRAME_LIGHT_FREIGHTER")]
87 FrameLightFreighter,
88 #[serde(rename = "FRAME_HEAVY_FREIGHTER")]
89 FrameHeavyFreighter,
90 #[serde(rename = "FRAME_TRANSPORT")]
91 FrameTransport,
92 #[serde(rename = "FRAME_DESTROYER")]
93 FrameDestroyer,
94 #[serde(rename = "FRAME_CRUISER")]
95 FrameCruiser,
96 #[serde(rename = "FRAME_CARRIER")]
97 FrameCarrier,
98 #[serde(rename = "FRAME_BULK_FREIGHTER")]
99 FrameBulkFreighter,
100}
101
102impl Default for Symbol {
103 fn default() -> Symbol {
104 Self::FrameProbe
105 }
106}
107