nurtex_protocol/types/
physics_flags.rs1use std::io::{self, Cursor, Write};
2
3use nurtex_codec::Buffer;
4
5#[derive(Clone, Debug, PartialEq)]
7pub struct PhysicsFlags {
8 pub on_ground: bool,
9 pub pushing_against_wall: bool,
10}
11
12impl Buffer for PhysicsFlags {
13 fn read_buf(buffer: &mut Cursor<&[u8]>) -> Option<Self> {
14 Some(Self {
15 on_ground: bool::read_buf(buffer)?,
16 pushing_against_wall: bool::read_buf(buffer)?,
17 })
18 }
19
20 fn write_buf(&self, buffer: &mut impl Write) -> io::Result<()> {
21 self.on_ground.write_buf(buffer)?;
22 self.pushing_against_wall.write_buf(buffer)?;
23 Ok(())
24 }
25}