mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
Add simtime and PVS state to Player struct
This commit is contained in:
parent
500e43c9de
commit
9f1f4cf69f
1 changed files with 10 additions and 0 deletions
|
|
@ -54,6 +54,8 @@ pub struct Player {
|
|||
pub state: PlayerState,
|
||||
pub info: Option<UserInfo>,
|
||||
pub charge: u8,
|
||||
pub simtime: u16,
|
||||
pub in_pvs: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||
|
|
@ -473,6 +475,11 @@ impl GameStateAnalyser {
|
|||
const NON_LOCAL_PITCH_ANGLES: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFNonLocalPlayerExclusive", "m_angEyeAngles[0]");
|
||||
|
||||
const SIMTIME_PROP: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_BaseEntity", "m_flSimulationTime");
|
||||
|
||||
player.in_pvs = entity.in_pvs;
|
||||
|
||||
for prop in entity.props(parser_state) {
|
||||
match prop.identifier {
|
||||
HEALTH_PROP => {
|
||||
|
|
@ -498,6 +505,9 @@ impl GameStateAnalyser {
|
|||
LOCAL_PITCH_ANGLES | NON_LOCAL_PITCH_ANGLES => {
|
||||
player.pitch_angle = f32::try_from(&prop.value).unwrap_or_default()
|
||||
}
|
||||
SIMTIME_PROP => {
|
||||
player.simtime = i64::try_from(&prop.value).unwrap_or_default() as u16
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue