mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
project critical
This commit is contained in:
parent
306362d36e
commit
331a9fe593
4 changed files with 127 additions and 50 deletions
|
|
@ -322,6 +322,7 @@ pub struct Projectile {
|
|||
pub bounds: Option<Box>,
|
||||
pub launcher: Handle,
|
||||
pub ty: ProjectileType,
|
||||
pub critical: bool,
|
||||
}
|
||||
|
||||
impl Projectile {
|
||||
|
|
@ -336,6 +337,7 @@ impl Projectile {
|
|||
bounds: None,
|
||||
launcher: Handle::default(),
|
||||
ty: ProjectileType::new(class_name, None),
|
||||
critical: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -597,6 +597,14 @@ impl GameStateAnalyser {
|
|||
SendPropIdentifier::new("DT_TFBaseRocket", "m_angRotation");
|
||||
const GRENADE_ROTATION: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFWeaponBaseGrenadeProj", "m_angRotation");
|
||||
const CRITICAL_GRENADE: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFWeaponBaseGrenadeProj", "m_bCritical");
|
||||
const CRITICAL_ROCKET: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFProjectile_Rocket", "m_bCritical");
|
||||
const CRITICAL_FLARE: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFProjectile_Flare", "m_bCritical");
|
||||
const CRITICAL_ARROW: SendPropIdentifier =
|
||||
SendPropIdentifier::new("DT_TFProjectile_Arrow", "m_bCritical");
|
||||
|
||||
if entity.update_type == UpdateType::Delete {
|
||||
self.state.projectile_destroy(entity.entity_index);
|
||||
|
|
@ -643,6 +651,10 @@ impl GameStateAnalyser {
|
|||
let rotation = Vector::try_from(&prop.value).unwrap_or_default();
|
||||
projectile.rotation = rotation;
|
||||
}
|
||||
CRITICAL_GRENADE | CRITICAL_ROCKET | CRITICAL_FLARE | CRITICAL_ARROW => {
|
||||
let critical = bool::try_from(&prop.value).unwrap_or_default();
|
||||
projectile.critical = critical;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1039,6 +1039,19 @@ impl TryFrom<&SendPropValue> for i64 {
|
|||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SendPropValue> for bool {
|
||||
type Error = MalformedSendPropDefinitionError;
|
||||
fn try_from(value: &SendPropValue) -> std::result::Result<Self, Self::Error> {
|
||||
match value {
|
||||
SendPropValue::Integer(val) => Ok(*val > 0),
|
||||
_ => Err(MalformedSendPropDefinitionError::WrongPropType {
|
||||
expected: "boolean",
|
||||
value: value.clone(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&SendPropValue> for Vector {
|
||||
type Error = MalformedSendPropDefinitionError;
|
||||
fn try_from(value: &SendPropValue) -> std::result::Result<Self, Self::Error> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue