-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathunit_died.rs
36 lines (32 loc) · 1.08 KB
/
unit_died.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
//! A protocol agnostic Unit Died
#[cfg(feature = "arrow")]
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};
use crate::filters::SC2ReplayFilters;
use serde::{Deserialize, Serialize};
/// A Unit died event, it does not contain the unit owner player id.
/// Or the unit name. For a process of enriching this data see UnitBornEventFlatRow.
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
#[cfg_attr(
feature = "arrow",
derive(ArrowField, ArrowSerialize, ArrowDeserialize)
)]
pub struct UnitDiedEvent {
pub unit_tag_index: u32,
pub unit_tag_recycle: u32,
pub killer_player_id: Option<u8>,
pub x: u8,
pub y: u8,
pub killer_unit_tag_index: Option<u32>,
pub killer_unit_tag_recycle: Option<u32>,
}
impl UnitDiedEvent {
pub fn should_skip(&self, filters: &SC2ReplayFilters) -> bool {
// TODO: Should we add the unit_died_player_id/name?
if let Some(player_id) = filters.player_id {
if self.killer_player_id != Some(player_id) {
return true;
}
}
false
}
}