1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

store last medic target

This commit is contained in:
Robin Appelman 2025-08-07 22:45:59 +02:00
commit e303969606
4 changed files with 23 additions and 16 deletions

View file

@ -108,6 +108,7 @@ pub enum PlayerClassData {
charge: u8, charge: u8,
medigun: MedigunType, medigun: MedigunType,
target: Option<EntityId>, target: Option<EntityId>,
last_target: Option<EntityId>,
}, },
Spy { Spy {
disguise_team: Team, disguise_team: Team,
@ -123,6 +124,7 @@ impl PlayerClassData {
charge: 0, charge: 0,
medigun: MedigunType::Uber, medigun: MedigunType::Uber,
target: None, target: None,
last_target: None,
}, },
Class::Spy => PlayerClassData::Spy { Class::Spy => PlayerClassData::Spy {
disguise_team: Team::Other, disguise_team: Team::Other,

View file

@ -48,8 +48,11 @@ pub fn handle_medigun_entity(
.and_then(|self_handle| state.get_player_by_weapon_handle(self_handle)); .and_then(|self_handle| state.get_player_by_weapon_handle(self_handle));
if let Some(medic) = medic { if let Some(medic) = medic {
if let PlayerClassData::Medic { target, .. } = &mut medic.class_data { if let PlayerClassData::Medic { target, last_target, .. } = &mut medic.class_data {
*target = target_id; *target = target_id;
if target_id.is_some() {
*last_target = target_id;
}
} }
} }
} }

View file

@ -46,7 +46,7 @@ expression: state
268979, 268979,
316089 316089
], ],
"handle": 0, "handle": 1599490,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -112,7 +112,7 @@ expression: state
1182437, 1182437,
2097151 2097151
], ],
"handle": 0, "handle": 1718275,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -161,7 +161,8 @@ expression: state
"Medic": { "Medic": {
"charge": 0, "charge": 0,
"medigun": "uber", "medigun": "uber",
"target": null "target": 8,
"last_target": 8
} }
}, },
"simulation_time": 80, "simulation_time": 80,
@ -184,7 +185,7 @@ expression: state
1958250, 1958250,
1315401 1315401
], ],
"handle": 0, "handle": 1583108,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -250,7 +251,7 @@ expression: state
1917551, 1917551,
31344 31344
], ],
"handle": 0, "handle": 311301,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -316,7 +317,7 @@ expression: state
1278549, 1278549,
1200734 1200734
], ],
"handle": 0, "handle": 962566,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -365,7 +366,8 @@ expression: state
"Medic": { "Medic": {
"charge": 0, "charge": 0,
"medigun": "uber", "medigun": "uber",
"target": null "target": null,
"last_target": 11
} }
}, },
"simulation_time": 87, "simulation_time": 87,
@ -388,7 +390,7 @@ expression: state
14930, 14930,
1096287 1096287
], ],
"handle": 0, "handle": 696327,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -454,7 +456,7 @@ expression: state
447062, 447062,
1856087 1856087
], ],
"handle": 0, "handle": 1476616,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -520,7 +522,7 @@ expression: state
1476987, 1476987,
330275 330275
], ],
"handle": 0, "handle": 571401,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -586,7 +588,7 @@ expression: state
240229, 240229,
1909366 1909366
], ],
"handle": 0, "handle": 1884170,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -652,7 +654,7 @@ expression: state
1640708, 1640708,
1423621 1423621
], ],
"handle": 0, "handle": 24587,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -718,7 +720,7 @@ expression: state
381314, 381314,
194959 194959
], ],
"handle": 0, "handle": 677900,
"conditions": [ "conditions": [
0, 0,
0, 0,
@ -784,7 +786,7 @@ expression: state
260770, 260770,
1403555 1403555
], ],
"handle": 0, "handle": 174093,
"conditions": [ "conditions": [
0, 0,
0, 0,

View file

@ -46,7 +46,7 @@ expression: state
1587845, 1587845,
1211014 1211014
], ],
"handle": 0, "handle": 1972225,
"conditions": [ "conditions": [
0, 0,
0, 0,