This commit is contained in:
Janek 2024-04-10 22:49:41 +02:00
parent 4ef96f821f
commit 45081a21b1
2 changed files with 9 additions and 9 deletions

@ -68,8 +68,8 @@ pub struct RadarData {
#[serde(rename = "bombDefuseTimeleft")] #[serde(rename = "bombDefuseTimeleft")]
bomb_defuse_timeleft: f32, bomb_defuse_timeleft: f32,
#[serde(rename = "bombDefuseLeft")] #[serde(rename = "bombDefuseEnd")]
bomb_defuse_left: f32, bomb_defuse_end: f32,
#[serde(rename = "mapName")] #[serde(rename = "mapName")]
map_name: String, map_name: String,
@ -82,8 +82,8 @@ pub struct RadarData {
} }
impl RadarData { impl RadarData {
pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32, bomb_defuse_left: f32) -> RadarData { pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize, bomb_planted: bool, bomb_cannot_defuse: bool, bomb_defuse_timeleft: f32, bomb_exploded: bool, bomb_being_defused: bool, bomb_defuse_length: f32, bomb_defuse_end: f32) -> RadarData {
RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length, bomb_defuse_left } RadarData { ingame, map_name, player_data, freq, bomb_planted, bomb_can_defuse: bomb_cannot_defuse, bomb_defuse_timeleft, bomb_exploded, bomb_being_defused, bomb_defuse_length, bomb_defuse_end }
} }
/// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame /// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame
@ -99,7 +99,7 @@ impl RadarData {
bomb_exploded: false, bomb_exploded: false,
bomb_being_defused: false, bomb_being_defused: false,
bomb_defuse_length: 0.0, bomb_defuse_length: 0.0,
bomb_defuse_left: 0.0 bomb_defuse_end: 0.0
} }
} }
} }

@ -81,10 +81,10 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
} }
}; };
let bomb_defuse_left: f32 = { let bomb_defuse_end: f32 = {
if bomb_can_defuse { if bomb_can_defuse {
if let Some(defuse_stamp) = data.bomb_defuse_stamp { if let Some(bomb_stamp) = data.bomb_defuse_stamp {
data.bomb_defuse_length - defuse_stamp.elapsed().as_secs_f32() (data.bomb_plant_timer - bomb_stamp.elapsed().as_secs_f32()) - data.bomb_defuse_length
} else { } else {
0.0 0.0
} }
@ -217,7 +217,7 @@ pub async fn run(radar_data: ArcRwlockRadarData, connector: Connector, pcileech_
data.bomb_exploded, data.bomb_exploded,
data.bomb_being_defused, data.bomb_being_defused,
data.bomb_defuse_length, data.bomb_defuse_length,
bomb_defuse_left bomb_defuse_end
); );
} else { } else {
let mut radar = radar_data.write().await; let mut radar = radar_data.write().await;