mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
Merge pull request #13 from Tomeno/simtime_pvs_fix
Add simtime & PVS flag to Player struct
This commit is contained in:
commit
92d9be233c
4 changed files with 51 additions and 14 deletions
|
|
@ -316,6 +316,7 @@ impl Parse<'_> for PacketEntitiesMessage {
|
||||||
let send_table = get_send_table(state, entity.server_class)?;
|
let send_table = get_send_table(state, entity.server_class)?;
|
||||||
|
|
||||||
Self::read_update(&mut data, send_table, &mut entity.props, entity_index)?;
|
Self::read_update(&mut data, send_table, &mut entity.props, entity_index)?;
|
||||||
|
entity.in_pvs = true;
|
||||||
|
|
||||||
entities.push(entity);
|
entities.push(entity);
|
||||||
} else if state.entity_classes.contains_key(&entity_index) {
|
} else if state.entity_classes.contains_key(&entity_index) {
|
||||||
|
|
@ -656,7 +657,7 @@ fn test_packet_entitier_message_roundtrip() {
|
||||||
value: SendPropValue::Float(1.0),
|
value: SendPropValue::Float(1.0),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
in_pvs: false,
|
in_pvs: true,
|
||||||
update_type: UpdateType::Preserve,
|
update_type: UpdateType::Preserve,
|
||||||
serial_number: 0,
|
serial_number: 0,
|
||||||
delay: None,
|
delay: None,
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@
|
||||||
"steamId": "[U:1:78023051]",
|
"steamId": "[U:1:78023051]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 89,
|
||||||
|
"in_pvs": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 3,
|
"entity": 3,
|
||||||
|
|
@ -44,7 +46,9 @@
|
||||||
"steamId": "[U:1:151261665]",
|
"steamId": "[U:1:151261665]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 85,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 4,
|
"entity": 4,
|
||||||
|
|
@ -67,7 +71,9 @@
|
||||||
"steamId": "[U:1:105458702]",
|
"steamId": "[U:1:105458702]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 80,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 5,
|
"entity": 5,
|
||||||
|
|
@ -90,7 +96,9 @@
|
||||||
"steamId": "[U:1:81747492]",
|
"steamId": "[U:1:81747492]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 92,
|
||||||
|
"in_pvs": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 6,
|
"entity": 6,
|
||||||
|
|
@ -113,7 +121,9 @@
|
||||||
"steamId": "[U:1:50363269]",
|
"steamId": "[U:1:50363269]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 85,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 7,
|
"entity": 7,
|
||||||
|
|
@ -136,7 +146,9 @@
|
||||||
"steamId": "[U:1:192228451]",
|
"steamId": "[U:1:192228451]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 87,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 8,
|
"entity": 8,
|
||||||
|
|
@ -159,7 +171,9 @@
|
||||||
"steamId": "[U:1:103356736]",
|
"steamId": "[U:1:103356736]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 83,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 9,
|
"entity": 9,
|
||||||
|
|
@ -182,7 +196,9 @@
|
||||||
"steamId": "[U:1:85558037]",
|
"steamId": "[U:1:85558037]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 84,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 10,
|
"entity": 10,
|
||||||
|
|
@ -205,7 +221,9 @@
|
||||||
"steamId": "[U:1:101328438]",
|
"steamId": "[U:1:101328438]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 86,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 11,
|
"entity": 11,
|
||||||
|
|
@ -228,7 +246,9 @@
|
||||||
"steamId": "[U:1:63292929]",
|
"steamId": "[U:1:63292929]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 88,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 12,
|
"entity": 12,
|
||||||
|
|
@ -251,7 +271,9 @@
|
||||||
"steamId": "[U:1:91304212]",
|
"steamId": "[U:1:91304212]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 81,
|
||||||
|
"in_pvs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"entity": 13,
|
"entity": 13,
|
||||||
|
|
@ -274,7 +296,9 @@
|
||||||
"steamId": "[U:1:82128674]",
|
"steamId": "[U:1:82128674]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 83,
|
||||||
|
"in_pvs": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"buildings": {},
|
"buildings": {},
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@
|
||||||
"steamId": "[U:1:64229260]",
|
"steamId": "[U:1:64229260]",
|
||||||
"team": "other"
|
"team": "other"
|
||||||
},
|
},
|
||||||
"charge": 0
|
"charge": 0,
|
||||||
|
"simtime": 78,
|
||||||
|
"in_pvs": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"buildings": {},
|
"buildings": {},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue