mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +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 state: PlayerState,
|
||||||
pub info: Option<UserInfo>,
|
pub info: Option<UserInfo>,
|
||||||
pub charge: u8,
|
pub charge: u8,
|
||||||
|
pub simtime: u16,
|
||||||
|
pub in_pvs: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||||
|
|
@ -472,6 +474,11 @@ impl GameStateAnalyser {
|
||||||
SendPropIdentifier::new("DT_TFLocalPlayerExclusive", "m_angEyeAngles[0]");
|
SendPropIdentifier::new("DT_TFLocalPlayerExclusive", "m_angEyeAngles[0]");
|
||||||
const NON_LOCAL_PITCH_ANGLES: SendPropIdentifier =
|
const NON_LOCAL_PITCH_ANGLES: SendPropIdentifier =
|
||||||
SendPropIdentifier::new("DT_TFNonLocalPlayerExclusive", "m_angEyeAngles[0]");
|
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) {
|
for prop in entity.props(parser_state) {
|
||||||
match prop.identifier {
|
match prop.identifier {
|
||||||
|
|
@ -498,6 +505,9 @@ impl GameStateAnalyser {
|
||||||
LOCAL_PITCH_ANGLES | NON_LOCAL_PITCH_ANGLES => {
|
LOCAL_PITCH_ANGLES | NON_LOCAL_PITCH_ANGLES => {
|
||||||
player.pitch_angle = f32::try_from(&prop.value).unwrap_or_default()
|
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