mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
sentry shield
This commit is contained in:
parent
b93390d1e4
commit
e3810b0b03
2 changed files with 7 additions and 8 deletions
|
|
@ -208,10 +208,11 @@ pub struct Sentry {
|
||||||
pub team: Team,
|
pub team: Team,
|
||||||
pub angle: f32,
|
pub angle: f32,
|
||||||
pub player_controlled: bool,
|
pub player_controlled: bool,
|
||||||
pub auto_aim_target: UserId,
|
pub auto_aim_target: Handle,
|
||||||
pub shells: u16,
|
pub shells: u16,
|
||||||
pub rockets: u16,
|
pub rockets: u16,
|
||||||
pub is_mini: bool,
|
pub is_mini: bool,
|
||||||
|
pub shield: bool,
|
||||||
pub construction_progress: f32,
|
pub construction_progress: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::demo::data::game_state::{
|
use crate::demo::data::game_state::{Building, BuildingClass, Dispenser, GameState, Handle, Sentry, Teleporter};
|
||||||
Building, BuildingClass, Dispenser, GameState, Sentry, Teleporter,
|
|
||||||
};
|
|
||||||
use crate::demo::message::{EntityId, PacketEntity, UpdateType};
|
use crate::demo::message::{EntityId, PacketEntity, UpdateType};
|
||||||
use crate::demo::parser::analyser::{Team, UserId};
|
use crate::demo::parser::analyser::{Team, UserId};
|
||||||
use crate::demo::sendprop::{SendPropIdentifier, SendPropValue};
|
use crate::demo::sendprop::{SendPropIdentifier, SendPropValue};
|
||||||
|
|
@ -23,6 +21,8 @@ pub fn handle_sentry_entity(
|
||||||
SendPropIdentifier::new("DT_ObjectSentrygun", "m_iAmmoShells");
|
SendPropIdentifier::new("DT_ObjectSentrygun", "m_iAmmoShells");
|
||||||
const ROCKETS: SendPropIdentifier =
|
const ROCKETS: SendPropIdentifier =
|
||||||
SendPropIdentifier::new("DT_ObjectSentrygun", "m_iAmmoRockets");
|
SendPropIdentifier::new("DT_ObjectSentrygun", "m_iAmmoRockets");
|
||||||
|
const SHIELD: SendPropIdentifier =
|
||||||
|
SendPropIdentifier::new("DT_ObjectSentrygun", "m_nShieldLevel");
|
||||||
|
|
||||||
if entity.update_type == UpdateType::Delete {
|
if entity.update_type == UpdateType::Delete {
|
||||||
state.remove_building(entity.entity_index);
|
state.remove_building(entity.entity_index);
|
||||||
|
|
@ -41,12 +41,10 @@ pub fn handle_sentry_entity(
|
||||||
CONTROLLED => {
|
CONTROLLED => {
|
||||||
sentry.player_controlled = i64::try_from(&prop.value).unwrap_or_default() > 0
|
sentry.player_controlled = i64::try_from(&prop.value).unwrap_or_default() > 0
|
||||||
}
|
}
|
||||||
TARGET => {
|
TARGET => sentry.auto_aim_target = Handle::try_from(&prop.value).unwrap_or_default(),
|
||||||
sentry.auto_aim_target =
|
|
||||||
UserId::from(i64::try_from(&prop.value).unwrap_or_default() as u16)
|
|
||||||
}
|
|
||||||
SHELLS => sentry.shells = i64::try_from(&prop.value).unwrap_or_default() as u16,
|
SHELLS => sentry.shells = i64::try_from(&prop.value).unwrap_or_default() as u16,
|
||||||
ROCKETS => sentry.rockets = i64::try_from(&prop.value).unwrap_or_default() as u16,
|
ROCKETS => sentry.rockets = i64::try_from(&prop.value).unwrap_or_default() as u16,
|
||||||
|
SHIELD => sentry.shield = bool::try_from(&prop.value).unwrap_or_default(),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue