ed_journals/modules/logs/content/log_event_content/
loadout_event.rs

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
//! Fired when there are updates to the player's ship modules.

use serde::{Deserialize, Serialize};

use crate::modules::ship::{ShipModule, ShipSlot, ShipType};

/// Fired when there are updates to the player's ship modules.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct LoadoutEvent {
    /// The current active ship.
    pub ship: ShipType,

    /// The current active ship id.
    #[serde(rename = "ShipID")]
    pub ship_id: u32,

    /// The name of the current active ship.
    pub ship_name: String,

    /// The name of the current call-sign.
    pub ship_ident: String,

    /// List of current modules.
    pub modules: Vec<LoadoutEventModule>,
}

/// An active loadout module.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct LoadoutEventModule {
    /// The slot the module is assigned to.
    pub slot: ShipSlot,

    /// The assigned module.
    pub item: ShipModule,

    /// Whether the module is currently active.
    pub on: bool,

    /// The power priority.
    pub priority: u8,

    /// The current health for the module.
    pub health: f32,

    // TODO check when this value is used
    pub value: Option<u32>,
    pub ammo_in_clip: Option<u32>,
}