- Added AWP warning and sight-lines while scoped
- Added Bomb timer
Todo: cleanup
This commit is contained in:
Janek
2024-01-09 23:06:32 +01:00
parent 36013078ce
commit d31c3f8ee5
5 changed files with 242 additions and 13 deletions

View File

@@ -10,12 +10,18 @@ pub struct PlayerData {
player_type: PlayerType,
#[serde(rename = "hasBomb")]
has_bomb: bool
has_bomb: bool,
#[serde(rename = "hasAwp")]
has_awp: bool,
#[serde(rename = "isScoped")]
is_scoped: bool
}
impl PlayerData {
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool) -> PlayerData {
PlayerData { pos, yaw, player_type, has_bomb }
pub fn new(pos: Vec3, yaw: f32, player_type: PlayerType, has_bomb: bool, has_awp: bool, is_scoped: bool) -> PlayerData {
PlayerData { pos, yaw, player_type, has_bomb, has_awp, is_scoped }
}
}
@@ -44,6 +50,24 @@ pub struct RadarData {
freq: usize,
ingame: bool,
#[serde(rename = "bombPlanted")]
bomb_planted: bool,
#[serde(rename = "bombExploded")]
bomb_exploded: bool,
#[serde(rename = "bombBeingDefused")]
bomb_being_defused: bool,
#[serde(rename = "bombCanDefuse")]
bomb_can_defuse: bool,
#[serde(rename = "bombDefuseLength")]
bomb_defuse_length: f32,
#[serde(rename = "bombDefuseTimeleft")]
bomb_defuse_timeleft: f32,
#[serde(rename = "mapName")]
map_name: String,
@@ -55,8 +79,8 @@ pub struct RadarData {
}
impl RadarData {
pub fn new(ingame: bool, map_name: String, player_data: Vec<EntityData>, freq: usize) -> RadarData {
RadarData { ingame, map_name, player_data, freq }
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) -> 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 }
}
/// Returns empty RadarData, it's also the same data that gets sent to clients when not ingame
@@ -65,7 +89,13 @@ impl RadarData {
ingame: false,
map_name: String::new(),
player_data: Vec::new(),
freq
freq,
bomb_planted: false,
bomb_can_defuse: false,
bomb_defuse_timeleft: 0.0,
bomb_exploded: false,
bomb_being_defused: false,
bomb_defuse_length: 0.0
}
}
}