mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
object detonated
This commit is contained in:
parent
311345cf4e
commit
fdd6fe498e
2 changed files with 16 additions and 0 deletions
|
|
@ -96,6 +96,7 @@ pub enum GameEvent<'a> {
|
|||
Extinguished(ExtinguishedEvent<'a>),
|
||||
GameOver(GameOverEvent<'a>),
|
||||
FinalScore(FinalScoreEvent),
|
||||
ObjectDetonated(ObjectDetonatedEvent<'a>),
|
||||
LogFileClosed,
|
||||
}
|
||||
|
||||
|
|
@ -210,6 +211,9 @@ impl<'a> GameEvent<'a> {
|
|||
GameEvent::FinalScore(final_score_event_parser(raw.params).with_type(raw.ty)?)
|
||||
}
|
||||
RawEventType::LogFileClosed => GameEvent::LogFileClosed,
|
||||
RawEventType::ObjectDetonated => GameEvent::ObjectDetonated(
|
||||
object_detonated_event_parser(raw.params).with_type(raw.ty)?,
|
||||
),
|
||||
_ => {
|
||||
todo!("{:?} not parsed yet", raw.ty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,6 +249,18 @@ pub fn killed_object_event_parser(input: &str) -> IResult<&str, KilledObjectEven
|
|||
))
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ObjectDetonatedEvent<'a> {
|
||||
pub object: Option<&'a str>,
|
||||
pub position: Option<(i32, i32, i32)>,
|
||||
}
|
||||
|
||||
pub fn object_detonated_event_parser(input: &str) -> IResult<&str, ObjectDetonatedEvent> {
|
||||
let (input, object) = opt(param_parse("object"))(input)?;
|
||||
let (input, position) = opt(param_parse_with("attacker_position", position))(input)?;
|
||||
Ok((input, ObjectDetonatedEvent { object, position }))
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExtinguishedEvent<'a> {
|
||||
pub against: RawSubject<'a>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue